Questions tagged [objdump]

objdump is a program for displaying various information about object files. For instance, it can be used as a disassembler to view executable in assembly form. It is part of the GNU Binutils for fine-grained control over executable and other binary data.

477 questions
7
votes
0 answers

Unable to generate smallest binary from Rust code

My goal is to compile Rust programs to the smallest possible binary and extract the machine code. I've made a very simple program to test. .cargo/config [target.x86_64-pc-windows-gnu] rustflags = ["-C", "link-args=-e _start -static…
Xobtah
  • 464
  • 7
  • 20
7
votes
3 answers

GCC/objdump: Generating compilable/buildable assembly (interspersed with C/C++) source?

This is close to Using GCC to produce readable assembly?, but my context here is avr-gcc (and correspondingly, avr-objdump) for Atmel (though, I guess it would apply across the GCC board). The thing is, I have a project of multiple .c and .cpp…
sdaau
  • 36,975
  • 46
  • 198
  • 278
7
votes
2 answers

objdump - head ELF - Meaning of flags?

$ objdump -f ./a.out ./a.out: file format elf32-i386 architecture: i386, flags 0x00000112: EXEC_P, HAS_SYMS, D_PAGED start address 0x080484e0 $ objdump -f function.o function.o: file format elf32-i386 architecture: i386, flags…
Unitech
  • 5,781
  • 5
  • 40
  • 47
7
votes
2 answers

Local variable location in memory

For a homework assignment I have been given some c files, and compiled them using arm-linux-gcc (we will eventually be targeting gumstix boards, but for these exercises we have been working with qemu and ema). One of the questions confuses me a…
bkane521
  • 386
  • 2
  • 10
6
votes
2 answers

objdump, displaying without offsets

When dumping an executable file, I only want the code segment to be printed on the standard output, not offsets and binary form of the code. I cannot achieve it from man objdump Is there a way?
mustafa.yavuz
  • 1,274
  • 2
  • 21
  • 40
6
votes
2 answers

objdump output - what do the columns represent?

I ran objdump -r on an object file and got the following output. What do each of the columns represent here? I might have missed it, but the documentation doesn't specify. simple.o: file format elf64-x86-64 Disassembly of section…
Matty
  • 33,203
  • 13
  • 65
  • 93
6
votes
1 answer

How to compile library with source code with NDK tools?

How to compile library with source code ? I am developing the native library with android ndk. Sometimes I got the crash dump messages from logcat. 06-18 15:24:58.545: INFO/DEBUG(24667): *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***…
qrtt1
  • 7,746
  • 8
  • 42
  • 62
6
votes
1 answer

gcc -g flag: Moving the Source Code

My understanding is that when you compile C code using gcc -g, gcc will insert debugging information that includes references to the original source code (e.g. line numbers). Then other programs such as gdb and objdump can recover these references…
Flight Odyssey
  • 2,267
  • 18
  • 25
6
votes
1 answer

Determining register values when using objdump

So I'm trying to use the objdump utility to build a Control Flow Graph from assembly, and I'm running into a problem. Basically, whenever a branch occurs and the target address is relative I'm not sure how to know where the next basic block starts.…
Sam
  • 278
  • 3
  • 9
6
votes
1 answer

Which section does objdump disassemble by default

I am currently building a bare metal executeable, which contains some special sections containing code. However, when I do objdump -d I only get the code for the .text and .init.text sections. The manpage for objdump only says that it "only…
LiKao
  • 10,408
  • 6
  • 53
  • 91
6
votes
4 answers

Finding locations in machine code (gcc/objdump -d)

If you have a particular line of C code in mind to examine in the machine output, how would you locate it in objdump output. Here is an example if (cond) foo; bar(); and I want to see if bar was inlined as I'd like. Or would you use some…
Setjmp
  • 27,279
  • 27
  • 74
  • 92
6
votes
2 answers

Objdump ARM aarch64 code?

I have an elf arm aarch64 binary and i want to disassemble it .text section using objdump.My machine is amd64. I tried Using objdump for ARM architecture: Disassembling to ARM but objdump is not identifying the binary so not able to disassemble it.
in3o
  • 321
  • 2
  • 3
  • 14
6
votes
2 answers

objdump to extract contents of text segment to a binary format

How do we use objdump to output to a binary file? This is definitely not the right way to do so: objdump -s -j .text /path/firmware.ko > /content.bin as it is only presenting text format. I only require the bytes of the text segment to be…
Ursa Major
  • 851
  • 7
  • 25
  • 47
6
votes
1 answer

Get list of source files (and locations) from binary

I'm working in a linux distro. I'm writing a C/C++ program that requires a list of source files that a binary (executable) was compiled with. I compiled the binary using GCC with the -g flag, of course. Using gdb I found out the format of the binary…
gospes
  • 3,819
  • 1
  • 28
  • 31
6
votes
3 answers

Disassembly of sections in a c program

I wrote a very basic Hello World program to know about sections. After using objdump I got all sections. I am using ubuntu 12.04. in output I found it like that : Disassembly of section .init Disassembly of section .plt Disassembly of section…
someone
  • 1,638
  • 3
  • 21
  • 36