Can't get ASSERT() to work in ld script.

Alan Modra alan@linuxcare.com.au
Wed Feb 14 15:57:00 GMT 2001


On 14 Feb 2001, Ian Lance Taylor wrote:

> Grant Edwards <grante@visi.com> writes:
> 
> > I've spend hours trying to get a simple ASSSERT() statement to
> > work in a linker script.
> 
> Something like this works for me:
> 
> . = ASSERT ( 0, error );
> 
> It always helps to give an example of what doesn't work.

It also pays to take a glance at ld/ldgram.y.  That would have told you an
ASSERT is considered an expression, so can appear anywhere an expression
is valid.

I'm not so sure this makes sense really.  Ian's example is rather
contrived, and you probably don't want to assign the result of an ASSERT
to anything.  Should ASSERT_K move to ifile_p1?

Alan Modra
-- 
Linuxcare.  Support for the Revolution.




More information about the Binutils mailing list