aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-09-15 12:18:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-09-15 12:26:43 -0700
commitc35b4e8cee990d0d1c33b631912333e623a37477 (patch)
tree1907014a7e277db93992f57fee6ff9a478d6e8fb /binutils
parent79254a5260cf49887b4017700bd75b27f483b322 (diff)
downloadgdb-users/hjl/pr22101.zip
gdb-users/hjl/pr22101.tar.gz
gdb-users/hjl/pr22101.tar.bz2
Remove invalid .dynamic section with --only-keep-debugusers/hjl/pr22101
Remove invalid .dynamic section with --only-keep-debug. bfd/ PR binutils/22101 * elf.c (rewrite_elf_program_header): Remove the segment from output if all sections in input have been removed. binutils/x PR binutils/22101 * objcopy.c (strip_main): Also remove invalid .dynamic section with --only-keep-debug. (copy_main): Likewise.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/objcopy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 23a949d..33794a0 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4206,6 +4206,8 @@ strip_main (int argc, char *argv[])
break;
case OPTION_ONLY_KEEP_DEBUG:
strip_symbols = STRIP_NONDEBUG;
+ /* Also remove invalid .dynamic section. */
+ handle_remove_section_option (".dynamic");
break;
case OPTION_KEEP_FILE_SYMBOLS:
keep_file_symbols = 1;
@@ -4582,6 +4584,8 @@ copy_main (int argc, char *argv[])
case OPTION_ONLY_KEEP_DEBUG:
strip_symbols = STRIP_NONDEBUG;
+ /* Also remove invalid .dynamic section. */
+ handle_remove_section_option (".dynamic");
break;
case OPTION_KEEP_FILE_SYMBOLS: