diff options
author | Alan Modra <amodra@gmail.com> | 2018-09-12 14:57:48 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-09-17 23:31:18 +0930 |
commit | c12d9fa2afe7abcbe407a00e15719e1a1350c2a7 (patch) | |
tree | a766a5fd206554f404b2e84ed11582b8c84d0d90 /binutils/objcopy.c | |
parent | a4b9568c7ee95891de6f5ba846f2d1aaf61569cd (diff) | |
download | gdb-c12d9fa2afe7abcbe407a00e15719e1a1350c2a7.zip gdb-c12d9fa2afe7abcbe407a00e15719e1a1350c2a7.tar.gz gdb-c12d9fa2afe7abcbe407a00e15719e1a1350c2a7.tar.bz2 |
Support objcopy --remove-section=.relaFOO
* objcopy.c (handle_remove_section_option): Don't require a dot
after .rela and .rel to handle a possible relocation section.
* testsuite/binutils-all/remove-relocs-07.s,
* testsuite/binutils-all/remove-relocs-07.d,
* testsuite/binutils-all/remove-relocs-08.d: New tests.
* testsuite/binutils-all/remove-relocs-01.d,
* testsuite/binutils-all/remove-relocs-04.d,
* testsuite/binutils-all/remove-relocs-05.d,
* testsuite/binutils-all/remove-relocs-06.d: Exclude mips64-openbsd.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 8e06cd2..2e40b42 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -3943,18 +3943,21 @@ discard_relocations (bfd *ibfd ATTRIBUTE_UNUSED, asection *isection) /* Wrapper for dealing with --remove-section (-R) command line arguments. A special case is detected here, if the user asks to remove a relocation - section (one starting with ".rela." or ".rel.") then this removal must + section (one starting with ".rela" or ".rel") then this removal must be done using a different technique in a relocatable object. */ static void handle_remove_section_option (const char *section_pattern) { - if (strncmp (section_pattern, ".rela.", 6) == 0) - handle_remove_relocations_option (section_pattern + 5); - else if (strncmp (section_pattern, ".rel.", 5) == 0) - handle_remove_relocations_option (section_pattern + 4); - find_section_list (section_pattern, TRUE, SECTION_CONTEXT_REMOVE); + if (strncmp (section_pattern, ".rel", 4) == 0) + { + section_pattern += 4; + if (*section_pattern == 'a') + section_pattern++; + if (*section_pattern) + handle_remove_relocations_option (section_pattern); + } sections_removed = TRUE; } |