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).

418 questions
8
votes
1 answer

how to determine object code size on Linux when "size" gives the wrong answer?

I want to know precisely how much object code is generated by GCC for each of a collection of compilation units, but I'm having an odd problem where the "size" command from binutils is not giving the correct result. Let's take a C file containing…
John Regehr
  • 123
  • 1
  • 6
8
votes
2 answers

ELF Dynamic loader symbol lookup ordering

What is the search order for symbol lookup when resolving dynamic relocations? When resolving symbols for a shared library does the loader first search in the 'main executable' (to let the main executable override definitions...) or what?
JohnTortugo
  • 6,356
  • 7
  • 36
  • 69
8
votes
1 answer

Binutils stat illegal option -c

I use stat two times in my script once to find the file files permissions and once to find the size of the file. `stat -c %A "$directory/$file"` `stat -c %s "$directory/$file"` I am using OSX 10.7 and directory and file are variable of the…
Joe Tyman
  • 1,417
  • 5
  • 28
  • 57
7
votes
1 answer

Is accessing the "value" of a linker script variable undefined behavior in C?

The GNU ld (linker script) manual Section 3.5.5 Source Code Reference has some really important information on how to access linker script "variables" (which are actually just integer addresses) in C source code. I used this info. to extensively use…
Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
7
votes
2 answers

Is there a binutils for llvm?

The LLVM compiler toolchain has a gcc that is compatible with normal gcc. The advantage of using llvm-gcc is that is goes to an arbitrary target, meaning normal gcc will say no such target when you try to compile to a random architecture, say…
Leo Izen
  • 4,165
  • 7
  • 37
  • 56
7
votes
1 answer

List of targets supported by binutils

I am following a website ( http://wiki.osdev.org/GCC_Cross-Compiler ) to learn how to cross compile some code for different architectures. So, the first step is to download and compile Binutils for a specific target. The site say to assign the…
infoclogged
  • 3,641
  • 5
  • 32
  • 53
7
votes
2 answers

Glibc vs GCC vs binutils compatibility

Is there a sort of official documentation about version compatibility between binutils, glibc and GCC? I found this matrix for binutils vs GCC version compatibility. It would be good to have something like this for GCC vs glibc as well. The point…
scrutari
  • 1,378
  • 2
  • 17
  • 33
7
votes
1 answer

Why is there unused, empty space between ELF sections?

It seems that binaries created with gcc 4.9.2 on Linux (Ubuntu 15.04, 32-bit) have a couple of thousand unused bytes between sections .eh_frame and .init_array. Example output from objdump -h for a simple executable: Sections: Idx Name Size…
nwellnhof
  • 32,319
  • 7
  • 89
  • 113
7
votes
3 answers

How can my C code find the symbol corresponding to an address at run-time (in Linux)?

Given a function or variable run-time address, my code needs to find out the name and, if it's a variable, type information of the symbol. Or at least provide enough information for later, off-line extraction of the name (and type info). It is Linux…
Sorin Papuc
  • 101
  • 1
  • 6
7
votes
2 answers

Do I need "ranlib" / "ar -s" for static linking?

I did not find any proper information if and why I need ranlib / ar -s for static linking. Assume I have an application that consists of multiple modules. Each module has its code files in its own folder, and the object files are created in their…
Kijewski
  • 25,517
  • 12
  • 101
  • 143
7
votes
1 answer

Cabal install error /usr/bin/ld: --hash-size=31: unknown option

When trying to install any package on my computer using a command like cabal install http-conduit the installation aborts with the following error: /usr/bin/ld: --hash-size=31: unknown option How can I resolve this? Note: This question…
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
7
votes
2 answers

How to set 2 byte wchar_t output?

The GCC uses a 4-byte wchar_t by default. I can set the option -fshort-wchar to get 2 bytes per wchar_t in the L"string constants". But when I set the compiler option to my source file I get the famous warning message foo.o uses 2-byte wchar_t yet…
harper
  • 13,345
  • 8
  • 56
  • 105
7
votes
2 answers

Why does GNU ld resolve symbols differently when linking executables vs shared objects?

I have a trivial piece of C++ code that looks something like this: #include int main(void) { boost::timer::auto_cpu_timer t; return 0; } I tried to compile and link it (with gcc 4.8.1 and GNU ld 2.23.52.20130828) as…
user2862505
  • 241
  • 2
  • 8
6
votes
2 answers

Why does arm-none-eabi-size report the .data section to be 0 even though I am using initialized RAM?

I am a bit confused by the results I am getting when I use my toolchain's (Yagarto and codesourcery) size utility. it is reporting that I am using 0 bytes in the data section. see below $ arm-none-eabi-size.exe rest-server-example.crazy-horse.elf …
maguirre
  • 399
  • 4
  • 20
6
votes
1 answer

How to specify a value for a #define with autoconf?

I'm trying to build Gnu binutils with behaviour unlocked by defining the macro SYSV386_COMPAT 0 to vary the way in which it generates some FPU opcodes. I can easily go into the header file and set the value manually, but how would I invoke the…
Michael_73
  • 353
  • 3
  • 11