[PATCH] orphan section creating huge output file
Bob Wilson
bwilson@tensilica.com
Thu Mar 17 04:41:00 GMT 2005
A while back, David Heine found a problem where an orphan section could cause
the linker to create huge output files, or even segfault when trying to seek to
a negative value. (See http://sourceware.org/ml/binutils/2003-04/msg00423.html)
This problem was fixed earlier, but now he's found a similar problem.
David analyzed this and sent me an earlier version of this patch, so I'll try to
describe this as best I can. The use of IGNORE_SECTION in
lang_size_sections_1() in ldlang.c is not right because at that point the
section sizes are all zero, and IGNORE_SECTION is true for zero size sections.
Moreover, even a zero size section can cause the huge output file problem. The
attached patch moves the check for zero size sections out of the IGNORE_SECTION
macro. David also provided a testcase to demonstrate the problem, and I've
cleaned it up and added it to the testsuite.
OK for mainline?
ld/ChangeLog:
2005-03-16 David Heine <dlheine@tensilica.com>
Bob Wilson <bob.wilson@acm.org>
* ldlang.c (IGNORE_SECTION): Remove check for zero size.
(lang_check_section_addresses): Ignore zero size sections here.
ld/testsuite/ChangeLog:
2005-03-16 David Heine <dlheine@tensilica.com>
Bob Wilson <bob.wilson@acm.org>
* ld-scripts/empty-orphan.d, ld-scripts/empty-orphan.exp,
ld-scripts/empty-orphan.s, ld-scripts/emtpy-orphan.t: New test.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: empty-orphan.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20050317/bd90b751/attachment.ksh>
More information about the Binutils
mailing list