Re: A question about setting Location Counter to a new value in ld linker script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/04/2018 08:07, Hao Lee wrote:

> I'm confused about the location counter, especially when setting it to
> a new value in the output section.
> 
> I write a simple program and a linker script to make my question more
> clear. The code is as follows: [snip]
> 
> I can't understand why lable_2 is 0x30. As the LD documentation
> says[1], 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 address,
> so I think label_2 should also be 0x20. However, label_2 is 0x30. (The
> value of label_3 is reasonable because it's an absolute address.)
> 
> Could someone please explain why label_2 is 0x30? Thanks!
> 
> [1] https://sourceware.org/binutils/docs-2.30/ld/Location-Counter.html#Location-Counter

Hello,

'gas' (GNU assembler) and 'ld' (GNU linker) are Binutils tools.
AFAIU, Binutils and GCC are separate projects -- with GCC producing
assembly code processed by gas and then ld.

Thus, you might have better luck asking on the binutils mailing list:

	binutils@xxxxxxxxxxxxxx

https://sourceware.org/ml/binutils/

Regards.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux