This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Issue with BFD and foreign ELF files
- From: Alan Modra <amodra at gmail dot com>
- To: Alexandro Sanchez Bach <alexaltea123 at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Sun, 14 May 2017 23:05:36 +0930
- Subject: Re: Issue with BFD and foreign ELF files
- Authentication-results: sourceware.org; auth=none
- References: <00e501d2cbd2$4cdc6a90$e6953fb0$@gmail.com>
On Sat, May 13, 2017 at 12:18:42PM +0200, Alexandro Sanchez Bach wrote:
> After opening ARM/MIPS/PPC ELF files (see attachments) via open_bfd(...),
> whenever I query bfd_get_arch_info(...) I get bfd_arch_unknown (0) in the
> arch and mach fields. Only x86/amd64 works as expected.
>
> libbfd is a dependency (-lbfd) for my project. I installed it via `apt-get
> install libbfd-dev` on Ubuntu 16.04, and noticed that there are multiple
> "flavors" of BFD at /usr/lib/x86_64-linux-gnu/libbfd-2.26* (*.so, *-arm.so,
> *-mips.so, *-system.so, etc.). Is there any way to dynamically load a
> version that works with any architecture?
> I would be really happy if someone could point me in the right direction.
The binutils project makes no promise regarding the libbfd ABI. As
you're finding, targets supported by libbfd are configurable. These
two facts mean that you cannot really use a libbfd.so compiled by
someone else. So, compile your own from source.
How you go about that depends on how often you think you'll need to
update libbfd, and how easy you want to make building libbfd for your
users.
--
Alan Modra
Australia Development Lab, IBM