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: [PATCH] Fail on erroneous linker script


Alan Modra wrote:
On Fri, Dec 04, 2009 at 08:03:42PM +0300, Maxim Kuvyrkov wrote:
In most valid cases NOBITS sections (.bss, usually) are placed at the end of the loaded segments. However, if a user provides a custom linker scripts which puts, a .bss section in the middle of the data segment, the linker will produce a broken binary. The proper behavior for linker is to fail with appropriate error message.

We could also treat such NOBITS sections as if they were PROGBITS. Like the following untested patch. What do you think?

	* elf.c (write_zeros): New function.
	(assign_file_positions_for_load_sections): Allocate file space for
	NOBITS sections that are followed by PROGBITS sections in a segment.

It looks good. The patch fixes the original problem and doesn't show any regressions. I tested it on i686-linux by building glibc and running testsuites.


--
Maxim Kuvyrkov
CodeSourcery
maxim@codesourcery.com
(650) 331-3385 x724


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