Search code examples
c++gcccompilationobjdump

How to find object code of c++ file


I want check what is object code of .cpp file .For example file is

File is : lib_mylib.cpp

int fun() {   return 2;}

int fun1(void) {  return 2;}

int fun2(void) {   return 2;}

I want to check object code for this file lib_mylib.cpp .I want to know which linux command can I use to get object code of file lib_mylib.cpp. I tried to objdump command but I am not sure which option of command objdump can I use to see actual object code of the file lib_mylib.cpp


Solution

  • use "objdump -D lib_file"

    the left column will be the 'binary object code' and right column - disassembled one.