From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2111 invoked by alias); 17 Oct 2010 10:32:45 -0000 Received: (qmail 2101 invoked by uid 22791); 17 Oct 2010 10:32:44 -0000 X-SWARE-Spam-Status: No, hits=1.0 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SARE_BAYES_5x8,TW_BJ X-Spam-Check-By: sourceware.org Received: from mail-qy0-f176.google.com (HELO mail-qy0-f176.google.com) (209.85.216.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 17 Oct 2010 10:32:39 +0000 Received: by qyk29 with SMTP id 29so2691841qyk.0 for ; Sun, 17 Oct 2010 03:32:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.236.133 with SMTP id kk5mr2646999qcb.191.1287311554196; Sun, 17 Oct 2010 03:32:34 -0700 (PDT) Received: by 10.229.97.9 with HTTP; Sun, 17 Oct 2010 03:32:34 -0700 (PDT) In-Reply-To: <4CBA0E4A.4060007@gmail.com> References: <20100916000335.GS16874@bubble.grove.modra.org> <4CB8BF7A.2090904@gmail.com> <20101016023559.GB26553@bubble.grove.modra.org> <4CBA0E4A.4060007@gmail.com> Date: Sun, 17 Oct 2010 10:32:00 -0000 Message-ID: Subject: Re: SEC_NEVER_LOAD cleanup From: Kai Tietz To: Dave Korn Cc: binutils@sourceware.org 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/msg00256.txt.bz2 2010/10/16 Dave Korn : > On 16/10/2010 21:08, Kai Tietz wrote: >> 2010/10/16 Alan Modra : >>> On Fri, Oct 15, 2010 at 09:54:18PM +0100, Dave Korn wrote: >>>>> =A0 .gnu_debuglink_overlay ALIGN(__section_alignment__) (NOLOAD): >>>>> =A0 { >>>>> =A0 =A0 BYTE(0) /* c */ > >>> Using your script with a small tweak for ELF gave me the same error. >>> >>>> =A0 I think (haven't checked yet) that this looks like a consequence o= f the >>>> ldlang.c changes. =A0Any thoughts on how to fix it? >>> Like this, I think, just as we discard input sections and padding in >>> noload sections. =A0Can you test this out for me on cygwin? >>> >>> =A0 =A0 =A0 =A0* ldwrite.c (build_link_order = ): Don't >>> =A0 =A0 =A0 =A0output when section has no contents. >>> =A0 =A0 =A0 =A0(build_link_order ): Likewise. > >> Well, this looks ok, too. But AFAICS it is touching just the surface. >> My recent patch took care that for PE-COFF the content of the >> debugging sections didn't got zero'ed. Maybe it is a general failure >> to assume (at least for pe-coff, but maybe for elf, too) that NOLOAD >> means to discard sections from linking? > > =A0I'm seeing odd behaviour. =A0If I build the cygwin dll with the > map_input_to_output_sections reverted, I get this: > >> $ objdump -h cygwin0.dll >> >> cygwin0.dll: =A0 =A0 file format pei-i386 >> >> Sections: >> Idx Name =A0 =A0 =A0 =A0 =A0Size =A0 =A0 =A0VMA =A0 =A0 =A0 LMA =A0 =A0 = =A0 File off =A0Algn > >> =A0 9 .gnu_debuglink_overlay 00000010 =A061239000 =A061239000 =A0001fee0= 0 =A02**2 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 CONTENTS, EXCLUDE > > =A0... and this: > >> $ objdump -s -j .gnu_debuglink_overlay =A0cygwin0.dll >> >> cygwin0.dll: =A0 =A0 file format pei-i386 >> >> Contents of section .gnu_debuglink_overlay: >> =A061239000 00000000 00000000 00000000 00000000 =A0................ >> >> $ > > =A0With the build_link_order change instead, I get this: > >> $ objdump -h cygwin0.dll >> >> cygwin0.dll: =A0 =A0 file format pei-i386 >> >> Sections: >> Idx Name =A0 =A0 =A0 =A0 =A0Size =A0 =A0 =A0VMA =A0 =A0 =A0 LMA =A0 =A0 = =A0 File off =A0Algn > >> =A0 9 .gnu_debuglink_overlay 00000010 =A061239000 =A061239000 =A00000000= 0 =A02**2 >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 EXCLUDE > > =A0... and this: > >> $ objdump -s -j .gnu_debuglink_overlay =A0cygwin0.dll >> >> cygwin0.dll: =A0 =A0 file format pei-i386 >> >> objdump: section '.gnu_debuglink_overlay' mentioned in a -j option, but = not >> found in any input file > > =A0I think it really needs that CONTENTS flag. =A0Can look closer at it l= ater, I > have to go offline for a while now. > > =A0 =A0cheers, > =A0 =A0 =A0DaveK > > Well, the CONTENT flag is here of less use. The underlying issue is (at least for pe-coff) that SEC_NEVER_LOAD (which indicates for pe-coff just that this section doesn't have load and allocation flags set and will not loaded into memory - btw different to discard flag, which means that it is initially loaded but then discarded) is treated similar to SEC_EXCLUDE. The SEC_EXCLUDE is in fact the PE-COFF flag IMAGE_SCN_LNK_REMOVE. This looks wrong to me. If you want I can prepare a patch for this. Cheers, Kai --=20 |=A0 (\_/) This is Bunny. Copy and paste | (=3D'.'=3D) Bunny into your signature to help | (")_(") him gain world domination