2006-05-15 Paul Brook <paul@codesourcery.com>
authorPaul Brook <paul@codesourcery.com>
Mon, 15 May 2006 19:57:35 +0000 (19:57 +0000)
committerPaul Brook <paul@codesourcery.com>
Mon, 15 May 2006 19:57:35 +0000 (19:57 +0000)
bfd/
* cpu-arm.c (bfd_is_arm_mapping_symbol_name): Rename ...
(bfd_is_arm_special_symbol_name): ... to this.  Add type argument.
Check symbol name is of specified type.
* elf32-arm.c (elf32_arm_is_target_special_symbol,
arm_elf_find_function, elf32_arm_output_symbol_hook): Use
bfd_is_arm_special_symbol_name.
* bfd-in.h (BFD_ARM_SPECIAL_SYM_TYPE_MAP,
BFD_ARM_SPECIAL_SYM_TYPE_TAG, BFD_ARM_SPECIAL_SYM_TYPE_OTHER,
BFD_ARM_SPECIAL_SYM_TYPE_ANY): Define.
(bfd_is_arm_mapping_symbol_name): Remove prototype.
(bfd_is_arm_special_symbol_name): Add prototype.
* bfd-in2.h: Regenerate.
gas/
* config/tc-arm.c (arm_adjust_symtab): Use
bfd_is_arm_special_symbol_name.
ld/testsuite/
* ld-arm/arm-be8.d: New test.
* ld-arm/arm-be8.s: New test.
* ld-arm/arm-elf.exp: Add arm-be8.

bfd/ChangeLog
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/cpu-arm.c
bfd/elf32-arm.c
gas/ChangeLog
gas/config/tc-arm.c
ld/testsuite/ChangeLog
ld/testsuite/ld-arm/arm-be8.d [new file with mode: 0644]
ld/testsuite/ld-arm/arm-be8.s [new file with mode: 0644]
ld/testsuite/ld-arm/arm-elf.exp

index 16fb6bab2f491daf65c8f8a5dc8db4c9acb3d167..fda25296d95ac675efc9821c922f6b06da42297e 100644 (file)
@@ -1,3 +1,18 @@
+2006-05-15  Paul Brook  <paul@codesourcery.com>
+
+       * cpu-arm.c (bfd_is_arm_mapping_symbol_name): Rename ...
+       (bfd_is_arm_special_symbol_name): ... to this.  Add type argument.
+       Check symbol name is of specified type.
+       * elf32-arm.c (elf32_arm_is_target_special_symbol,
+       arm_elf_find_function, elf32_arm_output_symbol_hook): Use
+       bfd_is_arm_special_symbol_name.
+       * bfd-in.h (BFD_ARM_SPECIAL_SYM_TYPE_MAP,
+       BFD_ARM_SPECIAL_SYM_TYPE_TAG, BFD_ARM_SPECIAL_SYM_TYPE_OTHER,
+       BFD_ARM_SPECIAL_SYM_TYPE_ANY): Define.
+       (bfd_is_arm_mapping_symbol_name): Remove prototype.
+       (bfd_is_arm_special_symbol_name): Add prototype.
+       * bfd-in2.h: Regenerate.
+
 2006-05-15  David Heine  <dlheine@tensilica.com>
            Bob Wilson  <bob.wilson@acm.org>
 
index 5c2f05dce39f688a424ad897ad3ea175399141c3..ff9dcd604fa8cd37c1f1a4c946de5220386646e0 100644 (file)
@@ -850,8 +850,12 @@ extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
   (bfd *, struct bfd_link_info *);
 
 /* ELF ARM mapping symbol support */
-extern bfd_boolean bfd_is_arm_mapping_symbol_name
-  (const char * name);
+#define BFD_ARM_SPECIAL_SYM_TYPE_MAP   (1 << 0)
+#define BFD_ARM_SPECIAL_SYM_TYPE_TAG   (1 << 1)
+#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER  (1 << 2)
+#define BFD_ARM_SPECIAL_SYM_TYPE_ANY   (~0)
+extern bfd_boolean bfd_is_arm_special_symbol_name
+  (const char * name, int type);
 
 /* ARM Note section processing.  */
 extern bfd_boolean bfd_arm_merge_machines
