Sections
- text section - instructions and read-only data
- data section - initialized writable data
- bss section - uninitialized data
Related commands
objdump -s values.o
- Display the full contents of sections, often used in combination with -j to request specific sections.
objdump -j name values.o
- Display information for section name.
objdump -d values.o
- Display the assembler mnemonics for the machine instructions from the input file.
objdump -t values.o
- Print the symbol table entries of the file. This is similar to the information provided by the nm program, although the display format is different.
nm values.o
- lists the symbols from object files
readelf -SW values.o
- Displays the information contained in the file’s section headers, if it has any.
- Don’t break output lines to fit into 80 columns.
Relocations
objdump -dr -M intel values.o
- Display the assembler mnemonics for the machine instructions from the input file.
- Print the relocation entries of the file.
- Pass target specific information to the disassembler.
Final binary
objdump -d -M intel the_program
If there were no symbols
gcc -o the_program values.o main.o
nm values.o
strip values.o
nm values.o
gcc -o the_program values.o main.o
Linkage
nm values.o
C++ headers
nm -C values.o
- Decode (demangle) low-level symbol names into user-level names.
Weak symbols
nm values.o main.o
Linking weak symbols
objdump -h main.o | grep .text
- Display summary information from the section headers of the object file.
Controlling visibility
target_compile_options(dynlib PRIVATE -fvisibility=hidden)
readelf -s values.o
- Displays the entries in symbol table section of the file, if it has one.