Search code examples
c++disassemblyobjdump

Why doesn't my objdump -D of program look different from .S


I am learning the toolchains for my C++ and trying out the objdump.

The disassembled file from objdump doesn't even have the word "Hello World". Why is that? Is it not reliable at all?


Solution

  • The following code:

    #include <stdio.h>
    int main(void) { printf("Hello world\n"); }
    

    can be completely disassembled with objdump -Dslx my_prog, which reveals, amongst other things, the following:

    Contents of section .rodata:
     400598 01000200 00000000 00000000 00000000  ................
     4005a8 48656c6c 6f20776f 726c6400           Hello world.
    

    If yours is different, then please post code, etc.