2

in The gnu Binary Utilities they say

objdump --adjust-vma=offset

When dumping information, first add offset to all the section addresses. This is useful if the section addresses do not correspond to the symbol table, which can happen when putting sections at particular addresses when using a format which can not represent section addresses, such as a.out.

i try to understand it but i could not, so can any one explain to me what this option do? and what circumstance need this option in real life?

  • 1
    `offset` is a number you pass on the command line, which you use to fixup the output. It's a number that's added to every address printed. (Apparently `objdump` can't get that info from the file metadata for some formats). – Peter Cordes Mar 13 '18 at 06:47

2 Answers2

1

This option is mostly usefull when trying to disassemble DOS COM binaries. A COM binary is a program image without any headers that is loaded to address 0x100 in some segment and executed by jumping to address 0x100.

objdump doesn't know this (after all, there is no way to detect that a file is a COM binary) and disassembles the binary as if it was loaded to address 0. Passing --adjust-vma=0x100 fixes this behaviour and makes objdump disassemble the binary as if it was loaded to 0x100 (which is what we want) instead.

fuz
  • 88,405
  • 25
  • 200
  • 352
1

Besides fuz's excellent answer, another use case is for code which relocates itself (the archetypal example is the code in the IBM-PC Master Boot Record.) Depending whether the original code and hence the metadata was targeting the source or the destination address (either one is possible but not both at the same time), this option allows you to be presented the alternative dump.

AntoineL
  • 888
  • 4
  • 25