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
6
votes
2 answers
Why does the -r option (relocatable) make ld not find any libraries?
Running Debian/Linux x86_64 with GNU ld 2.21.
Quite simply, if I link with
ld -o main main.o /usr/lib/crti.o /usr/lib/crt1.o /usr/lib/crtn.o -lc -lm
It works, but when I link with
ld -r -o main1.o main.o /usr/lib/crti.o /usr/lib/crt1.o…

Jeremy Salwen
- 8,061
- 5
- 50
- 73
6
votes
2 answers
What does SEGMENT_START("text-segment", 0x400000) represent?
I'm learning about the layout of executable binaries. My end goal is to analyze a specific executable for things that could be refactored (in its source) to reduce the compiled output size.
I've been using…

StoneThrow
- 5,314
- 4
- 44
- 86
6
votes
0 answers
Symbol versioning on Alpine Linux
The musl C library has only an approximative implementation of symbol versioning. This can result in symbols being bound together that have different symbol versions, something which would not happen in a full implementation. Projects which expect…

Florian Weimer
- 32,022
- 3
- 48
- 92
6
votes
0 answers
Linking 32- and 64-bit code together into a single binary
In a comment to this question,
Unexpected behaviour in simple pointer arithmetics in kernel space C code,
Michael Petch wrote, "The 64-bit ELF format supports 32-bit code sections."
I have a working program that includes both 32- and 64-bit code and…

prl
- 11,716
- 2
- 13
- 31
6
votes
3 answers
Generating link-time error for deprecated functions
Is there a way with gcc and GNU binutils to mark some functions such that they will generate an error at link-time if used? My situation is that I have some library functions which I am not removing for the sake of compatibility with existing…

R.. GitHub STOP HELPING ICE
- 208,859
- 35
- 376
- 711
6
votes
2 answers
How to see the GNU debuglink value of an ELF file?
So I can add a link to a debug symbol file like this objcopy --add-gnu-debuglink=$name.dbg $name, but how can I later retrieve that value again?
I checked with readelf -a and grepped for \.dbg without any luck. Similarly I checked the with objdump…

0xC0000022L
- 20,597
- 9
- 86
- 152
6
votes
1 answer
What configure options were used when building binutils?
I have a version of binutils that was compiled by someone. I need recompile a new binutils with same options.
I know that gcc -v prints out the configuration options. So maybe there is any way to read build options for binutils?

Valeriy Solovyov
- 5,384
- 3
- 27
- 45
6
votes
1 answer
Different symbols from glibc/pthreads used when using gold vs ld linker
I have a simple test program calling pthread_cond_broadcast.
When linked with the ld linker, this shows:
Case 1:
$ nm ld-test | grep cond_broadcast
U pthread_cond_broadcast@@GLIBC_2.3.2
When linked with the gold linker it shows:
Case 2:
$ nm…

binary01
- 1,728
- 2
- 13
- 27
6
votes
1 answer
objdump not working on ELF 64-bit x86-64,
I have a 64bits ELF object code from the Tiny C compiler. I can't get gobjdump to show the disassembled code. I'm using OS X 10.10.5.
$ file hello.o
hello.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
$ gobjdump -d…

Nawal
- 271
- 4
- 10
6
votes
0 answers
binutils and gcc with LTO
I have binutils-2.25.1 installed to /usr/local/binutils-2.25.1, configured with
../configure --prefix=/usr/local/binutils-2.25.1 --enable-plugins --enable-gold --disable-werror
And I want to build RPM package - gcc with LTO support that uses linker…

artshmelev
- 61
- 1
- 5
6
votes
1 answer
Various representations of -Bstatic flags in ld
In manpage of ld (from binutils), there is this section about variations of -Bstatic flag:
-Bstatic
-dn
-non_shared
-static
Do not link against shared libraries. This is only meaningful on platforms for which shared libraries are…

Abel Cheung
- 417
- 5
- 12
6
votes
1 answer
How to hook ALL linux system calls during a binary execution
I am trying to modify linux system call's default behavior. At the moment I am trying to hook and add a simple print statement before they are actually getting invoked. I know about the standard 'wrap' option of GCC linker and how it can be used to…

Sandhya Kumar
- 293
- 3
- 11
6
votes
2 answers
Dynamic loading of shared objects using dlopen()
I'm working on a plain X11 app.
By default, my app only requires libX11.so and the standard gcc C and math libs.
The App can extend features with Xfixes, Xrender and ALSA sound system.
However, these (Xfixes, Xrender and ALSA) feature are…

Andy
- 63
- 1
- 3
6
votes
2 answers
How to find global static initializations
I just read this excellent article: http://neugierig.org/software/chromium/notes/2011/08/static-initializers.html
and then I tried: https://gcc.gnu.org/onlinedocs/gccint/Initialization.html
What it says about finding initializers does not work for…

milianw
- 5,164
- 2
- 37
- 41
6
votes
0 answers
Copying an ELF section between object files with binutils
Due to a bug in ld I need to copy an ELF section from one object file to another. I can dump the desired section to a file but the problem is that objcopy's --add-section option expects a binary file and the section type information is therefore…

Per Knytt
- 1,931
- 1
- 11
- 14