[PATCH] objcopy: Allow --dump-section to dump an empty SEC_HAS_CONTENTS section
Fangrui Song
maskray@google.com
Sat May 2 03:29:30 GMT 2020
More information about the Binutils mailing list
Sat May 2 03:29:30 GMT 2020
- Previous message (by thread): [PATCH v2 2/2] or1k: Regenerate opcodes after removing 32-bit support
- Next message (by thread): [PATCH] objcopy: Allow --dump-section to dump an empty SEC_HAS_CONTENTS section
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
binutils
* objcopy.c (copy_object): Allow empty section.
* testsuite/binutils-all/update-section.exp: Add test.
---
binutils/objcopy.c | 6 ------
binutils/testsuite/binutils-all/update-section.exp | 4 ++++
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 738ef4c2c9..d7c57be2ea 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -3000,12 +3000,6 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
}
bfd_size_type size = bfd_section_size (osec);
- if (size == 0)
- {
- bfd_nonfatal_message (NULL, ibfd, osec,
- _("can't dump section - it is empty"));
- continue;
- }
FILE * f;
f = fopen (pdump->filename, FOPEN_WB);
diff --git a/binutils/testsuite/binutils-all/update-section.exp b/binutils/testsuite/binutils-all/update-section.exp
index 4fd6a77214..995c20e12f 100644
--- a/binutils/testsuite/binutils-all/update-section.exp
+++ b/binutils/testsuite/binutils-all/update-section.exp
@@ -82,6 +82,10 @@ foreach f [list update-1.s update-2.s update-3.s update-4.s] {
}
}
+if { ![do_objcopy update-1.o "--dump-section .text=tmpdir/empty"] } {
+ return
+}
+
if { ![do_objcopy update-1.o \
"--dump-section .foo=tmpdir/dumped-contents"]
|| ![do_objcopy update-2.o \
--
2.26.2.526.g744177e7f7-goog
- Previous message (by thread): [PATCH v2 2/2] or1k: Regenerate opcodes after removing 32-bit support
- Next message (by thread): [PATCH] objcopy: Allow --dump-section to dump an empty SEC_HAS_CONTENTS section
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list