aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 8bd523a..654d2b9 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -30,8 +30,9 @@
#include "coff/internal.h"
#include "libcoff.h"
#include "safe-ctype.h"
-#include "plugin-api.h"
+#if BFD_SUPPORTS_PLUGINS
#include "plugin.h"
+#endif
/* FIXME: See bfd/peXXigen.c for why we include an architecture specific
header in generic PE code. */
@@ -3689,6 +3690,8 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool ok_object;
const char *element_name;
+ this_element->is_strip_input = 1;
+
element_name = bfd_get_filename (this_element);
/* PR binutils/17533: Do not allow directory traversal
outside of the current directory tree by archive members. */
@@ -3769,7 +3772,9 @@ copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
#if BFD_SUPPORTS_PLUGINS
/* Copy LTO IR file as unknown object. */
- if (bfd_plugin_target_p (this_element->xvec))
+ if ((!lto_sections_removed
+ && this_element->lto_type == lto_slim_ir_object)
+ || bfd_plugin_target_p (this_element->xvec))
ok_object = false;
else
#endif
@@ -3966,6 +3971,8 @@ copy_file (const char *input_filename, const char *output_filename, int ofd,
break;
}
+ ibfd->is_strip_input = 1;
+
if (bfd_check_format (ibfd, bfd_archive))
{
bool force_output_target;
@@ -5072,6 +5079,11 @@ strip_main (int argc, char *argv[])
SECTION_CONTEXT_REMOVE)
|| !!find_section_list (".llvm.lto", false,
SECTION_CONTEXT_REMOVE));
+ /* NB: Must keep .gnu.debuglto_* sections unless all GCC LTO sections
+ will be removed to avoid undefined references to symbols in GCC LTO
+ debug sections. */
+ if (!lto_sections_removed)
+ find_section_list (".gnu.debuglto_*", true, SECTION_CONTEXT_KEEP);
#endif
i = optind;