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
56
votes
1 answer

readelf vs. objdump: why are both needed

I need to learn about the ELF file layout for a project I am working on and I noticed the existence of these tools. Why do all Linux distributions include both readelf and objdump? Do these tools complement one another? When would i prefer to use…
zr.
  • 7,528
  • 11
  • 50
  • 84
36
votes
1 answer

nm vs "readelf -s"

Suppose we have a shared library named libtest.so, there is one function "foo" in it use the strip to discards all symbols from libtest.so $strip libtest.so so ,now if we use: $nm libtest.so it will print out: nm: libtest.so: no symbols but if we…
camino
  • 10,085
  • 20
  • 64
  • 115
29
votes
1 answer

readelf -s does not output full variable names

I need to get the global symbols from a compiled c program file. What I use is the linux command readelf -s filePath when I use that command this is what I get: I draw a blue rectangle to show that variable names do not get displayed correctly.…
Tono Nam
  • 34,064
  • 78
  • 298
  • 470
23
votes
4 answers

ldd equivalent on android

I have a libTest.so that does not load on some devices. logcat is absolutely useless. Using arm-linux-androideabi-readelf.exe -d libTest.so I was able to see all required libs that libTest.so needs. I pulled them all in, into the same folder on my…
Pavel P
  • 15,789
  • 11
  • 79
  • 128
21
votes
2 answers

Where is the "Section to segment mapping" stored in ELF files?

As part of trying to write a compiler completely from scratch, I'm currently working on the part the handles ELF files. After skimming through several articles and specifications about them, I still don't quite understand where section to segment…
BizarreCake
  • 662
  • 5
  • 14
14
votes
2 answers

In GNU Assembler, what does a dot signify at the beginning of a name?

The following is a line from a microprocessor startup file, intended for input into the GNU assembler as: .section .isr_vector,"a",%progbits Does the dot at the beginning of the name .isr_vector mean anything special? PS: This name is referenced…
Sabuncu
  • 5,095
  • 5
  • 55
  • 89
12
votes
1 answer

Why does register_tm_clones and deregister_tm_clones reference an address past the .bss section? Where is this memory allocated?

register_tm_clones and deregister_tm_clones are referencing memory addresses past the end of my RW sections. How is this memory tracked? Example: In the example below deregister_tm_clones references memory address 0x601077, but the last RW section…
brookbot
  • 398
  • 1
  • 3
  • 11
11
votes
1 answer

Explaining readelf -S output

I'm trying to load an elf file into a MIPS simulator I made. The problem I'm having is that I don't quite understand the meaning behind the elf section header offset. When I do a segment dump, segments 25 - 31 and 33 - 35 "start" at 0x00000000 but…
Dan Snyder
  • 1,483
  • 7
  • 20
  • 29
9
votes
1 answer

readelf: Error: Not an ELF file - it has the wrong magic bytes at the start

I build a program and it works well(I mean that I can run this program). But when I use "readelf" to check whether there is debug information,errors come: readelf: Error: Not an ELF file - it has the wrong magic bytes at the start readelf:…
Eric
  • 195
  • 1
  • 2
  • 4
8
votes
1 answer

How to patch 3rd party .so file, to access non-exported symbol (C++)

I have some binary .fic files in a proprietary format , I have a wd250hf64.so from this vendor that contains a C++ method CComposanteHyperFile::HExporteXML(wchar_t* const path) that I can see using nm $ nm --demangle wd250hf64.so …
allan.simon
  • 3,886
  • 6
  • 35
  • 60
8
votes
1 answer

Trace32 command to read symbol contents from ELF file

Problem scenario: In simple words, do we have a Trace32 command to read symbols (and its contents) from ELF file that was loaded on to target ? We have this special case where application specific debug symbols of the ELF file are made as part of…
Shashaankar
  • 81
  • 1
  • 1
  • 2
7
votes
1 answer

Why is my simple `main` program's ELF header say it's a `DYN (Shared object file)` instead of an executable?

Here's a very simple C++ program: // main.cpp int main() {} My Makefile generates the following command to compile the program. ❯ make g++ -O0 -fverbose-asm -o main main.cpp I check with the command file to see it's an ELF executable: ❯ file…
OneRaynyDay
  • 3,658
  • 2
  • 23
  • 56
6
votes
1 answer

Read plt section of ELF binary and print function virtual address

I want to read .plt section of an ELF binary and get all the virtual addresses of external functions. Disassembly of section .plt: 0000000000400400 : 400400: ff 35 02 0c 20 00 pushq 0x200c02(%rip) # 601008…
user
  • 5,335
  • 7
  • 47
  • 63
5
votes
1 answer

What does the left-most number mean in DWARF dump from readelf?

For example: <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_producer : (indirect string, offset: 0xe): GNU C1 1 5.4.0 20160609 -masm=intel -m32 -mtune=generic -march=i686 -g -fst ack-protector-strong <10> DW_AT_language …
Amumu
  • 17,924
  • 31
  • 84
  • 131
5
votes
2 answers

How to extract function prototypes from an elf file?

I have not been successful in finding an answer on this question. Using GDB, I can use the command "call" to get the prototype of a function. Example: (gdb) call fn $1 = {void (int, int)} 0x8048414 So, GDB is able to figure out, only from the…
Blue Demon
  • 293
  • 3
  • 12
1
2 3
9 10