Questions tagged [bfd]

BFD is the GNU Binary File Descriptor library.

BFD is the GNU Binary File Descriptor library. It is a library for reading and writing object files in various formats, and is used by the GNU binutils and gdb.

31 questions
53
votes
2 answers

What's the difference between `-rpath-link` and `-L`?

The man for gold states: -L DIR, --library-path DIR Add directory to search path --rpath-link DIR Add DIR to link time shared library search path The man for bfd ld makes it sort of sound like -rpath-link is used for…
lanza
  • 1,512
  • 2
  • 13
  • 26
8
votes
1 answer

How do I merge two binary executables?

This question follows on from another question I asked before. In short, this is one of my attempts at merging two fully linked executables into a single fully linked executable. The difference is that the previous question deals with merging an…
Mike Kwan
  • 24,123
  • 12
  • 63
  • 96
6
votes
4 answers

variable name, function arguments at run time in C

Is it possible to know a function arguments and variables' name types at runtime in C program ? For example, if I have a function: int abc(int x, float y , somestruct z ){ char a; int b ; } Can I know inside this function abc(), what are…
app
  • 421
  • 1
  • 4
  • 7
4
votes
1 answer

Instruction pointer to function name, input parameters, ?

I am trying to implement backtrace like function call myself . I have been successfully able to unroll stack and i have all return address present on my stack . Now i want to get function name, variable name input to my function from this…
app
  • 421
  • 1
  • 4
  • 7
4
votes
1 answer

get callstack of c++ application including shared libraries

I wrote a small function to create a callstack in c++, using bfd to resolve the addresses. It works fine and I get detailed information (source file and line) for all functions inside the current application, but I get no information what-so-ever…
example
  • 3,349
  • 1
  • 20
  • 29
3
votes
3 answers

GNU Binutils' Binary File Descriptor library - format example

As in title. I tried reading the BFD's ELF's code, but it's rather not a light reading. I also tried to get something from the documentation, but I would need an example to see how it works. Could anyone point me some easier example for me, to know…
Griwes
  • 8,805
  • 2
  • 43
  • 70
3
votes
1 answer

Why can't I pipe assembler output to stdout?

[edit] This was just kind of a though experiment I had where I wanted to see if I could trick the kernel in to executing an elf from an unnamed pipe with process substitution with /lib64/ld-linux-x86-64.so.2, I knew it was a shot in the dark but I…
linuxgeek
  • 57
  • 8
3
votes
3 answers

Store and retrieve version information in ELF file

I'm trying to figure out a good way to store and retrieve version information in C / C++ executables and libraries on Linux. I'm using the GCC compiler for my C and C++ programs. The storage part is pretty straightforward; declaring a variable like…
millinon
  • 1,528
  • 1
  • 20
  • 31
3
votes
1 answer

Updating an object file using BFD interface

I have to add a symbol to an existing object file. I am presently trying with a elf32-i386 target. I tried opening the object file in read/write mode : abfd = bfd_fopen ("test.o", "elf32-i386", "r+", -1); I have no problem in reading the existing…
kanak
  • 533
  • 1
  • 5
  • 8
2
votes
1 answer

Why does armv7l-unknown-linux-gnueabihf-objdump give "invalid bfd target" when run?

I'm currently building Binutils 2.32 for the armv7l-unknown-linux-gnueabihf target, with this configure command: chronos@localhost ~/Downloads/tarballs/binutils-2.32 $ ./configure --prefix=/usr/local/opt/arm-cross…
S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
2
votes
1 answer

Getting stack offsets of variables from debugging symbols

When I build a program with debugging information (gcc -g), gdb is able to tell me addresses of local variables inside a function. Thus, the debugging symbols must contain enough information to calculate this (i.e. an offset from ebp), and since gdb…
0xFE
  • 344
  • 5
  • 17
2
votes
1 answer

number of sections in an object file using bfd data structure

My question is in regard to bfd's and how the number of sections work in the following code. The code and the dumps inside the gdb debugger of the bfd structure and it's section structure within it are displayed below. I also included the data…
user1943660
  • 65
  • 1
  • 6
2
votes
4 answers

gdb fails on mountain lion

I tried to compile a 7.x Version of gdb without any luck. I codesigned the executable(http://sourceware.org/gdb/wiki/BuildingOnDarwin). With following version there were these problems. 7.5,7.4,git clone: unknown load command 0x2a (and others) for…
dlangenk
  • 340
  • 2
  • 3
  • 10
1
vote
1 answer

Segmentation fault when calling std::make_unique

I seem to be getting a segmentation fault when I call std::make_unique. I'm pretty sure I know where the segmentation fault is occurring because I used gdb; however, I can't figure out how to fix it. Here is the source code with…
foobarbaz
  • 58
  • 1
  • 5
1
vote
1 answer

Recover location information from trace using bfd

I am using the dladdr from libld (http://linux.die.net/man/3/dladdr) to get a trace of the function calls. Here it is minimal example with a single traced element: #include #include // link with -ldl -rdynamic a void f(){ …
alfC
  • 14,261
  • 4
  • 67
  • 118
1
2 3