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
3
votes
2 answers

Linux readelf shows object sizes with different numeral system (Hex and Dec)

I'm investigating some objects inside ELF file and using readelf for that purpose. This sample of readelf shows the size (bytes) of the objects on column 3, On large objects, readelf prints in Hex instead of dec, This breaks my size sorting…
Amit
  • 165
  • 1
  • 9
3
votes
2 answers

How to understand the difference between Offset and VirAddr in Program Headers in elf?

There is a shared library elf file, I use readelf -l to see the program headers, the output is: Elf file type is DYN (Shared object file) Entry point 0x0 There are 11 program headers, starting at offset 52 Program Headers: Type Offset …
cong
  • 1,105
  • 1
  • 12
  • 29
3
votes
1 answer

What does numbers in parenthesis means in readelf outputs?

When using readelf on executables, I get a number in parenthesis after some symbols names. For instance: Num: Value Size Type Bind Vis Ndx Name 49: 00000000002052a0 8 OBJECT GLOBAL DEFAULT 27 stderr@GLIBC_2.2.5…
deadalnix
  • 2,255
  • 18
  • 24
3
votes
1 answer

How can I get the symbol name in struct "Elf64_Rela"

#include #include #include #include #include #include #include #include #include #include Elf64_Rela *retab; Elf64_Rela…
최동규
  • 35
  • 5
3
votes
2 answers

Best practice for C++ program with plugins in Linux

Can someone shed some light on what is the best practice for loading plugins into a C++ Linux program? Say we have a program (editor) with a plugin (libsyntax.so). The config file for editor contains the path to the libsyntax.so library…
JurekM
  • 76
  • 4
3
votes
3 answers

DWARF - How to find the prologue end/epilogue start addresses of functions in a given binary?

I have an ARM binary of which I need to find exactly at which addresses its function's prologues end and the epilogues begin. In other words, I need the boundaries of the function bodies. For instance, if I have a function whose assembly is…
Martin
  • 940
  • 6
  • 26
3
votes
2 answers

How readelf translate the entry point

I have an elf file, and when I use readelf -h filename I get the entry point. Now, lets say I want to calculate this address by myself [Using assembly, but the language isn't important]. How can I do that? I know the the entry point is 4 bytes…
Mickey
  • 480
  • 4
  • 13
3
votes
1 answer

Meanings of mips flags from readelf command?

I have executed the command "readelf -h test" ("test" is my binary program) on linux, and got following text: ELF header: Magic: 7f 45 4c 46 .... Data: 2's complement, little endian ... **Flags: 0x1007, noreorder, pic, cpic, o32,…
freddy
  • 463
  • 1
  • 8
  • 20
3
votes
1 answer

comparing object files to find the variable change

So in a 32bit environment i compile a ".c" file. A.c and get A.o I save A.o . Suppose A.c has a variable like int a // i change this to long a; After the change i compile and get another A.o. Now when i do " cmp A.o A.o " , i can…
Rags
  • 434
  • 2
  • 6
  • 20
3
votes
1 answer

readelf utility for Visual Studio C++ ABI and VS compiled objects?

I'm looking for alternatives to the readelf and objdump duo when using Visual Studio for compiling C++ source code and investigating lib, obj and dll. I'm aware that MinGW offers a porting of this tools but I'm looking for something with an official…
user1824407
  • 4,401
  • 4
  • 15
  • 20
3
votes
1 answer

Figure out pattern in order to find variables in compiled program

I need to extract the global variables from a compiled c program. What am I doing right now is using the Linux readelf command in order to get that information. In other words when I do: readelf.exe -w[i] myFile.out I do that with…
Tono Nam
  • 34,064
  • 78
  • 298
  • 470
2
votes
2 answers

Symbol table from readelf shows static variable size 0

I'm looking into the possibilities to get a list of all global and static variables that are in my application, with their name, size, and address. My toolchain (TI CCS 12.3) produces an ELF output file, so I thought I would give the readelf tool a…
2
votes
1 answer

how can I get the value of static initialised global variables from ELF file?

For example I have following c++ source file // define global variables here int Label = 1234; char Hash[] = "0x11231abc"; compile this to *.o file, and may be later linked to an executable binary. Is it possible to get the value from ELF file by…
Xiaoyong Guo
  • 361
  • 1
  • 7
2
votes
1 answer

What exactly is the size of an ELF symbol (both for 64 & 32 bit) & how do you parse it

According to oracles documentation on the ELF file format a 64 bit elf symbol is 30 bytes in size (8 + 1 + 1 + 4 + 8 + 8), However when i use readelf to print out the sections headers of an elf file, & then inspect the "EntSize" (entry size) member…
stav
  • 199
  • 4
2
votes
1 answer

"ld: warning: cannot find entry symbol _start; defaulting to 0000000000401000" with custom *.o file

I've compiled a simple object file file and tried to link with ld, but it gave that warning. However, the file has _start symbol, Here's the readelf of the object. ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: …
1 2
3
9 10