tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] rc testing with netbsd-curses: build break


From: grischka
Subject: Re: [Tinycc-devel] rc testing with netbsd-curses: build break
Date: Sat, 23 Sep 2023 09:46:23 +0200
User-agent: Mozilla/5.0 (Windows NT 6.0; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 22.09.2023 21:17, Detlef Riekenberg wrote:

Obviously when loading a .so library,
tcc additionally is loads its dependencies too.

That would be correct, when the target is TCC_OUTPUT_MEMORY
but i think, in all other cases, tcc should not do that.

I'd suggest to use "grep -nrw tcc_load_dll ." for example.  There is
only one place from where tcc_load_dll() is called:

in libtcc.c:tcc_add_file_internal():

        case AFF_BINTYPE_DYN:
            if (s1->output_type == TCC_OUTPUT_MEMORY) {
#ifdef TCC_IS_NATIVE
                void* dl = dlopen(filename, RTLD_GLOBAL | RTLD_LAZY);
                if (dl)
                    tcc_add_dllref(s1, filename, 0)->handle = dl, ret = 0;
#endif
            } else
                ret = tcc_load_dll(s1, fd, filename, (flags & 
AFF_REFERENCED_DLL) != 0);
            break;

So, for TCC_OUTPUT_MEMORY, tcc does not use tcc_load_dll(),  It calls
"dlopen()" instead.  Where dlopen() would invoke the dynamic linker
(ld.so) and that one then would take care to load any dependencies
(DT_NEEDED tags).

-- gr




reply via email to

[Prev in Thread] Current Thread [Next in Thread]