Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/binutils/dist Fix to PR port-arm/54159.



details:   https://anonhg.NetBSD.org/src/rev/74b17698c0c6
branches:  trunk
changeset: 965013:74b17698c0c6
user:      rjs <rjs%NetBSD.org@localhost>
date:      Tue Aug 27 19:23:22 2019 +0000

description:
Fix to PR port-arm/54159.

From:

<http://mail-index.netbsd.org/tech-toolchain/2019/08/26/msg003596.html>

Pullup -9

diffstat:

 external/gpl3/binutils/dist/bfd/ChangeLog     |   8 ++++++++
 external/gpl3/binutils/dist/bfd/elf32-arm.c   |  26 ++++++--------------------
 external/gpl3/binutils/dist/include/ChangeLog |   4 ++++
 external/gpl3/binutils/dist/include/elf/arm.h |   7 -------
 4 files changed, 18 insertions(+), 27 deletions(-)

diffs (115 lines):

diff -r 8b3e90e4bd57 -r 74b17698c0c6 external/gpl3/binutils/dist/bfd/ChangeLog
--- a/external/gpl3/binutils/dist/bfd/ChangeLog Tue Aug 27 17:24:51 2019 +0000
+++ b/external/gpl3/binutils/dist/bfd/ChangeLog Tue Aug 27 19:23:22 2019 +0000
@@ -1,3 +1,11 @@
+2019-08-22  Alan Modra  <amodra%gmail.com@localhost>
+
+       * elf32-arm.c (cmse_scan): Don't use ARM_GET_SYM_CMSE_SPCL,
+       instead recognize CMSE_PREFIX in symbol name.
+       (elf32_arm_gc_mark_extra_sections): Likewise.
+       (elf32_arm_filter_cmse_symbols): Don't test ARM_GET_SYM_CMSE_SPCL.
+       (elf32_arm_swap_symbol_in): Don't invoke ARM_SET_SYM_CMSE_SPCL.
+
 2018-07-18  Nick Clifton  <nickc%redhat.com@localhost>
 
        2.31.1 Release point.
diff -r 8b3e90e4bd57 -r 74b17698c0c6 external/gpl3/binutils/dist/bfd/elf32-arm.c
--- a/external/gpl3/binutils/dist/bfd/elf32-arm.c       Tue Aug 27 17:24:51 2019 +0000
+++ b/external/gpl3/binutils/dist/bfd/elf32-arm.c       Tue Aug 27 19:23:22 2019 +0000
@@ -5930,12 +5930,12 @@
       if (i < ext_start)
        {
          cmse_sym = &local_syms[i];
-         /* Not a special symbol.  */
-         if (!ARM_GET_SYM_CMSE_SPCL (cmse_sym->st_target_internal))
-           continue;
          sym_name = bfd_elf_string_from_elf_section (input_bfd,
                                                      symtab_hdr->sh_link,
                                                      cmse_sym->st_name);
+         if (!sym_name || !CONST_STRNEQ (sym_name, CMSE_PREFIX))
+           continue;
+
          /* Special symbol with local binding.  */
          cmse_invalid = TRUE;
        }
@@ -5943,9 +5943,7 @@
        {
          cmse_hash = elf32_arm_hash_entry (sym_hashes[i - ext_start]);
          sym_name = (char *) cmse_hash->root.root.root.string;
-
-         /* Not a special symbol.  */
-         if (!ARM_GET_SYM_CMSE_SPCL (cmse_hash->root.target_internal))
+         if (!CONST_STRNEQ (sym_name, CMSE_PREFIX))
            continue;
 
          /* Special symbol has incorrect binding or type.  */
@@ -15713,7 +15711,8 @@
 
                  /* Assume it is a special symbol.  If not, cmse_scan will
                     warn about it and user can do something about it.  */
-                 if (ARM_GET_SYM_CMSE_SPCL (cmse_hash->root.target_internal))
+                 if (CONST_STRNEQ (cmse_hash->root.root.root.string,
+                                   CMSE_PREFIX))
                    {
                      cmse_sec = cmse_hash->root.root.u.def.section;
                      if (!cmse_sec->gc_mark
@@ -18303,9 +18302,6 @@
          || cmse_hash->root.type != STT_FUNC)
        continue;
 
-      if (!ARM_GET_SYM_CMSE_SPCL (cmse_hash->root.target_internal))
-       continue;
-
       syms[dst_count++] = sym;
     }
   free (cmse_name);
@@ -19628,9 +19624,6 @@
                          const void *pshn,
                          Elf_Internal_Sym *dst)
 {
-  Elf_Internal_Shdr *symtab_hdr;
-  const char *name = NULL;
-
   if (!bfd_elf32_swap_symbol_in (abfd, psrc, pshn, dst))
     return FALSE;
   dst->st_target_internal = 0;
@@ -19659,13 +19652,6 @@
   else
     ARM_SET_SYM_BRANCH_TYPE (dst->st_target_internal, ST_BRANCH_UNKNOWN);
 
-  /* Mark CMSE special symbols.  */
-  symtab_hdr = & elf_symtab_hdr (abfd);
-  if (symtab_hdr->sh_size && dst->st_size != 0)
-    name = bfd_elf_sym_name (abfd, symtab_hdr, dst, NULL);
-  if (name && CONST_STRNEQ (name, CMSE_PREFIX))
-    ARM_SET_SYM_CMSE_SPCL (dst->st_target_internal);
-
   return TRUE;
 }
 
diff -r 8b3e90e4bd57 -r 74b17698c0c6 external/gpl3/binutils/dist/include/ChangeLog
--- a/external/gpl3/binutils/dist/include/ChangeLog     Tue Aug 27 17:24:51 2019 +0000
+++ b/external/gpl3/binutils/dist/include/ChangeLog     Tue Aug 27 19:23:22 2019 +0000
@@ -1,3 +1,7 @@
+2019-08-22  Alan Modra  <amodra%gmail.com@localhost>
+
+       * elf/arm.h (ARM_GET_SYM_CMSE_SPCL, ARM_SET_SYM_CMSE_SPCL): Delete.
+
 2018-07-18  Nick Clifton  <nickc%redhat.com@localhost>
 
        2.31.1 Release point.
diff -r 8b3e90e4bd57 -r 74b17698c0c6 external/gpl3/binutils/dist/include/elf/arm.h
--- a/external/gpl3/binutils/dist/include/elf/arm.h     Tue Aug 27 17:24:51 2019 +0000
+++ b/external/gpl3/binutils/dist/include/elf/arm.h     Tue Aug 27 19:23:22 2019 +0000
@@ -392,11 +392,4 @@
           | ((TYPE) & ENUM_ARM_ST_BRANCH_TYPE_BITMASK))
 #endif
 
-/* Get or set whether a symbol is a special symbol of an entry function of CMSE
-   secure code.  */
-#define ARM_GET_SYM_CMSE_SPCL(SYM_TARGET_INTERNAL) \
-  (((SYM_TARGET_INTERNAL) >> 2) & 1)
-#define ARM_SET_SYM_CMSE_SPCL(SYM_TARGET_INTERNAL) \
-  (SYM_TARGET_INTERNAL) |= 4
-
 #endif /* _ELF_ARM_H */



Home | Main Index | Thread Index | Old Index