summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@nildram.co.uk>2008-06-30 20:51:58 +0000
committerRichard Sandiford <rsandifo@nildram.co.uk>2008-06-30 20:51:58 +0000
commit124088016914c90e18e3382ba39116a6ff8562f2 (patch)
treef64152a448c608efe66d2770e3d662770d6fa345 /bfd
parent91fc01fd38db26176b9408aeecf8b63ed91345f8 (diff)
downloadgdb-124088016914c90e18e3382ba39116a6ff8562f2.tar.gz
bfd/
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog10
-rw-r--r--bfd/bfd-in.h5
-rw-r--r--bfd/bfd-in2.h8
-rw-r--r--bfd/elf.c1
-rw-r--r--bfd/elf32-ppc.c5
-rw-r--r--bfd/elf64-ppc.c5
-rw-r--r--bfd/syms.c3
7 files changed, 32 insertions, 5 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 3a22c3fdf4a..015a40ca43b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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):
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 036612535d8..3a3fa3f934f 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -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! */
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index f69cf078138..7ab22b55cce 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -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
diff --git a/bfd/elf.c b/bfd/elf.c
index c5da23b2885..c79c31111cd 100644
--- 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;
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 2dafde7d0d8..0ad11757909 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -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;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 06b14768bb2..727b6ac2b19 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -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;
diff --git a/bfd/syms.c b/bfd/syms.c
index 8831b9257c2..371916b9404 100644
--- a/bfd/syms.c
+++ b/bfd/syms.c
@@ -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