This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ld bug in the location counter calculation?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]