This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: SEC_NEVER_LOAD cleanup
- From: Alan Modra <amodra at gmail dot com>
- To: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Sat, 16 Oct 2010 13:06:00 +1030
- Subject: Re: SEC_NEVER_LOAD cleanup
- References: <20100916000335.GS16874@bubble.grove.modra.org> <4CB8BF7A.2090904@gmail.com>
On Fri, Oct 15, 2010 at 09:54:18PM +0100, Dave Korn wrote:
> > .gnu_debuglink_overlay ALIGN(__section_alignment__) (NOLOAD):
> > {
> > BYTE(0) /* c */
> > BYTE(0) /* y */
> > BYTE(0) /* g */
> > BYTE(0) /* w */
> > BYTE(0) /* i */
> > BYTE(0) /* n */
> > BYTE(0) /* 1 */
> > BYTE(0) /* . */
> > BYTE(0) /* d */
> > BYTE(0) /* b */
> > BYTE(0) /* g */
> > BYTE(0) /* \0 */
> > LONG(0) /* checksum */
> > }
Using your script with a small tweak for ELF gave me the same error.
> I think (haven't checked yet) that this looks like a consequence of the
> ldlang.c changes. Any thoughts on how to fix it?
Like this, I think, just as we discard input sections and padding in
noload sections. Can you test this out for me on cygwin?
* ldwrite.c (build_link_order <lang_data_statement_enum>): Don't
output when section has no contents.
(build_link_order <lang_reloc_statement_enum>): Likewise.
Index: ld/ldwrite.c
===================================================================
RCS file: /cvs/src/src/ld/ldwrite.c,v
retrieving revision 1.32
diff -u -p -r1.32 ldwrite.c
--- ld/ldwrite.c 22 Sep 2010 14:20:24 -0000 1.32
+++ ld/ldwrite.c 16 Oct 2010 01:26:37 -0000
@@ -51,6 +51,11 @@ build_link_order (lang_statement_union_t
output_section = statement->data_statement.output_section;
ASSERT (output_section->owner == link_info.output_bfd);
+ if (!((output_section->flags & SEC_HAS_CONTENTS) != 0
+ || ((output_section->flags & SEC_LOAD) != 0
+ && (output_section->flags & SEC_THREAD_LOCAL))))
+ break;
+
link_order = bfd_new_link_order (link_info.output_bfd, output_section);
if (link_order == NULL)
einfo (_("%P%F: bfd_new_link_order failed\n"));
@@ -191,6 +196,11 @@ build_link_order (lang_statement_union_t
output_section = rs->output_section;
ASSERT (output_section->owner == link_info.output_bfd);
+ if (!((output_section->flags & SEC_HAS_CONTENTS) != 0
+ || ((output_section->flags & SEC_LOAD) != 0
+ && (output_section->flags & SEC_THREAD_LOCAL))))
+ break;
+
link_order = bfd_new_link_order (link_info.output_bfd, output_section);
if (link_order == NULL)
einfo (_("%P%F: bfd_new_link_order failed\n"));
--
Alan Modra
Australia Development Lab, IBM