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
0 answers

What is the difference between readelf -sD and readelf --dyn-syms

From readelf's manpage, I see that --dyn-syms Display the dynamic symbol table -s --syms Display the symbol table -D --use-dynamic Use the dynamic section info when displaying symbols So I think readelf -sD equals…
calvin
  • 2,125
  • 2
  • 21
  • 38
1
vote
0 answers

How "readelf --hex-dump" gives little endian output

I am using readelf --hex-dump=
to get hex dump of a specific section. However, the result is shown as big endian DWORD. Is there a native way to make the output little endian? Hex dump of section 'PrgCode': 0x1ffe0000 b0b54ef2…
Eric Sun
  • 777
  • 6
  • 20
1
vote
2 answers

How do I find out where main() is defined in a big project?

Let's say I have the following program (a.c): #include void f() { printf("Hello, world!"); } int main(void) { f(); return 0; } $ gcc -g a.c Having a.out, how do I find out where main() is defined? I mean, in a big project…
x-yuri
  • 16,722
  • 15
  • 114
  • 161
1
vote
3 answers

How to determine if an ELF file is a Go ELF file?

I need to determine whether a given ELF file originated from Go. According to this link: $ readelf -a traefik.stripped | grep "\.note\.go\.buildid" Is this in any way inferior to go's native way: $ go tool buildid…
OrenIshShalom
  • 5,974
  • 9
  • 37
  • 87
1
vote
2 answers

Redefining symbols from shared library

I have a requirement on changing certain symbols from shared library (.so) files like below example: i need to rename symbol abc in .so file to symbol xyz. I have a tool to replace it in header files, only challenge i am facing for changing in my…
praveen
  • 21
  • 3
1
vote
1 answer

How to edit ELF files in Linux?

I have written two similar C programs. How can I make the outputs of both code same by editing one of the ELF files not the actual code? /** * prg1.c */ #include #include int main() { int a = 5; int b = 10; …
naazz
  • 33
  • 3
1
vote
2 answers

How to find `.strtab` in an ELF file?

When running readelf -S I get: [27] .strtab STRTAB 0000000000000000 00001630 00000000000001d7 0000000000000000 0 0 1 [28] .shstrtab STRTAB 0000000000000000 00001807 …
user16283557
1
vote
0 answers

READELF - How to add "@GLIBX_XXX" after symbol name

I'm learning ELF, and was given a task to create a custom READELF program in C 32bit linux. As part of my task, I created pointers to the '.symtab' and the '.strtab' tables, so I could print each symbol name. However, when comparing my output to the…
Yonatan
  • 23
  • 7
1
vote
1 answer

Can't understand the 'Off' value of a section in readelf output? Is it offset from 'Address'?

Here is the output of readelf -a test.elf Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 0] NULL 0000000000000000 000000 000000 00 0 0 0 [ 1] .text…
Chan Kim
  • 5,177
  • 12
  • 57
  • 112
1
vote
1 answer

How do I dump the contents of an ELF file at a specific address?

Using GDB, if I load an ELF image and give it an address, I can get GDB to dump the contents of the ELF file at that address. For example: p *((MYSTRUCT *)0x06f8f5b0) $1 = { filename = 0x6f8f5e0 "this is a string", format = 0x6f8f640
lord_nimon
  • 173
  • 9
1
vote
1 answer

what is the "Value" field in output of readelf -s

Here is my code: #include int variable; int main(){ printf("%p", &variable); } Output in couple of runs: ~ % ./a.out 0x559bae5c4030 ~ % ./a.out 0x55b9d1038030 ~ % as you can see, there's a "30" at the end of both addresses. and…
grey
  • 13
  • 3
1
vote
1 answer

What does "readelf error: LEB value too large" mean?

What exactly does mean this error and what can cause it? readelf: Error: LEB value too large What LEB stands for? Lower(st) estimated bound(ary)? I have seen it many times, in particular when building Archlinux packages.
1
vote
1 answer

What is the difference between Entry point address and __executable_start

I'm learning how a linker works on Linux. I'm told that a linker will generate some symbols for an executable file, such as __executable_start, which is the address where the program starts. Also, I've known that there was a "Entry point address" in…
Yves
  • 11,597
  • 17
  • 83
  • 180
1
vote
0 answers

what it signifies if a symbol is mentioned in symtab but not in dynsym of readelf output?

I have a shared library named libtest.so. I was analyzing the readelf output of this .so to solve undefined reference to _invalid_parameter(). The readelf output shows _invalid_parameter UND in .symtab section but no mention of it in .dynsym…
Pendyala
  • 585
  • 1
  • 6
  • 17
1
vote
0 answers

reading the output of readelf -wi, why do some local variables have a DW_AT_location value, but others do not?

I am running readelf -wi file.elf, and looking at the output. I am looking at some of the debug info for local variables, I can find all the variables listed (they all have DW_AT_name), but some do not have DW_AT_location : stuff why? Is there a…
user1426923
  • 67
  • 1
  • 5