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]

loadaddr forward ref problem


Should we accept the following linker script?

SECTIONS
{
  .text :
  {
    _start  = .;
    LONG (__data_load)
  }
  .data :
  {
    __data_load = LOADADDR (.data);
  }
}

currently, this will fail with

nathan@kosh:4>ld/ld-new -T 1263.ld 1263.o
1263.ld:21: undefined symbol `__data_load' referenced in expression

The reason for this failure is that during lang_size_sections_1, we have an undefined lma (os->processed_lma is FALSE). Thus when sizing sections, the __data_load assignment always fails because LOADADDR is undefined. When we do the single final pass, __data_load has no assigned value.

The linker script can be made to work by moving the __data_load assignment outside of the .data section. Is that the right way to handle this issue?

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


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