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
19
votes
1 answer
What is the difference between ar/nm and gcc-ar/gcc-nm?
ar, nm, and ranlib are provided by the binutils package. gcc-ar, gcc-nm, and gcc-ranlib are provided by the GCC package. I read somewhere that the gcc-ar, gcc-nm, and gcc-ranlib are "effectively wrappers" around the ar, nm, and ranlib binaries…

Cherry Vanc
- 781
- 1
- 4
- 19
18
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
- 285
- 2
- 11
17
votes
1 answer
How to use/install GNU binutils (objdump)
I need to use the objdump and readelf commands in my application that runs on windows. I know I can install cygwin in order to use them. The reason why I don't want to use cygwin is because I want to make it essay to deploy. Plus I don't know how to…

Tono Nam
- 34,064
- 78
- 298
- 470
16
votes
1 answer
Requirements to use flto
If I want to compile my project with -flto is it enough to have built gcc with --enable-gold or do I also need to build gold and replace ld with it? And do I need any other flags? Ie I'm doing this
gcc -flto one.c two.c

chew socks
- 1,406
- 2
- 17
- 37
15
votes
1 answer
Injecting sections into GNU ld script; script compatibility between versions of binutils.
I'm building something like in the question How to collect data from different .a files into one array? How to keep sections in .a files with ld script?, i.e. arrays composed during link-time out of elements from different object files.
In my case,…

epij
- 568
- 3
- 14
15
votes
2 answers
unable to compile: unrecognized relocation 0x2a in section text
I have received an error message when compiled "make"
$ make
g++ -fopenmp -o lang.test main.o -I../../../include/Lheader -I../../../include -L../../../lib/ -llmi -lblas -lboost_regex -lpthread -lleveldb
/usr/bin/ld:…

Gi Yeon Shin
- 357
- 2
- 7
- 19
15
votes
2 answers
How to deal with recursive dependencies between static libraries using the binutils linker?
I'm porting an existing system from Windows to Linux. The build is structured with multiple static libraries. I ran into a linking error where a symbol (defined in libA) could not be found in an object from libB. The linker line looked like
g++…

Jack Lloyd
- 8,215
- 2
- 37
- 47
15
votes
1 answer
binutils/bfd.h wants config.h now?
I'm trying to use the BFD library, and so I've installed package binutils-dev and have included:
#include
and am calling bfd_openr and bfd_close and so on from my code.
Recently I have upgraded packages and now I get an error from…

Andrew Tomazos
- 66,139
- 40
- 186
- 319
14
votes
1 answer
Why do STM32 gcc linker scripts automatically discard all input sections from these standard libraries: libc.a, libm.a, libgcc.a?
From the bottom of any auto-generated STM32CubeMx-generated linker script:
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
From the GNU Binutils ld (linker script) manual, 3.6.7…

Gabriel Staples
- 36,492
- 15
- 194
- 265
13
votes
2 answers
Difference between nm and objdump
Looking at the manuals, objdump and nm have overlapping features.
When would you use each one? What was the original purpose of each command?

Natan Yellin
- 6,063
- 5
- 38
- 57
13
votes
2 answers
Building a two-part firmware image using GCC toolchain
I have some firmware built with GCC that runs on an ARM Cortex M0 based microcontroller. The build currently generates a single binary image that can be written into the program memory of the microcontroller.
For reasons to do with field update, I…

Martin L
- 1,016
- 9
- 12
13
votes
2 answers
How to determine which command line options gcc passes to ld by default?
Consider the hello world C program:
hello.c:
#include "stdio.h"
int main()
{
printf("Hello, World!\n");
}
If I call:
$ gcc -c hello.c -o hello.o
It will produce an ELF Relocatable File hello.o
If I then call:
$ gcc hello.o -o hello …

Andrew Tomazos
- 66,139
- 40
- 186
- 319
12
votes
1 answer
Is the ELF .notes section really needed?
On Linux, I'm trying to strip a statically linked ELF file to the bare essentials. When I run:
strip --strip-unneeded foo
or
strip --strip-all foo
The resulting file still has a fat .notes section that appears to be full of funky strings.
Is the…

srking
- 4,512
- 1
- 30
- 46
12
votes
3 answers
How to get instruction information from libopcodes?
I am writing a tool which uses libbfd and libopcodes in x86-32 and x86-64 Linux to perform disassembly. The problem is that whilst I am able to get libopcodes to disassemble, I am unable to get any instruction information. For the purposes of…

Mike Kwan
- 24,123
- 12
- 63
- 96
12
votes
1 answer
Why were GNU binutils and GDB merged as one package?
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git
See, especially, the tags section.
What was the rationale behind this decision? Does the merge affect the suggested way to build latest binutils and GDB? (In fact when I checked out…

nodakai
- 7,773
- 3
- 30
- 60