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

Which things should I refer to for the correct configuration of cross-compiler?

I have referred to the output of "readelf -h target.bin" (target.bin runs on target machine) for the configuration of cross-compiler. I assumed readelf output of a binary program compiled by a cross-compiler should be same as that of target.bin. In…
freddy
  • 463
  • 1
  • 8
  • 20
1
vote
1 answer

print the name of the library that defines a given symbol

Assuming that you have the name of a symbol ( demangled or not ) and the name of a library dynamically linked to others, you want to find out which library is able to resolve that symbol. I tried to use nm, objdump and readelf and I can't find good…
user2485710
  • 9,451
  • 13
  • 58
  • 102
1
vote
1 answer

"size" vs "readelf -t" command gives different segment length

size my_obj.o, lists the size of text, .data segments in bytes. but readelf -t my_obj.o gives different size (much lesser) of text & data segments. **text .data .bss** 200890 4797 88 146172 1960 88 object dump also gives…
Maulik
  • 19
  • 4
1
vote
1 answer

Scan shared object inclusions at runtime

I am working on a C program (under Linux ) that relies on shared libraries as plugins. I provide each plugin with several functions from a static library of mine. In order to change the workflow of my program, I need to know at runtime whether a…
ziu
  • 2,634
  • 2
  • 24
  • 39
1
vote
1 answer

How to extract a few functions out of a compiled ELF-executable (no disassembly)?

I'm dealing with a large executable, for which I do not have sources (long story). I'd like to extract the binary code of several functions from it -- and try to call them from my own program. The functions I'm looking for were all compiled from the…
Mikhail T.
  • 3,043
  • 3
  • 29
  • 46
1
vote
1 answer

ELF Program Headers: MemSiz vs. FileSiz

readelf -l /bin/bash gives me this: Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flags Align PHDR 0x0000000000000040 0x0000000000400040…
gvl
  • 903
  • 7
  • 16
0
votes
0 answers

Cannot interpret ELF 64-bit obj file section header tables

I have a relocatable 64-bit .o file at hand and would like to read each section header. From the wiki I see that the 2-byte value stored in 0x28 should be the start of section header table. The value is 0x0328. I then go to address 0x0328 and…
Nicholas Humphrey
  • 1,220
  • 1
  • 16
  • 33
0
votes
1 answer

Different section header offsets in otherwise identical object files

So I have two different ELF files, one that came precompiled and the other I compiled from source. The output from readelf is: Precompiled File (File1): ELF Header: Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 Class: …
The Dude
  • 661
  • 2
  • 11
  • 20
0
votes
1 answer

How can a LOAD segment have an offset of 0?

Look at this readelf of an ELF file, the first LOAD segment has offset 0. How is that even possible? Isn't the ELF header at offset 0? readelf -l
0
votes
0 answers

Understanding Linux readelf "program interpreter" - how is this set at compile time?

I am building some software (swupdate) that has the traditional 'kbuild' (kconfig / menuconfig) mechanism, and thus has an intermediate binary mconf that it builds before it brings up the text-menu system. I'm using a third-party "productivity…
davidA
  • 12,528
  • 9
  • 64
  • 96
0
votes
0 answers

incorrect shared library being used at runtime for my c Program

i have complied my program with new version of a shared libary (vertex ) and when i do ldd on my executable i see it is linked to correct version (STQ_8_1_ISAM) ldd /pathtoexe/mytaxprg|grep vertex libvst.so =>…
satyesht
  • 499
  • 7
  • 19
0
votes
1 answer

ELF's gnu_debuglink section gives me weird name

I've used Ubuntu 20.04.3, and when I run readelf --string-dump=.gnu_debuglink /usr/bin/cp I got weird debug filename while expecting something like cp.debug String dump of section '.gnu_debuglink': [ 0] …
user150497
  • 490
  • 4
  • 14
0
votes
1 answer

How to list up variables assigned to a specific section in an elf file?

How can I list up variables allocated in a specific section in an elf file? For example, if I do readelf -t vmlinux, I can see the section informations (start offset and the size, of course in virtual address) so I can see where the .data..percpu…
Chan Kim
  • 5,177
  • 12
  • 57
  • 112
0
votes
1 answer

C How to translate st_value of entry into value?

when I call readelf with -s flag on my Executable Elf file I get: Num: Value Size Type Bind Vis Ndx Name 43: 00000000004004e7 30 FUNC GLOBAL DEFAULT 13 find_me_func But when I read the symbol table entry at index 43 I…
user16283557
0
votes
1 answer

Elf file format, what's the order?

Please help me fix my confusion: In Elf64 File at first we the elf header, then immediately all program header and then all section headers? Then why for example in elf header we have a index to where the first program header starts if it's always…
user16275453