I get these weird errors when I try to compile tcc in musl environment. musl+tcc also had stdarg.h -issue because musl expects __builtin_va_start & pals.
The environment was minimal and I issued the commands to compile musl by hand. /tcc-nonmod # tcc -o tcc tcc.c -lm -ldl libtcc.c tccpp.c tccgen.c tccelf.c tccasm.c tccrun.c x86_64-gen.c i386-asm.c -DCONFIG_TCC _ELFINTERP="\"/lib/ld-musl-x86_64.so.1\"" -DTCC_TARGET_X86_64 When I run my new binary, musl answers with this: Error relocating ./tcc: cstr_buf: symbol not found Error relocating ./tcc: macro_ptr_allocated: symbol not found Error relocating ./tcc: unget_buffer_enabled: symbol not found Error relocating ./tcc: unget_saved_macro_ptr: symbol not found Error relocating ./tcc: in_sizeof: symbol not found Error relocating ./tcc: new_undef_sym: symbol not found Error relocating ./tcc: func_sub_sp_offset: symbol not found Error relocating ./tcc: func_ret_sub: symbol not found cheery@ruttunen:~/musl-tcc/sysroot/tcc-nonmod$ nm -D tcc | grep -E " d | b " 0000000008099460 b cstr_buf 000000000809c5e8 b func_ret_sub 000000000809c5e0 b func_sub_sp_offset 0000000008086a34 d in_sizeof 0000000008088b30 b macro_ptr_allocated 0000000008086f9c d new_undef_sym 0000000008088b54 b unget_buffer_enabled 0000000008088b38 b unget_saved_macro_ptr cheery@ruttunen:~/musl-tcc/sysroot/tcc-nonmod$ readelf --dyn-syms ./tcc | grep -E "cstr_buf|macro_ptr_allocated|unget_buffer_enabled|unget_saved_macro_ptr|in_sizeof|new_undef_sym|func_sub_sp_offset|func_ret_sub" 101: 0000000008099460 32 OBJECT LOCAL DEFAULT 3 cstr_buf 105: 0000000008088b30 8 OBJECT LOCAL DEFAULT 3 macro_ptr_allocated 106: 0000000008088b54 4 OBJECT LOCAL DEFAULT 3 unget_buffer_enabled 107: 0000000008088b38 8 OBJECT LOCAL DEFAULT 3 unget_saved_macro_pt 113: 0000000008086a34 4 OBJECT LOCAL DEFAULT 2 in_sizeof 123: 0000000008086f9c 4 OBJECT LOCAL DEFAULT 2 new_undef_sym 128: 000000000809c5e0 8 OBJECT LOCAL DEFAULT 3 func_sub_sp_offset 129: 000000000809c5e8 4 OBJECT LOCAL DEFAULT 3 func_ret_sub Friend at #musl told me these records shouldn't end up into dynsym table. But they should neither appear in the: cheery@ruttunen:~/musl-tcc/sysroot/tcc-nonmod$ readelf -r tccpp.o | grep -E "cstr_buf|macro_ptr_allocated|unget_buffer_enabled|unget_saved_macro_ptr|in_sizeof|new_undef_sym|func_sub_sp_offset|func_ret_sub" 0000000007a8 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 0000000007c3 001300000009 R_X86_64_GOTPCREL 0000000000010998 cstr_buf - 4 0000000007d9 001300000009 R_X86_64_GOTPCREL 0000000000010998 cstr_buf - 4 0000000008c3 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 0000000008f0 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000915 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000931 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 00000000094d 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 0000000009d9 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 0000000009f7 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000a29 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000a61 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000adb 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000b58 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000b76 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000b92 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000000de1 001300000002 R_X86_64_PC32 0000000000010998 cstr_buf + 0 000000006e89 000300000009 R_X86_64_GOTPCREL 0000000000000068 macro_ptr_allocated - 4 000000006eae 000600000002 R_X86_64_PC32 000000000000008c unget_buffer_enabled + 0 000000006ebd 000400000002 R_X86_64_PC32 0000000000000070 unget_saved_macro_ptr + 0 000000006ed3 000600000009 R_X86_64_GOTPCREL 000000000000008c unget_buffer_enabled - 4 000000006ee2 000300000002 R_X86_64_PC32 0000000000000068 macro_ptr_allocated + 0 000000006f00 000300000009 R_X86_64_GOTPCREL 0000000000000068 macro_ptr_allocated - 4 000000006fa1 000600000002 R_X86_64_PC32 000000000000008c unget_buffer_enabled + 0 000000006fbf 000400000009 R_X86_64_GOTPCREL 0000000000000070 unget_saved_macro_ptr - 4 000000006fce 000600000009 R_X86_64_GOTPCREL 000000000000008c unget_buffer_enabled - 4 So perhaps the code generator has a bug? I bet you knew this already. -- Henri Tuhola _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
