[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] rc testing with netbsd-curses: build break
From: |
Detlef Riekenberg |
Subject: |
Re: [Tinycc-devel] rc testing with netbsd-curses: build break |
Date: |
Sat, 23 Sep 2023 23:51:49 +0200 |
> >> 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:
i used "git greo -n -C 12 tcc_load_dll"
> 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).
I found the same location, but it was in the night
and i unfortunately stopped code flow analyzis
after reading "TCC_IS_NATIVE".
What about:
* leave the code, as is
* remember this corner case
* go ahead with the release
* pick it up again after the release
or
* disable recursive the loading of the libraries
* remember this corner case
* go ahead with the release
* pick it up again after the release
Since you also do not know yet, in which case the code is needed,
a real fix requires a lot of time and some new tests
I think, the call to "tcc_load_ddl" was added here:
https://repo.or.cz/tinycc.git/commit/1df662c1b094d250db0501cf31db83dc5f9060e4
I really want to have a new release now, because....
* tell eyeryone, that tcc is alive
* let compiler-explorer use a new tcc version
* let compiler-explorer use --enable-cross
* after a release, we can fix tcc to use "nolibc" without issues.
That would make tcc independant of an installed host libc
nolibc introducion:
https://lwn.net/Articles/920158/
Multi-File-Sources:
https://github.com/wtarreau/nolibc
nolibc was merged into the linux kernel.
Recent updates are here:
https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git/tree/
There was a single file version, which mentioned, that nolibc is dual licensed.
In addition to GPL 2.0, there was also permissive license given.
When i remember correctly: MIT
--
Regards ... Detlef
source tree
--
Regards ... Detlef