bfd/
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 30 Jun 2008 20:51:58 +0000 (20:51 +0000)
committerRichard Sandiford <rdsandiford@googlemail.com>
Mon, 30 Jun 2008 20:51:58 +0000 (20:51 +0000)
* syms.c (BSF_SYNTHETIC): New flag.
* elf.c (_bfd_elf_get_synthetic_symtab): Set it.
* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Likewise.
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise.
* bfd-in.h (bfd_asymbol_flavour): Return bfd_target_unknown_flavour
for synthetic symbols.
* bfd-in2.h: Regenerate.

opcodes/
* mips-dis.c (_print_insn_mips): Use bfd_asymbol_flavour to check
for ELF symbols.

bfd/ChangeLog
bfd/bfd-in.h
bfd/bfd-in2.h
bfd/elf.c
bfd/elf32-ppc.c
bfd/elf64-ppc.c
bfd/syms.c
opcodes/ChangeLog
opcodes/mips-dis.c

index 3a22c3fdf4ab64e20e6b35d21a33da67a9bda89a..015a40ca43b3c9ebd1271f8ddf4c7fff64de4e69 100644 (file)
@@ -1,3 +1,13 @@
+2008-06-30  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * syms.c (BSF_SYNTHETIC): New flag.
+       * elf.c (_bfd_elf_get_synthetic_symtab): Set it.
+       * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Likewise.
+       * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise.
+       * bfd-in.h (bfd_asymbol_flavour): Return bfd_target_unknown_flavour
+       for synthetic symbols.
+       * bfd-in2.h: Regenerate.
+
 2008-06-30  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * elf32-arm.c (record_arm_to_thumb_glue, record_thumb_to_arm_glue):
index 036612535d84c1ce0c7c1f1b6913f34c9cb44246..3a3fa3f934faef49d135b02e94e8df7b458e4f6a 100644 (file)
@@ -231,7 +231,10 @@ typedef const struct reloc_howto_struct reloc_howto_type;
 #define bfd_asymbol_name(x) ((x)->name)
 /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
 #define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
+#define bfd_asymbol_flavour(x)                 \
+  (((x)->flags & BSF_SYNTHETIC) != 0           \
+   ? bfd_target_unknown_flavour                        \
+   : bfd_asymbol_bfd (x)->xvec->flavour)
 
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
index f69cf0781387a36d240bad467b08baa3109e0c71..7ab22b55cced6afd5ef2cd3238be16a97a02f78f 100644 (file)
@@ -238,7 +238,10 @@ typedef const struct reloc_howto_struct reloc_howto_type;
 #define bfd_asymbol_name(x) ((x)->name)
 /*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
 #define bfd_asymbol_bfd(x) ((x)->the_bfd)
-#define bfd_asymbol_flavour(x) (bfd_asymbol_bfd(x)->xvec->flavour)
+#define bfd_asymbol_flavour(x)                 \
+  (((x)->flags & BSF_SYNTHETIC) != 0           \
+   ? bfd_target_unknown_flavour                        \
+   : bfd_asymbol_bfd (x)->xvec->flavour)
 
 /* A canonical archive symbol.  */
 /* This is a type pun with struct ranlib on purpose!  */
@@ -4502,6 +4505,9 @@ typedef struct bfd_symbol
      with the expression tree serialized in the symbol name.  */
 #define BSF_SRELC 0x100000
 
+  /* This symbol was created by bfd_get_synthetic_symtab.  */
+#define BSF_SYNTHETIC 0x200000
+
   flagword flags;
 
   /* A pointer to the section to which this symbol is
index c5da23b2885038e3f73db98e5f5d937bb90a6a04..c79c31111cd0f652c08e96dcce92e8e3c5a5f8bd 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8785,6 +8785,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd,
         we are defining a symbol, ensure one of them is set.  */
       if ((s->flags & BSF_LOCAL) == 0)
        s->flags |= BSF_GLOBAL;
+      s->flags |= BSF_SYNTHETIC;
       s->section = plt;
       s->value = addr - plt->vma;
       s->name = names;
index 2dafde7d0d8604a1c37b3156547fb17b7b346791..0ad117579092e170d01b9bbc3e24537a400d5ac9 100644 (file)
@@ -2450,6 +2450,7 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
         we are defining a symbol, ensure one of them is set.  */
       if ((s->flags & BSF_LOCAL) == 0)
        s->flags |= BSF_GLOBAL;
