Questions tagged [binutils]

The GNU binary utilities. A collection of tools for operating on object files. Most notably they include the GNU assembler and linker. They are typically used in conjunction with the GNU compiler collection (GCC).

380 questions
60
votes
8 answers

How to list library dependencies of a non-native binary?

When developing for native platform, I can use ldd to list all the shared libraries (.so files) a binary executable I build will try to load upon start-up. But when cross-compiling, I don't know how to get the same information. The ldd is not a…
lvella
  • 10,929
  • 10
  • 42
  • 91
52
votes
2 answers

How clear gdb command screen?

Is it possible to clear the command window of gdb? I mean, is there a command in gdb that do the same (for the command windows) as the clear command in a bash terminal?
JohnTortugo
  • 5,435
  • 7
  • 33
  • 63
30
votes
4 answers

How to extract only the raw contents of an ELF section?

I've tried the following, but the resulting file is still an ELF and not purely the section content. $ objcopy --only-section= I just want the contents of the section. Is there any utility that can do this? Any ideas?
mepcotterell
  • 2,510
  • 2
  • 20
  • 27
26
votes
7 answers

How can adding a function call cause other symbols to become undefined when linking?

I'm hoping someone will be able to help troubleshoot what I think is a linker script issue. I'm encountering a strange problem after adding a call to a new function. Without the function call, my object files link correctly, however, with the new…
owst
  • 493
  • 4
  • 14
26
votes
3 answers

Recipe for compiling binutils & gcc together?

According the the gcc build instructions you can build binutils concurrently with building gcc (as well as gmp,mpc,etc). Here's what that page says : If you also intend to build binutils (either to upgrade an existing installation or for use…
bdbaddog
  • 3,003
  • 2
  • 20
  • 30
25
votes
3 answers

An objcopy equivalent for Mac / iPhone?

I would like to rename symbols inside object files (.o) with something that would be the Mac equivalent of binutils' objcopy --redefine-syms tool. I found no arm-apple-darwin10-objcopy. I tried the MacPorts' arm-elf-binutils port and also tried to…
Gregory Pakosz
  • 65,227
  • 16
  • 134
  • 162
25
votes
1 answer

What is the "__gmon_start__" symbol?

I'm compiling this code with gcc hello.c -o hello -O3: #include int main(void) { printf("Hello world\n"); return 0; } and when I list the relocations I get: test@southpark$ readelf -r hello | grep gmon 080495a4 00000106…
JohnTortugo
  • 5,435
  • 7
  • 33
  • 63
23
votes
2 answers

How to interpret the output of the ldd program?

[root@wdctc1281 bin]# ldd node linux-vdso.so.1 => (0x00007fffd33f2000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f70f7855000) librt.so.1 => /lib64/librt.so.1 (0x00007f70f764d000) libstdc++.so.6 =>…
liam xu
  • 2,582
  • 7
  • 31
  • 52
23
votes
1 answer

How to reverse the objcopy's strip with only-keep-debug?

In modern linux almost all objects are stripped and splitted in two parts (two files). First is executable itself and second is debug symbols, stripped out from original ELF. Such files are created with objcopy --only-keep-debug original.elf…
osgx
  • 80,853
  • 42
  • 303
  • 470
23
votes
3 answers

Wrong line numbers from addr2line

I try to find the exact line of a call in the backtrace in C++ program. Right now I am using these lines (from the man page of backtrace) to get the trace: void *bt_buffer[1000]; char **bt_strings; int bt_nptrs = backtrace(bt_buffer, 1000); …
steffen
  • 7,380
  • 8
  • 40
  • 78
20
votes
1 answer

Does the order of -l and -L options in the GNU linker matter?

The -l option tells the linker to search the libraries in the standard dirs. And with -L, we can specify our own library directories for searching. Question: Does the sequence of order matters for the -L option too, like it does for the -l w.r.t the…
Aquarius_Girl
  • 18,558
  • 57
  • 191
  • 353
20
votes
5 answers

Is there an option to GNU ld to omit -dynamic-linker (PT_INTERP) completely?

I'm experimenting with the concept of pure-static-linked PIE executables on Linux, but running into the problem that the GNU binutils linker insists on adding a PT_INTERP header to the output binary when -pie is used, even when also given -static.…
R.. GitHub STOP HELPING ICE
  • 195,354
  • 31
  • 331
  • 669
19
votes
2 answers

When to use --dynamic option in nm

Sometimes when I do nm on a .so file (for example, libstdc++.so.6), it says no symbols, and I need to use nm --dynamic. But for some other .so files, I can see the symbols without --dynamic. The doc says: Display the dynamic symbols rather than…
szli
  • 28,045
  • 8
  • 26
  • 37
17
votes
3 answers

How does gcc find as, ld and other binutils executables?

Is their location hardcoded into gcc code or does gcc just call as and we must have as location in our PATH variable? And in the latter case, how could we create two completely separate gcc toolchains? I mean, how can we make gcc-A invoke as-A and…
Michalis Vichos
  • 275
  • 2
  • 11
16
votes
3 answers

How to see what version of Binutils is on Ubuntu?

I have searched, but not found an option that tells me what version of binutils I have on My Ubuntu. Or at least I don't know how to interpret it. gcc -v - tells nothing about binutils ld -v - tells me GNU ld (GNU Binutils for Ubuntu) 2.24. Does…
thedarkside ofthemoon
  • 2,041
  • 4
  • 26
  • 44
1
2 3
25 26