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]

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


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.

Attachment: ld-dont-pad-ignored-section.patch.txt
Description: ld-dont-pad-ignored-section.patch.txt


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