TCC fails to bootstrap on recent version on Linux for failing to
support 'i' relocations (see below)
A similar problem arises when trying to use TCC to 'finalize'
Eiffel projects (that use a C generating backend)
The bootstrapping issue on x86_64 Linux is due to a GNU extension, the missing linker symbols:
tcc -o tcc tcc.c -DTCC_TARGET_X86_64 -O2 -g -Wall -Wno-pointer-sign -lm -ldl
tcc: undefined symbol 'strlen'
tcc: undefined symbol 'strchr'
tcc: undefined symbol 'strrchr'
tcc: undefined symbol 'strcpy'
tcc: undefined symbol 'strcmp'
tcc: undefined symbol 'memcmp'
tcc: undefined symbol 'strncmp'
are 'i' not 'T' symbols in libc.a:
<man nm>
"i" For PE format files this indicates that the symbol is in
a section specific to the implementation of DLLs. For ELF
format files this indicates that the symbol is an indirect
function. This is a GNU extension to the standard set of
ELF symbol types. It indicates a symbol which if
referenced by a relocation does not evaluate to its
address, but instead must be invoked at runtime. The
runtime execution will then return the value to be used
in the relocation.
"T"
"t" The symbol is in the text (code) section.
nm -A --defined-only /usr/lib/libc.a | grep strcpy
/usr/lib/libc.a:strcpy.o:0000000000000030 T __GI_strcpy
/usr/lib/libc.a:strcpy.o:0000000000000030 t __strcpy_sse2
/usr/lib/libc.a:strcpy.o:0000000000000000 t __strcpy_ssse3
/usr/lib/libc.a:strcpy.o:0000000000000000 i strcpy
<--- 'i' not 'T', hence not picked up by TCC
/usr/lib/libc.a:string-inlines.o:00000000000000c0 T __strcpy_small
/usr/lib/libc.a:strcpy_chk.o:0000000000000000 T __strcpy_chk
Fixing this will entail an upgrade of the TCC linker (and possibly a TCC runtime upgrade as well)
|