A question about setting location counter to a new value in output section

Alan Modra amodra@gmail.com
Wed Apr 4 12:57:00 GMT 2018


On Wed, Apr 04, 2018 at 08:05:54PM +0800, Hao Lee wrote:
> I can't understand why lable_2 is 0x30. As the LD documentation
> says[0], if '.' is used inside a section description, it refers to the
> byte offset from the start of that section, not an absolute address.
> In the custom_section, '.' is set to 0x20 which is a relative offset,
> so I think label_2 should also be 0x20. The value of label_3 is
> reasonable because it's an absolute address.

Symbol values in an ELF executable or shared object are virtual
addresses, not section offsets.

http://www.sco.com/developers/gabi/latest/ch4.symtab.html#symbol_value

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list