public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kai Tietz <ktietz70@googlemail.com>
To: Dave Korn <dave.korn.cygwin@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: SEC_NEVER_LOAD cleanup
Date: Sun, 17 Oct 2010 10:32:00 -0000	[thread overview]
Message-ID: <AANLkTikPFJV1+KYqyfRMJWVbm02ykVrtqPxJfj=UKHsa@mail.gmail.com> (raw)
In-Reply-To: <4CBA0E4A.4060007@gmail.com>

2010/10/16 Dave Korn <dave.korn.cygwin@gmail.com>:
> On 16/10/2010 21:08, Kai Tietz wrote:
>> 2010/10/16 Alan Modra <amodra@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 */
>
>>> 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.
>
>> 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?
>
>  I'm seeing odd behaviour.  If I build the cygwin dll with the
> map_input_to_output_sections reverted, I get this:
>
>> $ objdump -h cygwin0.dll
>>
>> cygwin0.dll:     file format pei-i386
>>
>> Sections:
>> Idx Name          Size      VMA       LMA       File off  Algn
>
>>   9 .gnu_debuglink_overlay 00000010  61239000  61239000  001fee00  2**2
>>                   CONTENTS, EXCLUDE
>
>  ... and this:
>
>> $ objdump -s -j .gnu_debuglink_overlay  cygwin0.dll
>>
>> cygwin0.dll:     file format pei-i386
>>
>> Contents of section .gnu_debuglink_overlay:
>>  61239000 00000000 00000000 00000000 00000000  ................
>>
>> $
>
>  With the build_link_order change instead, I get this:
>
>> $ objdump -h cygwin0.dll
>>
>> cygwin0.dll:     file format pei-i386
>>
>> Sections:
>> Idx Name          Size      VMA       LMA       File off  Algn
>
>>   9 .gnu_debuglink_overlay 00000010  61239000  61239000  00000000  2**2
>>                   EXCLUDE
>
>  ... and this:
>
>> $ objdump -s -j .gnu_debuglink_overlay  cygwin0.dll
>>
>> cygwin0.dll:     file format pei-i386
>>
>> objdump: section '.gnu_debuglink_overlay' mentioned in a -j option, but not
>> found in any input file
>
>  I think it really needs that CONTENTS flag.  Can look closer at it later, I
> have to go offline for a while now.
>
>    cheers,
>      DaveK
>
>

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
-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

  reply	other threads:[~2010-10-17 10:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-16  0:03 Alan Modra
2010-10-15 20:31 ` Dave Korn
2010-10-15 20:36   ` Kai Tietz
2010-10-15 22:27     ` Dave Korn
2010-10-15 22:28       ` Dave Korn
2010-10-16  2:36   ` Alan Modra
2010-10-16 20:08     ` Kai Tietz
2010-10-16 20:19       ` Dave Korn
2010-10-17 10:32         ` Kai Tietz [this message]
2010-10-17 16:40           ` Dave Korn
2010-10-17 19:18             ` Kai Tietz
2010-10-17 23:29       ` Alan Modra
2010-10-18  6:22         ` Kai Tietz
2010-10-18 13:44           ` Alan Modra
2010-10-18 14:39             ` Kai Tietz
2010-10-19 15:05               ` Kai Tietz
2010-10-20 14:48                 ` Dave Korn
2010-10-26 12:46                   ` Alan Modra
2010-10-26 16:56                     ` Dave Korn
2010-11-05  4:36                     ` Dave Korn
2010-11-05  5:58                       ` Alan Modra
2010-11-05  7:24                         ` Dave Korn
2010-10-21 23:32     ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTikPFJV1+KYqyfRMJWVbm02ykVrtqPxJfj=UKHsa@mail.gmail.com' \
    --to=ktietz70@googlemail.com \
    --cc=binutils@sourceware.org \
    --cc=dave.korn.cygwin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).