index 5ba74d2838812a7754cf6c90248f1c8a23420b4a..cc3d35e2d6400bad9a5eb3546457fffc68a21537 100644 (file)
@@ -857,8 +857,12 @@ extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
   (bfd *, struct bfd_link_info *);
 
 /* ELF ARM mapping symbol support */
-extern bfd_boolean bfd_is_arm_mapping_symbol_name
-  (const char * name);
+#define BFD_ARM_SPECIAL_SYM_TYPE_MAP   (1 << 0)
+#define BFD_ARM_SPECIAL_SYM_TYPE_TAG   (1 << 1)
+#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER  (1 << 2)
+#define BFD_ARM_SPECIAL_SYM_TYPE_ANY   (~0)
+extern bfd_boolean bfd_is_arm_special_symbol_name
+  (const char * name, int type);
 
 /* ARM Note section processing.  */
 extern bfd_boolean bfd_arm_merge_machines
index 0f0da060976d886d41949ef5cefd4aca5b475860..5c89296c08a5d37a320c4086548bed26f8c99cb5 100644 (file)
@@ -402,14 +402,22 @@ bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section)
 }
 
 bfd_boolean
-bfd_is_arm_mapping_symbol_name (const char * name)
+bfd_is_arm_special_symbol_name (const char * name, int type)
 {
   /* The ARM compiler outputs several obsolete forms.  Recognize them
      in addition to the standard $a, $t and $d.  We are somewhat loose
      in what we accept here, since the full set is not documented.  */
-  return (name != NULL)
-    && (name[0] == '$')
-    && (name[1] >= 'a' && name[1] <= 'z')
-    && (name[2] == 0 || name[2] == '.');
+  if (!name || name[0] != '$')
+    return FALSE;
+  if (name[1] == 'a' || name[1] == 't' || name[1] == 'd')
+    type &= BFD_ARM_SPECIAL_SYM_TYPE_MAP;
+  else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p')
+    type &= BFD_ARM_SPECIAL_SYM_TYPE_TAG;
+  else if (name[1] >= 'a' && name[1] <= 'z')
+    type &= BFD_ARM_SPECIAL_SYM_TYPE_OTHER;
+  else
+    return FALSE;
+
+  return (type != 0 && (name[2] == 0 || name[2] == '.'));
 }
 
