Hi, I recently imported the count-one-bits module in GDB. I just noticed this while trying to build gdb with clang++-9:
arch/arm-get-next-pcs.o:arm-get-next-pcs.c:function thumb_get_next_pcs_raw(arm_get_next_pcs*): error: undefined reference to 'count_one_bits(unsigned int)' Everything works fine when building with gcc-9. This is in the gcc build: $ readelf --syms gnulib/import/count-one-bits.o | grep count_one_bits 164: 0000000000000000 24 FUNC GLOBAL DEFAULT 50 count_one_bits $ readelf --syms gdb/arch/arm-get-next-pcs.o | grep count_one_bits 770: 0000000000000000 24 FUNC WEAK DEFAULT 281 _Z14count_one_bitsj This is in the clang build: $ readelf --syms gnulib/import/count-one-bits.o | grep count_one_bits 6: 0000000000000000 64 FUNC GLOBAL DEFAULT 2 count_one_bits $ readelf --syms gdb/arch/arm-get-next-pcs.o | grep count_one_bits 109: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _Z14count_one_bitsj The disagreement between the symbol names between count-one-bits.o and arm-get-next-pcs.o seems to show that there is a missing `extern "C"` in the count-one-bits.h header? And apparently, gcc decided to compile the definition in the header and include it in arm-get-next-pcs.o, while clang did not. Is that the compiler's choice, or is it because the macros and preprocessor conditionals in count-one-bits.h evaluated to something different for the two compilers? Simon