From: "H.J. Lu" <hjl.tools@gmail.com>
To: Binutils <binutils@sourceware.org>
Cc: Kaylee Blake <klkblake@gmail.com>
Subject: Re: RFC: [PATCH] ELF: Don't require section header on ELF objects
Date: Sun, 8 Mar 2020 11:06:33 -0700 [thread overview]
Message-ID: <CAMe9rOpSQtgjXJKWwq9QuOw5ehE7dW0P0cek7ASkU1uWbVvkmw@mail.gmail.com> (raw)
In-Reply-To: <20200308175947.GA911529@gmail.com>
On Sun, Mar 8, 2020 at 10:59 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Any comments?
>
> Kaylee, do you have copyright paper with FSF?
>
> H.J.
> ---
> Section header isn't mandatory on ELF executable nor shared library.
> This patch adds a new linker option, -z nosectionheader, to omit ELF
> section header when building an executable or shared library, adds
> an objcopy and strip option, --remove-section-header, to remove ELF
> section header from an executable or shared library.
>
> The PT_DYNAMIC segment contains DT_HASH/DT_GNU_HASH/DT_MIPS_XHASH,
> DT_STRTAB, DT_SYMTAB, DT_STRSZ and DT_SYMENT, which can be used to
> reconstruct dynamic symbol table when section header isn't available.
> For DT_HASH, the number of dynamic symbol table entries equals the
> number of chains. For DT_GNU_HASH/DT_MIPS_XHASH, only defined symbols
> with non-STB_LOCAL indings are in hash table. Since in dynamic symbol
> table, all symbols with STB_LOCAL binding are placed before symbols with
> other bindings and all defined symbols are placed before undefined ones,
It should read
---
all symbols with STB_LOCAL binding are placed
before symbols with other bindings and all undefined symbols are placed
before defined ones,
---
The complete patch set is on users/hjl/pr25617/master branch at
https://gitlab.com/x86-binutils/binutils-gdb
> the highest symbol index in DT_GNU_HASH/DT_MIPS_XHASH is the highest
> dynamic symbol table index.
>
> bfd/
>
> 2020-03-XX H.J. Lu <hongjiu.lu@intel.com>
> Kaylee Blake <klkblake@gmail.com>
>
> PR ld/25617
> * bfd.c (BFD_NO_SECTION_HEADER): New.
> (BFD_FLAGS_SAVED): Add BFD_NO_SECTION_HEADER.
> (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
> * elfcode.h (elf_swap_ehdr_out): Omit section header on
> non-relocatable output with BFD_NO_SECTION_HEADER.
> (elf_write_shdrs_and_ehdr): Likewise.
> * elfxx-target.h (TARGET_BIG_SYM): Add BFD_NO_SECTION_HEADER
> to object_flags.
> (TARGET_LITTLE_SYM): Likewise.
> * bfd-in2.h: Regenerated.
>
> binutils/
>
> 2020-03-XX H.J. Lu <hongjiu.lu@intel.com>
>
> PR ld/25617
> * NEWS: Mention --remove-section-header for objcopy and strip.
> * doc/binutils.texi: Document --remove-section-header for objcopy
> and strip.
> * objcopy.c (remove_section_header): New.
> (command_line_switch): Add OPTION_REMOVE_SECTION_HEADER.
> (strip_options): Add --remove-section-header.
> (copy_options): Likewise.
> (copy_usage): Add --remove-section-header.
> (strip_usage): Likewise.
> (copy_object): Renamed to ...
> (copy_object_1): This. Issue a warning for
> --remove-section-header on non-ELF targets.
> (copy_object): New.
> (strip_main): Handle OPTION_REMOVE_SECTION_HEADER.
> (copy_main): Likewise.
>
--
H.J.
next prev parent reply other threads:[~2020-03-08 18:07 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 [this message]
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
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=CAMe9rOpSQtgjXJKWwq9QuOw5ehE7dW0P0cek7ASkU1uWbVvkmw@mail.gmail.com \
--to=hjl.tools@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).