From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH 5/7] binutils: Add --remove-section-header tests
Date: Sun, 8 Mar 2020 16:42:40 -0700 [thread overview]
Message-ID: <20200308234242.1225816-6-hjl.tools@gmail.com> (raw)
In-Reply-To: <20200308234242.1225816-1-hjl.tools@gmail.com>
Verify --remove-section-header with objcopy and strip is ignored for
relocatable file.
PR ld/25617
* testsuite/binutils-all/objcopy.exp: Verify
--remove-section-header ignored for relocatable file.
* testsuite/binutils-all/remove-header-1.d: New file.
---
binutils/testsuite/binutils-all/objcopy.exp | 13 +++++++++++++
| 8 ++++++++
2 files changed, 21 insertions(+)
create mode 100644 binutils/testsuite/binutils-all/remove-header-1.d
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 549b064e96..11bb8fea84 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -1115,6 +1115,13 @@ if [is_elf_format] {
run_dump_test "note-6-32"
}
run_dump_test "note-5"
+
+ set saved_OBJCOPYFLAGS $OBJCOPYFLAGS
+ append OBJCOPYFLAGS " --remove-section-header"
+
+ objcopy_test "simple copy with --remove-section-header" bintest.s
+
+ set OBJCOPYFLAGS $saved_OBJCOPYFLAGS
}
run_dump_test "copy-2"
@@ -1231,6 +1238,12 @@ if [is_elf_format] {
verbose [file rootname $t]
run_dump_test [file rootname $t]
}
+
+ # Test --remove-section-header
+ run_dump_test "remove-header-1" \
+ [list \
+ [list source strip-15${reloc_format}.s] \
+ [list as "${elf64} --defsym RELOC=${reloc}"]]
}
run_dump_test "localize-hidden-2"
--git a/binutils/testsuite/binutils-all/remove-header-1.d b/binutils/testsuite/binutils-all/remove-header-1.d
new file mode 100644
index 0000000000..60a9c407af
--- /dev/null
+++ b/binutils/testsuite/binutils-all/remove-header-1.d
@@ -0,0 +1,8 @@
+#PROG: strip
+#strip: -g --remove-section-header
+#readelf: -r
+
+Relocation section '\.rela?\.text' at offset .* contains 2 entries:
+ *Offset * Info * Type * Sym\. *Value * Sym\. *Name(?: * \+ * Addend)?
+0+00 * 0+0(?:1|b|32|103) * R_[^ ]* *(?: * 55aa)?
+#pass
--
2.24.1
next prev parent reply other threads:[~2020-03-08 23:42 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-08 23:42 [PATCH 0/7] ELF: Don't require section header on ELF objects H.J. Lu
2020-03-08 23:42 ` [PATCH 1/7] " H.J. Lu
2020-03-08 23:42 ` [PATCH 2/7] bfd: Reconstruct dynamic symbol table from PT_DYNAMIC segment H.J. Lu
2020-03-08 23:42 ` [PATCH 3/7] readelf: Compute dynamic symbol table size from hash table H.J. Lu
2020-03-08 23:42 ` [PATCH 4/7] ld: Add a simple test for -z nosectionheader H.J. Lu
2020-03-08 23:42 ` H.J. Lu [this message]
2020-03-08 23:42 ` [PATCH 6/7] ld: Add tests for -z nosectionheader and --remove-section-header H.J. Lu
2020-03-08 23:42 ` [PATCH 7/7] ld: Add -z nosectionheader test to bootstrap.exp H.J. Lu
2020-03-19 0:48 ` [PATCH 0/7] ELF: Don't require section header on ELF objects Fangrui Song
2020-03-19 1:32 ` H.J. Lu
2020-03-19 1:45 ` Kaylee Blake
2020-05-02 14:19 ` H.J. Lu
[not found] ` <06c41571-09ef-d107-ee21-38af17f6d20b@gmail.com>
2020-08-07 13:11 ` Has FSF stopped processing copyright paperwork? H.J. Lu
2020-08-07 13:28 ` Richard Biener
2020-08-14 15:25 ` Kaylee Blake
2021-04-02 13:45 ` H.J. Lu
2021-04-02 15:21 ` Mark Wielaard
2020-03-10 0:12 [PATCH 0/7] ELF: Omit section header on ELF objects H.J. Lu
2020-03-10 0:12 ` [PATCH 5/7] binutils: Add --remove-section-header tests H.J. Lu
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=20200308234242.1225816-6-hjl.tools@gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
/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).