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 Yit,

Thanks for the answer. I guess my interpretation of the ld
documentation is incorrect.

No - the documentation itself is incorrect. The sentence that says:


  "Specifying @var{address} for a section will change the
   value of the location counter."

Should actually read:

  "Specifying @var{address} for a section will change the
   value of the location counter, provided that the section
   is non-empty.  (Empty sections are ignored)."

I will be checking in a patch to update the documentation.

What is the normal practice to force the dot address to be at
_DATA_END_ for both empty and non-empty sections?

Put the address before the start of the .data section. Ie change your linker script to be like this:


  /* append .data; it will be copied by crt0 to final __DATA_START__ */
  . = ALIGN(4);
  __INIT_DATA_START__ = .;

. = __DATA_START__ ;

  .data : AT ( __INIT_DATA_START__ )
  {
    *(.data)


Cheers Nick


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