From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24596 invoked by alias); 15 Oct 2010 20:36:44 -0000 Received: (qmail 24520 invoked by uid 22791); 15 Oct 2010 20:36:43 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-qw0-f41.google.com (HELO mail-qw0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Oct 2010 20:36:38 +0000 Received: by qwb8 with SMTP id 8so697329qwb.0 for ; Fri, 15 Oct 2010 13:36:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.218.73 with SMTP id hp9mr287467qab.72.1287174991462; Fri, 15 Oct 2010 13:36:31 -0700 (PDT) Received: by 10.229.97.9 with HTTP; Fri, 15 Oct 2010 13:36:31 -0700 (PDT) In-Reply-To: <4CB8BF7A.2090904@gmail.com> References: <20100916000335.GS16874@bubble.grove.modra.org> <4CB8BF7A.2090904@gmail.com> Date: Fri, 15 Oct 2010 20:36:00 -0000 Message-ID: Subject: Re: SEC_NEVER_LOAD cleanup From: Kai Tietz To: Dave Korn Cc: binutils@sourceware.org, Alan Modra Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00237.txt.bz2 2010/10/15 Dave Korn : > > =A0 =A0Hi Alan, > > On 16/09/2010 01:03, Alan Modra wrote: >> This gets rid of SEC_NEVER_LOAD in ELF code, curing these failures: > >> I spent quite a lot of time going through changes related to >> SEC_NEVER_LOAD. =A0Testcases in various bug reports behave reasonably >> after this patch, and I think the COFF support should work too but I'm >> less sure of this since I don't have any reason to use COFF/ECOFF/PE >> myself. > >> bfd/ >> =A0 =A0 =A0 * elf.c (bfd_elf_get_default_section_type): Don't test SEC_N= EVER_LOAD. >> =A0 =A0 =A0 * elflink.c (elf_link_input_bfd): Likewise. >> ld/ >> =A0 =A0 =A0 * ld.texinfo (NOLOAD): Do not erroneously state that content= s will >> =A0 =A0 =A0 appear in output file. >> =A0 =A0 =A0 * ldlang.c (lang_add_section): Clear SEC_HAS_CONTENTS on nol= oad >> =A0 =A0 =A0 unless SEC_COFF_SHARED_LIBRARY. >> =A0 =A0 =A0 (map_input_to_output_sections): Don't set SEC_HAS_CONTENTS f= or noload >> =A0 =A0 =A0 output sections. >> =A0 =A0 =A0 (lang_size_sections_1): Don't test SEC_NEVER_LOAD when decid= ing >> =A0 =A0 =A0 to update dot in region. =A0Ditto when setting SEC_ALLOC if = dot >> =A0 =A0 =A0 advanced due to assignment. >> =A0 =A0 =A0 * ldwrite.c (build_link_order): Don't test SEC_NEVER_LOAD. > > =A0This patch causes a failure building the cygwin dll: > >> GNU ld (GNU Binutils) 2.20.51.20100916 >> Creating library file: cygdll.a >> /gnu/binutils/git.repo/obj/ld/.libs/ld-new: BFD (GNU Binutils) 2.20.51.2= 0100916 >> assertion fail /gnu/binutils/git.repo/binutils/bfd/linker.c:2678 >> /gnu/binutils/git.repo/obj/ld/.libs/ld-new: final link failed: Section h= as no contents > > =A0Which appears to be from here: > >> static bfd_boolean >> default_data_link_order (bfd *abfd, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct bfd_link_info *inf= o ATTRIBUTE_UNUSED, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0asection *sec, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct bfd_link_order *li= nk_order) >> { >> =A0 bfd_size_type size; >> =A0 size_t fill_size; >> =A0 bfd_byte *fill; >> =A0 file_ptr loc; >> =A0 bfd_boolean result; >> >> =A0 BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) !=3D 0); > > =A0That's triggered by the ".gnu_debuglink_overlay" section. =A0It has fl= ags =3D > 512 - SEC_NEVER_LOAD is set and nothing else. =A0It's getting added to th= e link > via a bit of custom linker script in the cygwin dll build system that loo= ks > like so: > >> =A0 .gnu_debuglink_overlay ALIGN(__section_alignment__) (NOLOAD): >> =A0 { >> =A0 =A0 BYTE(0) =A0 /* c */ >> =A0 =A0 BYTE(0) =A0 /* y */ >> =A0 =A0 BYTE(0) =A0 /* g */ >> =A0 =A0 BYTE(0) =A0 /* w */ >> =A0 =A0 BYTE(0) =A0 /* i */ >> =A0 =A0 BYTE(0) =A0 /* n */ >> =A0 =A0 BYTE(0) =A0 /* 1 */ >> =A0 =A0 BYTE(0) =A0 /* . */ >> =A0 =A0 BYTE(0) =A0 /* d */ >> =A0 =A0 BYTE(0) =A0 /* b */ >> =A0 =A0 BYTE(0) =A0 /* g */ >> =A0 =A0 BYTE(0) =A0 /* \0 */ >> =A0 =A0 LONG(0) =A0 /* checksum */ >> =A0 } > > =A0I think (haven't checked yet) that this looks like a consequence of the > ldlang.c changes. =A0Any thoughts on how to fix it? > > =A0 =A0cheers, > =A0 =A0 =A0DaveK > > Well, you can add this section to the comparison for debugging section in bfd's coffcode.h (like done there for the others - .debug*, comment, etc). Should work then. Cheers, Kai --=20 |=A0 (\_/) This is Bunny. Copy and paste | (=3D'.'=3D) Bunny into your signature to help | (")_(") him gain world domination