public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Kaylee Blake <klkblake@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: RFC: [PATCH] ELF: Don't require section header on ELF objects
Date: Tue, 10 Mar 2020 09:04:49 +1030	[thread overview]
Message-ID: <20200309223449.GQ5384@bubble.grove.modra.org> (raw)
In-Reply-To: <871cf36a-5690-a8a7-68af-2cf0f54c5b5d@gmail.com>

On Tue, Mar 10, 2020 at 12:24:51AM +1030, Kaylee Blake wrote:
> On 10/3/20 12:14 am, Alan Modra wrote:
> > On Mon, Mar 09, 2020 at 11:24:44PM +1030, Kaylee Blake wrote:
> >> On 9/3/20 6:43 pm, Florian Weimer wrote:
> >>> In my opinion, it should NOT be possible to link against objects
> >>> without section headers.  Lack of section headers clearly marks the
> >>> object as a run-time only object.  This is useful if you want to
> >>> prevent developers to create DT_NEEDED dependencies on internal
> >>> libraries, for example.
> > 
> > I agree.
> > 
> >> For shared objects without debug symbols, the section header table is
> >> ~2kB on average of redundant data. I'm also not a fan of the
> >> inconsistency of having shared libraries that the dynamic linker is
> >> perfectly happy to load, but ld can't link against, especially since
> >> this seems like an oversight rather than an intended design decision.
> > 
> > The ELF spec designed things that way.  See figure 4.1 which I'll try
> > to represent in text.
> > 
> > Figure 4-1: Object File Format
> > 
> > |----------------------|    |----------------------|    
> > |      ELF Header      |    |      ELF Header      |    
> > |----------------------|    |----------------------|    
> > | Program header table |    | Program header table |    
> > |       optional       |    |       required       |    
> > |----------------------|    |----------------------|    
> > |       Section 1      |    |       Segment 1      |    
> > |----------------------|    |----------------------|    
> > |          ...         |    |       Segment 2      |    
> > |----------------------|    |----------------------|    
> > |       Section n      |    |       Segment 3      |    
> > |----------------------|    |----------------------|    
> > |          ...         |    |          ...         |    
> > |----------------------|    |----------------------|    
> > | Section header table |    | Section header table |    
> > |       required       |    |       optional       |    
> > |----------------------|    |----------------------|    
> >       Linking View               Execution View      
> > 
> 
> I had interpreted that table in combination to various other references
> to which things are required vs optional in shared objects as meaning
> that the "execution view" applied to executables and shared objects, and
> the "linking view" applied to relocatable objects. You're saying that
> that table should be interpreted as saying that if a shared object is to
> be linkable, the spec is requiring it to have both sets of headers?

Yes.  Just below the table: "Files used during linking must have a
section header table".

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2020-03-09 22:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-08 17:59 H.J. Lu
2020-03-08 18:06 ` H.J. Lu
2020-03-08 23:35   ` Alan Modra
2020-03-08 23:46     ` H.J. Lu
2020-03-09  0:02       ` H.J. Lu
2020-03-09  0:02       ` Kaylee Blake
2020-03-09  0:05       ` Alan Modra
2020-03-09  1:36         ` H.J. Lu
2020-03-09  1:59           ` Kaylee Blake
2020-03-09  2:23             ` Alan Modra
2020-03-09  2:35               ` H.J. Lu
2020-03-09  4:14                 ` H.J. Lu
2020-03-09  4:59                   ` Kaylee Blake
2020-03-09 11:56                 ` Alan Modra
2020-03-08 23:24 ` Kaylee Blake
2020-03-08 23:29   ` H.J. Lu
2020-03-08 23:38     ` Alan Modra
2020-03-08 23:45       ` H.J. Lu
2020-03-12  2:14         ` Fangrui Song
2020-03-09  8:13 ` Florian Weimer
2020-03-09 12:54   ` Kaylee Blake
2020-03-09 13:06     ` Florian Weimer
2020-03-09 13:14       ` Kaylee Blake
2020-03-09 13:16         ` Florian Weimer
2020-03-09 13:28           ` Kaylee Blake
2020-03-09 13:29             ` Florian Weimer
2020-03-09 13:45               ` Kaylee Blake
2020-03-09 13:54                 ` H.J. Lu
2020-03-09 14:02                   ` Kaylee Blake
2020-03-09 14:52                 ` Florian Weimer
2020-03-09 15:07                   ` Kaylee Blake
2020-03-09 15:29                     ` Florian Weimer
2020-03-09 13:44     ` Alan Modra
2020-03-09 13:54       ` Kaylee Blake
2020-03-09 22:34         ` Alan Modra [this message]
2020-03-10  0:14           ` H.J. Lu
2020-03-09 14:34       ` Michael Matz

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=20200309223449.GQ5384@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=klkblake@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).