objdump

Trying to assemble the output of an disassembler (such as objdump) [duplicate]

和自甴很熟 提交于 2019-12-04 13:07:59
This question already has answers here : Closed 6 years ago . Possible Duplicate: Disassembling, modifying and then reassembling a Linux executable I've been told that assembly and dissassembly are not inverses. Apparently, you can't dissassemble a program, put that output directly into an assembler, and expect it to run correctly because information is lost. My question is, why is information lost? Also, what information is lost? One important thing that disassemblers (or their users) routinely do not preserve is the instruction encoding. Some instructions can be encoded in multiple different

How to extract function prototypes from an elf file?

元气小坏坏 提交于 2019-12-04 07:04:47
I have not been successful in finding an answer on this question. Using GDB, I can use the command "call" to get the prototype of a function. Example: (gdb) call fn $1 = {void (int, int)} 0x8048414 <fn> So, GDB is able to figure out, only from the elf-file, that fn() returns void and takes two integers as arguments. However, I need to use some other tool to extract the function prototypes from an elf file. Preferably, I want to use objdump / readelf. Does anyone know if this is possible? If it is not possible, how does GDB do it? In which section of the elf file is the function prototypes

objdump and ARM vs Thumb

允我心安 提交于 2019-12-04 03:17:50
I'm trying to disassemble an object built for ARM with gcc. Unfortunately, objdump is trying to guess whether the code is ARM and Thumb, and is getting it wrong: it thinks my code is Thumb when it's actually ARM. I see that objdump has an option to force it to interpret all instructions as Thumb ( -Mforce-thumb ), but it doesn't have one to force ARM mode! This seems like a really weird omission to me, and it's seriously hampering my ability to get work done (I'm on an embedded device and my only means of debugging is to look at the disassembly). I've tried various approaches, including trying

What is the .data.rel.ro used for?

萝らか妹 提交于 2019-12-04 02:36:07
I am using objdump to analyze a shared object's memory usage. Along with the .data and .rodata sections I see a .data.rel.ro section. Anyone know what this used for? I found the answer here : gcc, the GNU linker, and the glibc dynamic linker cooperate to implement an idea called read-only relocations, or relro. This permits the linker to designate a part of an executable or (more commonly) a shared library as being read-only after dynamic relocations have been applied. This may be used for read-only global variables which are initialized to something which requires a relocation, such as the

Flags in objdump output of object file

余生颓废 提交于 2019-12-04 01:38:33
There is this output of objdump on some object file: $ objdump -h main.o main.o: file format elf32-i386 Sections: Idx Name Size VMA LMA File off Algn 0 .text 0000000b 00000000 00000000 00000034 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .data 00000000 00000000 00000000 00000040 2**2 CONTENTS, ALLOC, LOAD, DATA 2 .bss 00000000 00000000 00000000 00000040 2**2 ALLOC 3 .note.GNU-stack 00000000 00000000 00000000 00000040 2**0 CONTENTS, READONLY, CODE What do these flags CONTENTS, ALLOC, LOAD and so on mean? What you see is the interpretation of the combination of ELF segment flags, section type

How I can find function in shared object files using objdump and bash functions in linux?

我是研究僧i 提交于 2019-12-03 15:33:43
问题 I've got a folder in linux, which is contained several shared object files (*.so). How I can find function in shared object files using objdump and bash functions in linux? For instance, the following example is found me function func1 in mylib.so: objdump -d mylib.so | grep func1 But i want to find func1 in folder which is contained shared object files. I don't know bash language and how to combinate linux terminal commands. 回答1: nm is simpler than objdump , for this task. nm -A *.so | grep

Using objdump for ARM architecture: Disassembling to ARM

对着背影说爱祢 提交于 2019-12-03 11:15:27
I have an object file and am trying to disassemble it. When I use: objdump -d example.o I get an assembly in code in the file format of elf64-x86-64 . I am trying to disassemble this into ARM, how do I go about doing this? If you want to do disassemble of ARM code, you'd better have an ARM tool chain, this is what I got: http://bb.osmocom.org/trac/wiki/toolchain After you have this, you can use arm-elf-objdump instead of objdump. The command I used is arm-elf-objdump -D -b binary -marm binaryfile.dat If you look the manpage, you will find "-b" is followed by the file type. Sorry I don't know

Difference between nm and objdump

邮差的信 提交于 2019-12-03 06:04:44
问题 Looking at the manuals, objdump and nm have overlapping features. When would you use each one? What was the original purpose of each command? 回答1: They have no similar parameters. nm lists file symbols, while objdump can show a lot of different information about files. objdump can shows symbols too, and it is explicitly noted in the manpage that "This is similar to the information provided by the nm program, although the display format is different." 回答2: It seems like nm is posix, so

readelf vs. objdump: why are both needed

两盒软妹~` 提交于 2019-12-03 04:14:01
问题 I need to learn about the ELF file layout for a project I am working on and I noticed the existence of these tools. Why do all Linux distributions include both readelf and objdump? Do these tools complement one another? When would i prefer to use one over another? 回答1: from binutils/readelf.c: /* The difference between readelf and objdump: Both programs are capabale of displaying the contents of ELF format files, so why does the binutils project have two file dumpers ? The reason is that

What does each column of objdump's Symbol table mean?

≯℡__Kan透↙ 提交于 2019-12-03 02:38:56
问题 SYMBOL TABLE: 0000000000000000 w *UND* 0000000000000000 __gmon_start__ I've man objdump but there's no such info. Anyone know what the 5 columns mean? 回答1: COLUMN ONE: the symbol's value COLUMN TWO: a set of characters and spaces indicating the flag bits that are set on the symbol. There are seven groupings which are listed below: group one: (l,g,,!) local, global, neither, both. group two: (w,) weak or strong symbol. group three: (C,) symbol denotes a constructor or an ordinary symbol. group