public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/6] ELF: Strip section header in ELF objects
@ 2020-03-21  0:08 H.J. Lu
  2020-03-21  0:08 ` [PATCH 1/6] " H.J. Lu
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: H.J. Lu @ 2020-03-21  0:08 UTC (permalink / raw)
  To: binutils

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, an new objcopy and strip option, --strip-sections, to
remove ELF section header.

This patch requires:

https://sourceware.org/pipermail/binutils/2020-March/110288.html

H.J. Lu (4):
  bfd: Improve nm and objdump without section header
  binutils: Add a --strip-sections test
  ld: Add tests for -z nosectionheader and --strip-sections
  ld: Add -z nosectionheader test to bootstrap.exp

Kaylee Blake (2):
  ELF: Strip section header in ELF objects
  ld: Add a simple test for -z nosectionheader

 bfd/bfd-in2.h                                 |   8 +-
 bfd/bfd.c                                     |   8 +-
 bfd/elf-bfd.h                                 |  10 +
 bfd/elf.c                                     | 497 ++++++++++++++++++
 bfd/elfcode.h                                 |  79 ++-
 bfd/elflink.c                                 |  12 +
 bfd/elfxx-target.h                            |   6 +-
 binutils/NEWS                                 |   3 +
 binutils/doc/binutils.texi                    |  10 +
 binutils/objcopy.c                            |  35 +-
 binutils/testsuite/binutils-all/objcopy.exp   |   5 +
 .../testsuite/binutils-all/strip-sections-1.d |   5 +
 ld/NEWS                                       |   3 +
 ld/emultempl/elf.em                           |   4 +
 ld/ld.h                                       |   3 +
 ld/ld.texi                                    |   5 +
 ld/ldlang.c                                   |   4 +
 ld/lexsup.c                                   |   8 +
 ld/testsuite/ld-bootstrap/bootstrap.exp       |  10 +-
 ld/testsuite/ld-elf/no-section-header.exp     | 370 +++++++++++++
 ld/testsuite/ld-elf/nosectionheader.d         |  12 +
 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.nd   |   3 +
 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.rd   |  20 +
 .../ld-elf/pr25617-1-static-no-sec-hdr.rd     |  12 +
 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd  |   3 +
 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd  |  20 +
 ld/testsuite/ld-elf/pr25617-1a-sec-hdr.rd     |  19 +
 ld/testsuite/ld-elf/pr25617-1a.c              |  11 +
 ld/testsuite/ld-elf/pr25617-1b.c              |  15 +
 ld/testsuite/ld-elf/start-noheader.rd         |  11 +
 .../ld-elf/start-shared-noheader-gnu.rd       |  22 +
 .../ld-elf/start-shared-noheader-sysv.rd      |  22 +
 ld/testsuite/ld-elf/start-shared-noheader.nd  |   5 +
 33 files changed, 1236 insertions(+), 24 deletions(-)
 create mode 100644 binutils/testsuite/binutils-all/strip-sections-1.d
 create mode 100644 ld/testsuite/ld-elf/no-section-header.exp
 create mode 100644 ld/testsuite/ld-elf/nosectionheader.d
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.nd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-static-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a.c
 create mode 100644 ld/testsuite/ld-elf/pr25617-1b.c
 create mode 100644 ld/testsuite/ld-elf/start-noheader.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader-gnu.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader-sysv.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader.nd

-- 
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH 0/6] ELF: Strip section header in ELF objects
@ 2023-05-30 17:12 H.J. Lu
  0 siblings, 0 replies; 12+ messages in thread
From: H.J. Lu @ 2023-05-30 17:12 UTC (permalink / raw)
  To: binutils; +Cc: Kaylee Blake

Section header isn't mandatory on ELF executable nor shared library.
This patch set adds a new linker option, -z nosectionheader, to omit ELF
section header, an new objcopy and strip option, --strip-sections, to
remove ELF section header.

H.J. Lu (4):
  bfd: Improve nm and objdump without section header
  binutils: Add a --strip-sections test
  ld: Add tests for -z nosectionheader and --strip-sections
  ld: Add -z nosectionheader test to bootstrap.exp

Kaylee Blake (2):
  ELF: Strip section header in ELF objects
  ld: Add a simple test for -z nosectionheader

 bfd/bfd-in2.h                                 |   6 +-
 bfd/bfd.c                                     |   6 +-
 bfd/elf-bfd.h                                 |  15 +
 bfd/elf.c                                     | 738 ++++++++++++++++--
 bfd/elfcode.h                                 |  91 ++-
 bfd/elflink.c                                 |  12 +
 bfd/elfxx-target.h                            |   4 +-
 binutils/NEWS                                 |   5 +-
 binutils/doc/binutils.texi                    |  10 +
 binutils/objcopy.c                            |  33 +-
 binutils/testsuite/binutils-all/objcopy.exp   |   5 +
 .../testsuite/binutils-all/strip-sections-1.d |   5 +
 ld/NEWS                                       |   3 +
 ld/emultempl/elf.em                           |   4 +
 ld/ld.h                                       |   3 +
 ld/ld.texi                                    |   5 +
 ld/ldlang.c                                   |   4 +
 ld/lexsup.c                                   |   8 +
 ld/testsuite/ld-bootstrap/bootstrap.exp       |  10 +-
 ld/testsuite/ld-elf/hash-2.d                  |  11 +
 ld/testsuite/ld-elf/no-section-header.exp     | 370 +++++++++
 ld/testsuite/ld-elf/nosectionheader.d         |  12 +
 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.nd   |   3 +
 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.rd   |  20 +
 .../ld-elf/pr25617-1-static-no-sec-hdr.rd     |  12 +
 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd  |   3 +
 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd  |  20 +
 ld/testsuite/ld-elf/pr25617-1a-sec-hdr.rd     |  19 +
 ld/testsuite/ld-elf/pr25617-1a.c              |  11 +
 ld/testsuite/ld-elf/pr25617-1b.c              |  15 +
 ld/testsuite/ld-elf/start-noheader.rd         |  11 +
 .../ld-elf/start-shared-noheader-gnu.rd       |  22 +
 .../ld-elf/start-shared-noheader-sysv.rd      |  22 +
 ld/testsuite/ld-elf/start-shared-noheader.nd  |   5 +
 34 files changed, 1439 insertions(+), 84 deletions(-)
 create mode 100644 binutils/testsuite/binutils-all/strip-sections-1.d
 create mode 100644 ld/testsuite/ld-elf/hash-2.d
 create mode 100644 ld/testsuite/ld-elf/no-section-header.exp
 create mode 100644 ld/testsuite/ld-elf/nosectionheader.d
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.nd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-static-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a.c
 create mode 100644 ld/testsuite/ld-elf/pr25617-1b.c
 create mode 100644 ld/testsuite/ld-elf/start-noheader.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader-gnu.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader-sysv.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader.nd

-- 
2.40.1


^ permalink raw reply	[flat|nested] 12+ messages in thread
* [PATCH 0/6] ELF: Strip section header in ELF objects
@ 2023-05-30 17:12 H.J. Lu
  2023-05-30 18:45 ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: H.J. Lu @ 2023-05-30 17:12 UTC (permalink / raw)
  To: binutils; +Cc: Kaylee Blake

Section header isn't mandatory on ELF executable nor shared library.
This patch set adds a new linker option, -z nosectionheader, to omit ELF
section header, an new objcopy and strip option, --strip-sections, to
remove ELF section header.

H.J. Lu (4):
  bfd: Improve nm and objdump without section header
  binutils: Add a --strip-sections test
  ld: Add tests for -z nosectionheader and --strip-sections
  ld: Add -z nosectionheader test to bootstrap.exp

Kaylee Blake (2):
  ELF: Strip section header in ELF objects
  ld: Add a simple test for -z nosectionheader

 bfd/bfd-in2.h                                 |   6 +-
 bfd/bfd.c                                     |   6 +-
 bfd/elf-bfd.h                                 |  15 +
 bfd/elf.c                                     | 738 ++++++++++++++++--
 bfd/elfcode.h                                 |  91 ++-
 bfd/elflink.c                                 |  12 +
 bfd/elfxx-target.h                            |   4 +-
 binutils/NEWS                                 |   5 +-
 binutils/doc/binutils.texi                    |  10 +
 binutils/objcopy.c                            |  33 +-
 binutils/testsuite/binutils-all/objcopy.exp   |   5 +
 .../testsuite/binutils-all/strip-sections-1.d |   5 +
 ld/NEWS                                       |   3 +
 ld/emultempl/elf.em                           |   4 +
 ld/ld.h                                       |   3 +
 ld/ld.texi                                    |   5 +
 ld/ldlang.c                                   |   4 +
 ld/lexsup.c                                   |   8 +
 ld/testsuite/ld-bootstrap/bootstrap.exp       |  10 +-
 ld/testsuite/ld-elf/hash-2.d                  |  11 +
 ld/testsuite/ld-elf/no-section-header.exp     | 370 +++++++++
 ld/testsuite/ld-elf/nosectionheader.d         |  12 +
 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.nd   |   3 +
 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.rd   |  20 +
 .../ld-elf/pr25617-1-static-no-sec-hdr.rd     |  12 +
 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd  |   3 +
 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd  |  20 +
 ld/testsuite/ld-elf/pr25617-1a-sec-hdr.rd     |  19 +
 ld/testsuite/ld-elf/pr25617-1a.c              |  11 +
 ld/testsuite/ld-elf/pr25617-1b.c              |  15 +
 ld/testsuite/ld-elf/start-noheader.rd         |  11 +
 .../ld-elf/start-shared-noheader-gnu.rd       |  22 +
 .../ld-elf/start-shared-noheader-sysv.rd      |  22 +
 ld/testsuite/ld-elf/start-shared-noheader.nd  |   5 +
 34 files changed, 1439 insertions(+), 84 deletions(-)
 create mode 100644 binutils/testsuite/binutils-all/strip-sections-1.d
 create mode 100644 ld/testsuite/ld-elf/hash-2.d
 create mode 100644 ld/testsuite/ld-elf/no-section-header.exp
 create mode 100644 ld/testsuite/ld-elf/nosectionheader.d
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.nd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1-static-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a-sec-hdr.rd
 create mode 100644 ld/testsuite/ld-elf/pr25617-1a.c
 create mode 100644 ld/testsuite/ld-elf/pr25617-1b.c
 create mode 100644 ld/testsuite/ld-elf/start-noheader.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader-gnu.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader-sysv.rd
 create mode 100644 ld/testsuite/ld-elf/start-shared-noheader.nd

-- 
2.40.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-06-01 18:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-21  0:08 [PATCH 0/6] ELF: Strip section header in ELF objects H.J. Lu
2020-03-21  0:08 ` [PATCH 1/6] " H.J. Lu
2020-03-21  0:08 ` [PATCH 2/6] bfd: Improve nm and objdump without section header H.J. Lu
2020-03-21  0:08 ` [PATCH 3/6] ld: Add a simple test for -z nosectionheader H.J. Lu
2020-03-21  0:08 ` [PATCH 4/6] binutils: Add a --strip-sections test H.J. Lu
2020-03-21  0:08 ` [PATCH 5/6] ld: Add tests for -z nosectionheader and --strip-sections H.J. Lu
2020-03-21  0:08 ` [PATCH 6/6] ld: Add -z nosectionheader test to bootstrap.exp H.J. Lu
2023-05-30 17:12 [PATCH 0/6] ELF: Strip section header in ELF objects H.J. Lu
2023-05-30 17:12 H.J. Lu
2023-05-30 18:45 ` Andreas Schwab
2023-05-30 18:51   ` H.J. Lu
2023-06-01 18:24     ` Fangrui Song

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).