https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92374
Bug ID: 92374 Summary: Unable to link relocatable object when GCC is configured with "--disable-comdat" Product: gcc Version: 7.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: g.hoogewerf at gmail dot com Target Milestone: --- Recent versions of GCC exhibit problems building relocatable objects when GCC is configured with "--disable-comdat". The easiest way to reproduce the problem is to link libstdc++.a into a relocatable object: > ./test/arm-none-eabi/bin/arm-none-eabi-ld -r --whole-archive > ./test/arm-none-eabi/arm-none-eabi/lib/libstdc++.a -o test.o The following error occurs in that case: > `.LC2' referenced in section > `.gnu.linkonce.t._ZNSt7__cxx1117moneypunct_bynameIwLb0EEC2EPKcj' of ./test > /arm-none-eabi/arm-none-eabi/lib/libstdc++.a(cxx11-wlocale-inst.o): defined > in discarded section > `.gnu.linkonce.r._ZSt16__convert_from_vRKPiPciPKcz.str1.4' of > ./test/arm-none-eabi/arm-none-eabi/lib/libstdc++.a(cxx11-wlocale-inst.o) > [more errors to follow] GCC configuration info: > ./test/arm-none-eabi/bin/arm-none-eabi-gcc -v > Using built-in specs. > COLLECT_GCC=./test/arm-none-eabi/bin/arm-none-eabi-gcc > COLLECT_LTO_WRAPPER=/scratch/arm-none-eabi-newlib/test/arm-none-eabi\ > /libexec/gcc/arm-none-eabi/7.4.1/lto-wrapper > Target: arm-none-eabi > Configured with: /src/gcc/configure --prefix=/scratch/arm-none-eabi-newlib\ > /test/arm-none-eabi --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu \ > --target=arm-none-eabi --enable-languages=c,c++ --disable-libssp \ > --disable-multilib --disable-comdat --disable-nls --disable-fixed-point \ > --disable-decimal-float --enable-__cxa_atexit --disable-lto \ > --with-newlib --with-sysroot=/scratch/arm-none-eabi-newlib/test\ > /arm-none-eabi/arm-none-eabi/libc > Thread model: single > gcc version 7.4.1 20191105 (GCC) This issue is reproducible on gcc-7-branch and gcc-8-branch. Trunk and the gcc-9-branch seem to be unaffected.