[PATCH][ld] Do not add padding if an output section is marked as ignored.

Igor Kudrin ikudrin@accesssoftek.com
Wed Dec 7 15:40:00 GMT 2016


Hi,

This patch fixes an issue where padding might be added for an ignored output
section, which leads to an internal error.

Here is a simplified reproducer, assuming binutils are built with
--target=x86_64-pc-mingw32:

$ cat > t.s << EOF
.section .foo
.space(16)
EOF
$ cat > t.t << EOF
SECTIONS
{
  . = SIZEOF_HEADERS;
  .text :
  {
  }
  .data :
  {
  }
  .rdata BLOCK(__section_alignment__) :
  {
     . = ALIGN(8); 
  }
  .bss BLOCK(__section_alignment__) :
  {
  }
}
EOF
$ as-new t.s -o t.o
$ ld-new t.o --file-align 1 --section-align 1 -T t.t
ld-new: internal error binutils/ld/ldlang.c 5111

Best regards,
Igor Kudrin

---
ld/ChangeLog

	* ldlang.c (size_input_section): Avoid calling insert_pad()
	if output_section_statement->ignored is set.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ld-dont-pad-ignored-section.patch.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20161207/5247d464/attachment.txt>


More information about the Binutils mailing list