ld bug in the location counter calculation?

Nick Clifton nickc@redhat.com
Wed Apr 1 15:58:00 GMT 2009


Hi Tehn,

> I may have a problem where the linker is not generating the correct
> address for the location counter, however I want to check it with the
> folks on this list before filling a bug report.

I am not 100% sure, but I think that this may be a misunderstanding 
rather than a bug.

> I have the following snippet in my linker script

>   __INIT_DATA_START__ = .;
>   .data __DATA_START__ : AT ( __INIT_DATA_START__ )
>   {
>     *(.data)
>     *(.data.*)
>     SORT(CONSTRUCTORS)
>   }
>   . = ALIGN(4);
>   __DATA_END__ = .;

> However, as there isn't any real initialise data, the .data section is
> empty. Looking at the code that it generates, __DATA_END__ has been
> assigned an address that the same as __INIT_DATA_START__.
> 
> From what I understand of the ld documentation, __DATA_END__ should be
> the same as __DATA_START__

Since the .data section is empty its start address is not used by the 
linker.  Hence __DATA_END__ is the same as __INIT_DATA_START__.  So 
basically the linker is behaving correctly.

Cheers
   Nick



More information about the Binutils mailing list