This is the mail archive of the binutils@sources.redhat.com 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: [PATCH/RFA] Fix C-referenceable sections with explicit LMAs


On Fri, Dec 06, 2002 at 03:44:20PM -0800, Jason R Thorpe wrote:

 > On Sat, Dec 07, 2002 at 09:02:03AM +1030, Alan Modra wrote:
 > 
 >  > No way.  You can't change SIZEOF to mean "size of the output section
 >  > specified + random other following output sections"
 > 
 > Except that they're not "random other following output sections".  They're
 > sections that are effectively added to the named section by another feature
 > of the linker, and you can't name those orphans, because it breaks actually
 > using that other feature.
 > 
 > I realized while having lunch that my test case actually masks a potential
 > failure mode.  I will adjust it so that it shows the bogus behavior of not
 > adjusting SIZEOF.

Ok, the following fixes the test case so that it actually demonstrates
why not adjusting SIZEOF doesn't work properly.  Without my change to
SIZEOF to account for orphans that are added to the section, the linker
will produce the following error:

arm-unknown-netbsdelf1.7-ld: section .data [10800008 -> 1080000b] overlaps section link_set_1 [10800008 -> 1080000b]

...and with my change, the test case passes.

Here's the updated patch, including test case.

	* ldexp.c (fold_name): When handling SIZEOF, apply any size
	adjustment that has been recorded for the section.
	* ldlang.c (lang_output_section_statement_lookup): Initialize
	size_adj member.
	* ldlang.h (lang_output_section_statement_type): Add size_adj
	members.
	* emultempl/elf32.em (place_orphan): If no .rodata output section
	is present, allow read-only data to be placed with .text.  Record
	a size adjustment of the output section for each orphan placed with
	it.

	* ld-scripts/refsec-lma.exp: New test.
	* ld-scripts/refsec-lma.s: New test.
	* ld-scripts/refsec-lma.t: New test.

	* lib/ld-lib.exp (is_elf_format): Match NetBSD ELF targets.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>

Attachment: ld-orphan-patch
Description: Text document


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