https://sourceware.org/bugzilla/show_bug.cgi?id=22136

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
So the problem is the invalid .dynamic section.  Can we just drop
.dynamic section with "objcopy --only-keep-debug", like this:

diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 23a949d1ad..9ca25a38ae 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -4206,6 +4206,7 @@ strip_main (int argc, char *argv[])
     break;
   case OPTION_ONLY_KEEP_DEBUG:
     strip_symbols = STRIP_NONDEBUG;
+    handle_remove_section_option (".dynamic");
     break;
   case OPTION_KEEP_FILE_SYMBOLS:
     keep_file_symbols = 1;
@@ -4582,6 +4583,7 @@ copy_main (int argc, char *argv[])

   case OPTION_ONLY_KEEP_DEBUG:
     strip_symbols = STRIP_NONDEBUG;
+    handle_remove_section_option (".dynamic");
     break;

   case OPTION_KEEP_FILE_SYMBOLS:

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to