fix bug with loadaddr and load regions

Nathan Sidwell nathan@codesourcery.com
Fri Aug 25 11:19:00 GMT 2006


I fell over a problem with using a load region and loadaddr, to create a romable 
  image.  With
	.data { data_load = LOADADDR(.data); ... } >ram AT>rom
I found that data_load's value became load address + execution address, because 
it was interpreted as a data-relative value.  The same problem didn't manifest with
	.data : AT(EXPR) { data_load = LOADADDR(.data); ...} >ram
but of course here I have to calculate EXPR myself.

When using an AT> region, ldlang creates an integer expression for the section's 
load address.  When calculating this later for the map file, it uses 
exp_get_abs_int to calculate it in an absolute context (so the map file shows 
the correct load address).  However, when it's evaluated as part of a LOADADDR, 
it's calculated in the current section's context.

This patch fixes things in the simplest way I could find.  Namely when 
evaluating the LOADADDR expression, check whether it came from a load region, 
and if so explicitly put it in the *ABS* section.

ok?

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: loadaddr.patch
Type: text/x-patch
Size: 2962 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060825/417ab575/attachment.bin>


More information about the Binutils mailing list