Questions tagged [readelf]

readelf displays information about ELF object files

readelf displays information about Executable and Linkable Format object files. It performs a similar function to objdump but it goes into more detail and it exists independently of the BFD library, so if there is a bug in BFD then readelf will not be affected.

On Linux, two widely available implementations exist:

138 questions
1
vote
1 answer

Location of Relocation table in ELF file

I don't find any information about where is located the relocation table in ELF file. My project is to display information about a ELF file like readelf. I did the display of the Header, Section Header and Symbol table but I don't know where to find…
Léandre
  • 125
  • 2
  • 13
1
vote
1 answer

How to extract symbol name from ELF file for a given offset

I have a hex offset, say 0xcccddd. Using gdb info symbol 0xcccddd I can get the symbol name, e.g. fn() in section_name. How can I do this using the readelf or objdump command, or any other commands without running gdb? EDIT: After using the below…
user00011
  • 103
  • 1
  • 15
1
vote
1 answer

How linker adds Program Headers to the Relocatable file?

So we know that linker (in my case ld ) adds the Program Headers to the Relocatable file while creating the actual Executable. Then these Headers are used to load the program into memory at run-time. First of all how ld calculates and adds these…
Kobayashi
  • 2,402
  • 3
  • 16
  • 25
1
vote
2 answers

How are function sizes calculated by readelf

I am trying to understand how readelf utility calculates function size. I wrote a simple program #include int main() { printf("Test!\n"); } Now to check function size I used this (is this OK ? ): readelf -sw a.out|sort -n -k 3,3|grep…
Zoso
  • 3,273
  • 1
  • 16
  • 27
1
vote
1 answer

ELF. Hide exported symbol for already linked DSO

I have an already compiled / linked DSO file, that exports few functions that indeed must be hidden. When I try to link my code against that library - it picks up those unneeded symbols instead of my own ones. I have no access to the source code, so…
Sergio
  • 8,099
  • 2
  • 26
  • 52
1
vote
1 answer

What's the difference between .data, .symtab in an ELF file?

My understanding is that .data stores the initialized global variables of the program. But isn't that what .symtab stores as well?
Lenny
  • 388
  • 3
  • 15
1
vote
3 answers

gcc to tell a register compiled from which variable

I need to know from which variable is a register of a binary instruction in the obj file is compiled from. In short: the mapping from the register to variable for each instruction Example: suppose objdump gives a snippet of obj file as: MOV R1 5 …
lukmac
  • 4,617
  • 8
  • 33
  • 34
1
vote
1 answer

How to find the number of entries in the .dynamic section of an ELF file?

Can there be a method determining the number of entries in the .dynamic section of an ELF file without using the readelf utility? I am trying to output data from the .dynamic section using the gelf_getdyn() function, but cannot figure out a way of…
nice_remark
  • 325
  • 3
  • 12
1
vote
1 answer

readelf displays two version numbers

I have attempted to run readelf with the option of -h and it displays two fields called Version both having the number 1 in them. It says Version 1(current) in one of the fields and Version 0x1 in the other. What is the significance of these two…
Har
  • 3,727
  • 10
  • 41
  • 75
1
vote
0 answers

How to check if the library is compiled with c++11 or c++14?

I am building multiple dynamic libraries for a project. I want to build the entire project with c++11. While building the libraries I explicitly specify the CXX and C Flags. I am using CMAKE 3.5 to build the libraries. I specify the c++11 or gnu11…
1
vote
1 answer

Why ELF file contains symtab sections with size=0?

I was trying to understand the symbol table inside ELF, so I had: $ cat a.c int i=0; int j; static int l=4; void k(); void d(){ k(); } Compile and check its symtab inside the ELF: $ gcc -g a.c -c -m32 && readelf -s a.o Symbol…
Troskyvs
  • 7,537
  • 7
  • 47
  • 115
1
vote
1 answer

How to find a type of a global variable in an ELF file?

Since it's my first entry on SO: hello to everyone :) Now to the good part... I'm struggling to find out a type of a global variable from an ELF file. My source code before compiling looks like this: #include "stdint.h" uint8_t…
tomly
  • 11
  • 3
1
vote
1 answer

How can I read the dynamic section of an ELF file in python

I want to get information about the dynamic section of an ELF file. Basically the same information I get using the command line: readelf -d elfFile
Maximilian
  • 1,325
  • 2
  • 14
  • 35
1
vote
0 answers

How do absolute paths get into the `NEEDED` portion of the dynamic section of an executable?

I have a number of executables which link against a single lib path. For instance, the executable foo links against (say) libboost_system.so and libfoo.so, the latter of which I build myself. I place third party libraries in a variable LDLIBS, and…
user14717
  • 4,757
  • 2
  • 44
  • 68
1
vote
1 answer

Understanding why gcc/ld are linking a symbol from a particular library using readelf

I'm including several libraries with gcc (-llapacke -llapack -lcblas) and I'm receiving "undefined reference" errors unless I explicitly link to the static version of one them (lapacke). I'm trying to understand why by searching the various variants…
Emre
  • 5,976
  • 7
  • 29
  • 42