+      s->flags |= BSF_SYNTHETIC;
       s->section = glink;
       s->value = stub_vma - glink->vma;
       s->name = names;
@@ -2466,7 +2467,7 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
   /* Add a symbol at the start of the glink branch table.  */
   memset (s, 0, sizeof *s);
   s->the_bfd = abfd;
-  s->flags = BSF_GLOBAL;
+  s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
   s->section = glink;
   s->value = glink_vma - glink->vma;
   s->name = names;
@@ -2480,7 +2481,7 @@ ppc_elf_get_synthetic_symtab (bfd *abfd, long symcount, asymbol **syms,
       /* Add a symbol for the glink PLT resolver.  */
       memset (s, 0, sizeof *s);
       s->the_bfd = abfd;
-      s->flags = BSF_GLOBAL;
+      s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
       s->section = glink;
       s->value = resolv_vma - glink->vma;
       s->name = names;
index 06b14768bb23776985d37c51ff62f805b8269156..727b6ac2b19895d5d692d406b75bc4d72f6ad759 100644 (file)
@@ -2954,6 +2954,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
              size_t len;
 
              *s = *syms[i];
+             s->flags |= BSF_SYNTHETIC;
              s->section = sym->section;
              s->value = sym->value + r->addend;
              s->name = names;
@@ -3124,6 +3125,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
                  if ((sec->flags & SEC_CODE) != 0)
                    s->section = sec;
                }
+             s->flags |= BSF_SYNTHETIC;
              s->value = ent - s->section->vma;
              s->name = names;
              *names++ = '.';
@@ -3145,7 +3147,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
              /* Add a symbol for the main glink trampoline.  */
              memset (s, 0, sizeof *s);
              s->the_bfd = abfd;
-             s->flags = BSF_GLOBAL;
+             s->flags = BSF_GLOBAL | BSF_SYNTHETIC;
              s->section = glink;
              s->value = resolv_vma - glink->vma;
              s->name = names;
@@ -3181,6 +3183,7 @@ ppc64_elf_get_synthetic_symtab (bfd *abfd,
                 we are defining a symbol, ensure one of them is set.  */
              if ((s->flags & BSF_LOCAL) == 0)
                s->flags |= BSF_GLOBAL;
+             s->flags |= BSF_SYNTHETIC;
              s->section = glink;
              s->value = glink_vma - glink->vma;
              s->name = names;
index 8831b9257c2609972dbfee496000d39b6a2a2ad1..371916b9404d834e6356d21b88f0f27429c80c39 100644 (file)
@@ -297,6 +297,9 @@ CODE_FRAGMENT
 .     with the expression tree serialized in the symbol name.  *}
 .#define BSF_SRELC 0x100000
 .
+.  {* This symbol was created by bfd_get_synthetic_symtab.  *}
+.#define BSF_SYNTHETIC 0x200000
+.
 .  flagword flags;
 .
 .  {* A pointer to the section to which this symbol is
index ad39ba9a0b2c162f22f385900078069d83ae6988..4925a2286702702070620ba2b55d8dbbc8ae81a7 100644 (file)
@@ -1,3 +1,8 @@
+2008-06-30  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * mips-dis.c (_print_insn_mips): Use bfd_asymbol_flavour to check
+       for ELF symbols.
+
 2008-06-25  Peter Bergner  <bergner@vnet.ibm.com>
 
        * ppc-dis.c (powerpc_init_dialect): Handle -M464.
index ada753f4f864f6c8ef4fc592a3784b1371a15653..35a51191525903913eef8c9b7b1212d16ac79106 100644 (file)
@@ -2066,8 +2066,8 @@ _print_insn_mips (bfd_vma memaddr,
 
 #if SYMTAB_AVAILABLE
   if (info->mach == bfd_mach_mips16
-      || (info->flavour == bfd_target_elf_flavour
-         && info->symbols != NULL
+      || (info->symbols != NULL
+         && bfd_asymbol_flavour (*info->symbols) == bfd_target_elf_flavour
          && ((*(elf_symbol_type **) info->symbols)->internal_elf_sym.st_other
              == STO_MIPS16)))
     return print_insn_mips16 (memaddr, info);