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: Relative expressions and ASSERT


On Tue, Dec 21, 2010 at 11:05:36AM -0500, Daniel Jacobowitz wrote:
> I'd use a new syntax for setting the compatibility version, because
> if a program relies on the new behavior, then the linker script ought
> to be rejected by an old linker.

I chose to use a symbol so that an old linker *could* use the script.
At least with relatively simple scripts it should be possible to write
a script that works with both old and new rules.  For example, instead
of

SECTIONS
{
  . = 0xc000;
  .text :
  {
    *(.hdr);
    _text = .;
    *(.text)
  }
ASSERT (_text == 0xc000+0x100, "header wrong size!");
}

write the ASSERT as
ASSERT (ABSOLUTE(_text) == 0xc000+0x100, "header wrong size!");


-- 
Alan Modra
Australia Development Lab, IBM


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