aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-06-28 13:22:49 +0100
committerNick Clifton <nickc@redhat.com>2016-06-28 13:22:49 +0100
commitfca2a38fdb391f810e309a12d5279047d4edac34 (patch)
treed58949ac31814d76712f1b4928493cc4dcca629c
parent8b9a915daf91027050ad7145853ce8874034e60b (diff)
downloadgdb-fca2a38fdb391f810e309a12d5279047d4edac34.zip
gdb-fca2a38fdb391f810e309a12d5279047d4edac34.tar.gz
gdb-fca2a38fdb391f810e309a12d5279047d4edac34.tar.bz2
Mark ARM mapping symbols in object files are precious, so that strip will not remove them.
* elf32-arm.c (elf32_arm_backend_symbol_processing): New function. Marks mapping symbols in object files as precious, so that strip will not remove them. (elf_backend_symbol_processing): Define.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf32-arm.c19
2 files changed, 26 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 52b26fc..68d81c0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2016-06-28 Nick Clifton <nickc@redhat.com>
+
+ * elf32-arm.c (elf32_arm_backend_symbol_processing): New
+ function. Marks mapping symbols in object files as precious, so
+ that strip will not remove them.
+ (elf_backend_symbol_processing): Define.
+
2016-06-28 James Clarke <jrtc27@jrtc27.com>
* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Don't convert
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index a7964c1..04e776c 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -18266,6 +18266,24 @@ elf32_arm_copy_special_section_fields (const bfd *ibfd ATTRIBUTE_UNUSED,
return FALSE;
}
+/* Make sure that mapping symbols in object files are not removed via the
+ "strip --strip-unneeded" tool. These symbols are needed in order to
+ correctly generate interworking veneers, and for byte swapping code
+ regions. Once an object file has been linked, it is safe to remove the
+ symbols as they will no longer be needed. */
+
+static void
+elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
+{
+ if (((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
+ && sym->name != NULL
+ && sym->section != bfd_abs_section_ptr
+ && (strcmp (sym->name, "$a") == 0
+ || strcmp (sym->name, "$t") == 0
+ || strcmp (sym->name, "$d") == 0))
+ sym->flags |= BSF_KEEP;
+}
+
#undef elf_backend_copy_special_section_fields
#define elf_backend_copy_special_section_fields elf32_arm_copy_special_section_fields
@@ -18324,6 +18342,7 @@ elf32_arm_copy_special_section_fields (const bfd *ibfd ATTRIBUTE_UNUSED,
#define elf_backend_begin_write_processing elf32_arm_begin_write_processing
#define elf_backend_add_symbol_hook elf32_arm_add_symbol_hook
#define elf_backend_count_additional_relocs elf32_arm_count_additional_relocs
+#define elf_backend_symbol_processing elf32_arm_backend_symbol_processing
#define elf_backend_can_refcount 1
#define elf_backend_can_gc_sections 1