From: Jim Wilson Date: Wed, 10 Aug 2005 23:33:39 +0000 (+0000) Subject: Fix linker error found when compiling glibc with a mismatched gcc. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=51ff3630f0f0cdb6850e3c11e9654afe6882c073;p=pf3gnuchains%2Fpf3gnuchains3x.git 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 97c62c74ea..a7a7608d5a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2005-08-10 James E. Wilson + + * dwarf2.c (scan_unit_for_symbols, case DT_AT_location): Verify that + DW_OP_addr is only opcode in location before using it. + 2005-08-09 H.J. Lu * elfxx-ia64.c (elfNN_ia64_final_link): Reset gp. diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 2635a5739e..1348137355 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 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;