RFC: Assign regions to orphan sections

Carlos O'Donell carlos@codesourcery.com
Tue Mar 16 16:33:00 GMT 2010


Daniel Jacobowitz wrote:
> A frequent error message we see is this one, resulting from incomplete
> embedded linker scripts:
> 
> error: no memory region specified for loadable section `.eh_frame`
> 
> The attached test case demonstrates how it happens (.moredata in the
> testcase).  Orphan sections are placed into the default memory region.
> This would result (e.g. with --no-check-sections) in their being
> placed in the *default* memory region.  The linker rightly complains;
> the resulting binary is not useful.  I've even managed to create
> accidental overlays this way, where two of the LOAD segments have the
> same address assigned.
> 
> The warning is sometimes useful (fix your linker script!) but also
> contrary to the point of orphan placement.  This seems like the right
> fix but I would appreciate comments on it.
> 
> The patch is simple once you have the testcase: use AFTER to assign
> regions (and phdrs - I think that's safe and I verified that this
> doesn't place orphan notes in PT_INTERP).
> 
> What do you think?

I think this is correct, and follows what is documented in section 
"3.10.4 Orphan Sections" of the manual.

Cheers,
Carlos.
-- 
Carlos O'Donell
CodeSourcery
carlos@codesourcery.com
(650) 331-3385 x716



More information about the Binutils mailing list