index e0a5abece328eddb6d93655952364c2ecffd609f..151f81ce8eca2367d9dacf65b772b890096f772b 100644 (file)
@@ -6110,7 +6110,8 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
 static bfd_boolean
 elf32_arm_is_target_special_symbol (bfd * abfd ATTRIBUTE_UNUSED, asymbol * sym)
 {
-  return bfd_is_arm_mapping_symbol_name (sym->name);
+  return bfd_is_arm_special_symbol_name (sym->name,
+                                        BFD_ARM_SPECIAL_SYM_TYPE_ANY);
 }
 
 /* This is a copy of elf_find_function() from elf.c except that
@@ -6146,9 +6147,10 @@ arm_elf_find_function (bfd *         abfd ATTRIBUTE_UNUSED,
        case STT_FUNC:
        case STT_ARM_TFUNC:
        case STT_NOTYPE:
-         /* Skip $a and $t symbols.  */
+         /* Skip mapping symbols.  */
          if ((q->symbol.flags & BSF_LOCAL)
-             && bfd_is_arm_mapping_symbol_name (q->symbol.name))
+             && bfd_is_arm_special_symbol_name (q->symbol.name,
+                   BFD_ARM_SPECIAL_SYM_TYPE_ANY))
            continue;
          /* Fall through.  */
          if (bfd_get_section (&q->symbol) == section
@@ -7879,7 +7881,7 @@ elf32_arm_output_symbol_hook (struct bfd_link_info *info,
     return TRUE;
 
   /* We only want mapping symbols.  */
-  if (! bfd_is_arm_mapping_symbol_name (name))
+  if (!bfd_is_arm_special_symbol_name (name, BFD_ARM_SPECIAL_SYM_TYPE_MAP))
     return TRUE;
 
   /* If this section has not been allocated an _arm_elf_section_data
index 60358aab71ae7afe7b2c0d2cca387bfad310a1f3..1b9b1dd941f020f54bfe4a605d3c2bba3e5de4b8 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-15  Paul Brook  <paul@codesourcery.com>
+
+       * config/tc-arm.c (arm_adjust_symtab): Use
+       bfd_is_arm_special_symbol_name.
+
 2006-05-15  Bob Wilson  <bob.wilson@acm.org>
 
        * config/tc-xtensa.c (is_direct_call_opcode, is_branch_jmp_to_next,
index 8d19407db68b85a07f0d9311c349d7ac23b30e2e..a63b3da05158783455b493080754cb9e7d58ba7d 100644 (file)
@@ -17353,7 +17353,8 @@ arm_adjust_symtab (void)
          elf_sym = elf_symbol (symbol_get_bfdsym (sym));
          bind = ELF_ST_BIND (elf_sym->internal_elf_sym.st_info);
 
-         if (! bfd_is_arm_mapping_symbol_name (elf_sym->symbol.name))
+         if (! bfd_is_arm_special_symbol_name (elf_sym->symbol.name,
+               BFD_ARM_SPECIAL_SYM_TYPE_ANY))
            {
              /* If it's a .thumb_func, declare it as so,
                 otherwise tag label as .code 16.  */
index b00d58c75dfe6460e954e5bc36b1b21c6bfcae9b..118af821c9316b816a0159446f38e2d506148d4d 100644 (file)
@@ -1,3 +1,9 @@
+2006-05-15  Paul Brook  <paul@codesourcery.com>
+
+       * ld-arm/arm-be8.d: New test.
+       * ld-arm/arm-be8.s: New test.
+       * ld-arm/arm-elf.exp: Add arm-be8.
+
 2006-05-14  H.J. Lu  <hongjiu.lu@intel.com>
 
        * ld-elf/stab.d: Skip ia64-*-*.
diff --git a/ld/testsuite/ld-arm/arm-be8.d b/ld/testsuite/ld-arm/arm-be8.d
new file mode 100644 (file)
index 0000000..43ce9b0
--- /dev/null
@@ -0,0 +1,8 @@
+
+.*:     file format.*
+
+Contents of section .text:
+ 8000 0000a0e3 1eff2fe1 c0467047 fff7fcff .*
+ 8010 12345678                            .*
+# Ignore .ARM.attributes section
+#...
diff --git a/ld/testsuite/ld-arm/arm-be8.s b/ld/testsuite/ld-arm/arm-be8.s
new file mode 100644 (file)
index 0000000..871b691
--- /dev/null
@@ -0,0 +1,14 @@
+.arch armv6
+.text
+arm:
+mov r0, #0
+$m:
+bx lr
+.thumb
+.thumb_func
+thumb:
+nop
+bx lr
+bl thumb
+data:
+.word 0x12345678
index 04aa09cf49d6388968e928c12a15a5524219356f..eedbe1010645698a757f3feee314a9b4a3c0b976 100644 (file)
@@ -125,6 +125,9 @@ set armelftests {
     {"MOVW/MOVT" "-static -T arm.ld" "" {arm-movwt.s}
      {{objdump -dw arm-movwt.d}}
      "arm-movwt"}
+    {"BE8 Mapping Symbols" "-static -T arm.ld -EB --be8" "-EB" {arm-be8.s}
+     {{objdump -s arm-be8.d}}
+     "arm-be8"}
 }
 
 run_ld_link_tests $armelftests