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).
Questions tagged [binutils]
418 questions
64
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
- 12,754
- 11
- 54
- 106
62
votes
3 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
- 6,356
- 7
- 36
- 69
42
votes
5 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,670
- 2
- 21
- 28
29
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,892
- 10
- 42
- 65
28
votes
2 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,357
- 2
- 22
- 33
28
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
- 6,356
- 7
- 36
- 69
26
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
- 69,011
- 20
- 139
- 164
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
- 518
- 4
- 14
24
votes
2 answers
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
- 90,338
- 53
- 357
- 513
24
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
- 8,572
- 11
- 52
- 90
23
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
- 36,893
- 11
- 32
- 40
21
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
- 21,790
- 65
- 230
- 411
20
votes
4 answers
How to link a gas assembly program that uses the C standard library with ld without using gcc?
As an exercise to learn more precisely how c programs work and what minimum level of content must exist for a program to be able to use libc, I've taken it upon myself to attempt to program primarily in x86 assembly using gas and ld.
As a fun little…

Cyro
- 203
- 1
- 2
- 4
20
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,251
- 6
- 31
- 48
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
- 208,859
- 35
- 376
- 711