为什么共享库的ELF标头将Linux指定为OSABI? [英] Why would the ELF header of a shared library specify Linux as the OSABI?

查看:408
本文介绍了为什么共享库的ELF标头将Linux指定为OSABI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Linux系统(Fedora 9)上的所有标准共享库都将ELFOSABI_NONE(0)指定为其OSABI.

All the standard shared libraries on my Linux system (Fedora 9) specify ELFOSABI_NONE (0) as their OSABI.

这很好-但是我从供应商那里收到了一个共享库,其中ELF标头中给出的OSABI是ELFOSABI_LINUX(3).

This is fine - however I've received a shared library from a supplier where the OSABI given in the ELF header is ELFOSABI_LINUX (3).

这听起来不像是针对Linux系统的共享库的一个不合理的值,但是它与我所有其他库的值都不一样-因此,当我尝试打开时该库与我的其他库之一一起使用dlopen()导致失败,并显示错误"ELF文件OS ABI无效".

This doesn't sound like an unreasonable value for a shared library intended for a Linux system, however it is a different value to that of all my other libraries - and so when I try to open this library, with dlopen(), from one of my other libraries this fails with the error "ELF file OS ABI invalid".

我编译了FreeBSD实用程序 brandelf. c ,并使用它将OSABI类型更改为0,现在库似乎可以与其他所有内容一起正常使用.

I compiled up the FreeBSD utility brandelf.c and used it to change the OSABI type to 0 and now the library seems to play fine with everything else.

我只是想知道-为什么您认为该库被标记为ELFOSABI_LINUX?我猜想也许他们在另一个系统上交叉编译并指定了一些导致该值设置为ELF标头的gcc标志?我试图实现类似的目的,但是无法确定合适的gcc标志.

I'm just wondering - why do you think this library is marked as ELFOSABI_LINUX? I'm guessing maybe they cross compiled on another system and specified some gcc flag that caused this value to be set into the ELF header? I tried to achieve something similar but couldn't determine the appropriate gcc flag or flags.

我想知道可能的原因,因为这个特定的供应商如果没有很多手握力就不会做任何事情,我想说您可能正在做X,但这意味着我们必须在我们将其交付后修改您的库".

I'd like to know what the likely cause is as this particular supplier wont do anything without a lot of hand holding and I'd like to be able to say "you're probably doing X but this means we have to modify your libraries after we take delivery of them".

推荐答案

可能供应商正在FreeBSD上或使用最新的Fedora系统进行交叉编译,其中使用STT_GNU_IFUNC的任何内容都将被标记为ELFOSABI_LINUX.如果您尝试在Linux上使用它,就像您将其更改为ELFOSABI_NONE一样,应该没有问题.

Possibly the vendor is cross compiling on FreeBSD or using a very recent Fedora system where anything using STT_GNU_IFUNC will be marked as ELFOSABI_LINUX. If you are trying to use it on Linux there should be no problems with changing it to ELFOSABI_NONE like you have done.

这篇关于为什么共享库的ELF标头将Linux指定为OSABI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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