Is there any way to compile GCC's libstdc++ with hash style SYSV instead of GNU/Linux? I have a toolchain (via crosstool-ng) that I use to compile our company library to work with a very wide range of Linux systems.
One of these system is a very old RedHat that have only SYSV hash style, when I compile a C only library/program with the toolchain, it works great since the generated binary uses SYSV.
But, when I link with libstdc++, the binary automatically changes to GNU/Linux style, the reason is because libstdc++ was built as GNU/Linux, hence the question.
Running the binary in this system gives me the error
ELF file OS ABI invalid
Just for completeness, I have already tried -Wl,--hash-style=sysv, without success.
Also, I have another toolchain for ARM system which have the same version of GCC, GLIBC, etc, but in this toolchain libstdc++ uses SYSV, dunno why.
Thanks in advance!
Try to rebuild your GCC with --disable-gnu-unique-object configure option. According to documentation on GCC configure options:
--enable-gnu-unique-object
--disable-gnu-unique-object
Tells GCC to use the gnu_unique_object relocation for C++ template static data members and inline function local statics. Enabled by default for a toolchain with an assembler that accepts it and GLIBC 2.11 or above, otherwise disabled.
Using gnu_unique_object may lead to GNU ABI in your final executable, which is not supported in old Red Hat.
来源:https://stackoverflow.com/questions/39132507/compile-libstdc-with-hash-style-sysv