aboutsummaryrefslogtreecommitdiff
path: root/bfd/dwarf2.c
diff options
context:
space:
mode:
authorJim Wilson <wilson@tuliptree.org>2005-08-10 23:33:39 +0000
committerJim Wilson <wilson@tuliptree.org>2005-08-10 23:33:39 +0000
commit98b880f44fe347979ff2bb63011e4beb86101296 (patch)
treef8e7385b353466a735539ca22a15d245090bbd15 /bfd/dwarf2.c
parent38975f9eab9c0440a0863af398bc10049efe8333 (diff)
downloadgdb-98b880f44fe347979ff2bb63011e4beb86101296.zip
gdb-98b880f44fe347979ff2bb63011e4beb86101296.tar.gz
gdb-98b880f44fe347979ff2bb63011e4beb86101296.tar.bz2
Fix linker error found when compiling glibc with a mismatched gcc.
* dwarf2.c (scan_unit_for_symbols, case DT_AT_location): Verify that DW_OP_addr is only opcode in location before using it.
Diffstat (limited to 'bfd/dwarf2.c')
-rw-r--r--bfd/dwarf2.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 2635a57..1348137 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -1782,9 +1782,17 @@ scan_unit_for_symbols (struct comp_unit *unit)
if (*attr.u.blk->data == DW_OP_addr)
{
var->stack = 0;
- var->addr = bfd_get ((attr.u.blk->size - 1) * 8,
- unit->abfd,
- attr.u.blk->data + 1);
+
+ /* Verify that DW_OP_addr is the only opcode in the
+ location, in which case the block size will be 1
+ plus the address size. */
+ /* ??? For TLS variables, gcc can emit
+ DW_OP_addr <addr> DW_OP_GNU_push_tls_address
+ which we don't handle here yet. */
+ if (attr.u.blk->size == unit->addr_size + 1U)
+ var->addr = bfd_get (unit->addr_size * 8,
+ unit->abfd,
+ attr.u.blk->data + 1);
}
break;