Newbie here, hello!
Currently I'm trying to use the libbfd to read the symbol table of
arbitrary object
files (preferable x86 and ELF). At the moment I am stuck at compiling
and linking.
I am working on an x64 Archlinux Laptop (very recently updated)
and I used the following commandline for compilation:
$ gcc -o tbfd tbfd.c /usr/lib/libiberty.a /usr/lib/libbfd.a -liberty
-lbfd -ldl
Result:x64
---------
/usr/lib/libbfd.a(compress.o): In function
`bfd_compress_section_contents':
(.text+0x2c): undefined reference to `compressBound'
/usr/lib/libbfd.a(compress.o): In function
`bfd_compress_section_contents':
(.text+0x57): undefined reference to `compress'
/usr/lib/libbfd.a(compress.o): In function
`bfd_get_full_section_contents':
(.text+0x322): undefined reference to `inflateInit_'
/usr/lib/libbfd.a(compress.o): In function
`bfd_get_full_section_contents':
(.text+0x33c): undefined reference to `inflateReset'
/usr/lib/libbfd.a(compress.o): In function
`bfd_get_full_section_contents':
(.text+0x36f): undefined reference to `inflate'
/usr/lib/libbfd.a(compress.o): In function
`bfd_get_full_section_contents':
(.text+0x37f): undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
My includes are:
4 #include <bfd.h>
5 #include <stdlib.h>
6 #include <stdio.h>
7 #include <stdint.h>
8 #include <libiberty/libiberty.h>
9 #include <dlfcn.h>
I know I am missing some library flags or include files, but I have
really no idea
andhttps://sourceware.org/binutils/docs-2.25/bfd/index.html
wasn't very helpful. Could you tell me what I am doing wrong?
Is there any additional introductory material that I could read.
Best regards
Florian
PS: Sorry for the question, but why is the libiberty no independent
shared object? I read that it has historically and propably organically
grown, but I don't see why this is the reason for libiberty not beeing a
.so for it's own...
Sorry for the bad english...