使用散列样式SYSV编译libstdc ++ [英] Compile libstdc++ with hash style SYSV

查看:397
本文介绍了使用散列样式SYSV编译libstdc ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法可以编译GCC的libstdc ++而不是GNU / Linux的哈希样式SYSV?我有一个工具链(通过crosstool-ng),用于编译我们的公司库,以处理各种Linux系统。



其中一个系统是非常旧的RedHat只有SYSV哈希样式,当我使用工具链编译C语言库/程序时,它很好用,因为生成的二进制文件使用SYSV。



但是,当我与libstdc ++链接时,二进制文件会自动更改为GNU / Linux风格,原因是因为libstdc ++是作为GNU / Linux构建的,因此存在这个问题。



运行二进制在这个系统给我的错误

  ELF文件操作系统ABI无效


b
$ b <另外,我还有另外一个ARM系统的工具链,它具有与GCC,GLIBC等版本相同的版本,但是在这个工具链中libstdc ++使用SYSV,不知道为什么。

提前!

解决方案

尝试使用 --disable-gnu-unique-对象 配置选项。根据GCC配置选项的文档:

lockquote

- enable-gnu-unique-object



- disable-gnu-unique-object

告诉GCC使用gnu_unique_object重新定位C ++模板静态数据成员和内联函数本地静态。默认情况下,对于具有接受GLIBC 2.11或更高版本的汇编程序的工具链启用,否则禁用。


使用gnu_unique_object可能会导致最终可执行文件中的GNU ABI,这在旧版Red Hat中不受支持。 $ b

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.

这篇关于使用散列样式SYSV编译libstdc ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