Hi. I found another bug. (And this one's more annoying. :D)
I'm experiencing some dynamic-linker problems when running my project's executables on x86_64
(but not 32-bit x86) if those executables were built with tcc.
Essentially, I'm getting runtime, dynamic linker errors such as:
Symbol `__dso_handle' causes overflow in R_X86_64_PC32 relocation
Symbol `fstatat' causes overflow in R_X86_64_PC32 relocation
Symbol `fstat' causes overflow in R_X86_64_PC32 relocation
Symbol `mknod' causes overflow in R_X86_64_PC32 relocation
Symbol `pthread_atfork' causes overflow in R_X86_64_PC32 relocation
I tried to make an MCVE (minimal, complete, verifiable example) and this one should do it:
#!/bin/sh -eu
cat > liblib.c <<EOF
#include <pthread.h>
void prepare(){} void parent(){} void child(){}
void f() { pthread_atfork(prepare,parent,child); }
EOF
cat > main.c <<EOF
void f();
int main()
{
f();
return 0;
}
EOF
: ${CC:=tcc}
$CC liblib.c -fPIC -c
$CC -o liblib.so liblib.o -shared -lpthread
$CC main.c $PWD/liblib.so
LD_LIBRARY_PATH=$PWD ./a.out
On my x86_64 Linux Mint/Ubuntu, the above is giving me
./a.out: Symbol `__dso_handle' causes overflow in R_X86_64_PC32 relocation
./a.out: Symbol `__dso_handle' causes overflow in R_X86_64_PC32 relocation
Segmentation fault (core dumped)
I'm not getting any of the "Symbol `*` causes overflow in R_X86_64_PC32 relocation" messages on my 32-bit
Linux netbook, but the above example still segfaults there when built with tcc (but not with gcc or clang).
Again, I'm posting it here in case anybody knows how to fix it.
If this is a bad place to post such bug reports, please let me know.
Best regards,
Petr Skocik