Compile libstdc++ with hash style SYSV

≡放荡痞女 提交于 2019-12-19 08:13:53

问题


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!


回答1:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!