OLD | NEW |
1 /* Routines to help build PEI-format DLLs (Win32 etc) | 1 /* Routines to help build PEI-format DLLs (Win32 etc) |
2 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, | 2 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
3 2008, 2009 Free Software Foundation, Inc. | 3 2008, 2009 Free Software Foundation, Inc. |
4 Written by DJ Delorie <dj@cygnus.com> | 4 Written by DJ Delorie <dj@cygnus.com> |
5 | 5 |
6 This file is part of the GNU Binutils. | 6 This file is part of the GNU Binutils. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 if (!relocs[i]->howto->pc_relative | 1341 if (!relocs[i]->howto->pc_relative |
1342 && relocs[i]->howto->type != pe_details->imagebase_reloc) | 1342 && relocs[i]->howto->type != pe_details->imagebase_reloc) |
1343 { | 1343 { |
1344 bfd_vma sym_vma; | 1344 bfd_vma sym_vma; |
1345 struct bfd_symbol *sym = *relocs[i]->sym_ptr_ptr; | 1345 struct bfd_symbol *sym = *relocs[i]->sym_ptr_ptr; |
1346 | 1346 |
1347 /* Don't create relocs for undefined weak symbols. */ | 1347 /* Don't create relocs for undefined weak symbols. */ |
1348 if (sym->flags == BSF_WEAK) | 1348 if (sym->flags == BSF_WEAK) |
1349 { | 1349 { |
1350 struct bfd_link_hash_entry *blhe | 1350 struct bfd_link_hash_entry *blhe |
1351 » » » = bfd_link_hash_lookup (info->hash, sym->name, | 1351 » » » = bfd_wrapped_link_hash_lookup (abfd, info, sym->name, |
1352 FALSE, FALSE, FALSE); | 1352 FALSE, FALSE, FALSE); |
1353 » » if (!blhe || blhe->type != bfd_link_hash_defined) | 1353 » » if (blhe && blhe->type == bfd_link_hash_undefweak) |
1354 » » » continue;» » | 1354 » » » { |
| 1355 » » » /* Check aux sym and see if it is defined or not. */ |
| 1356 » » » struct coff_link_hash_entry *h, *h2; |
| 1357 » » » h = (struct coff_link_hash_entry *)blhe; |
| 1358 » » » if (h->symbol_class != C_NT_WEAK || h->numaux != 1) |
| 1359 » » » continue; |
| 1360 » » » h2 = h->auxbfd->tdata.coff_obj_data->sym_hashes |
| 1361 » » » » » » [h->aux->x_sym.x_tagndx.l]; |
| 1362 » » » /* We don't want a base reloc if the aux sym is not |
| 1363 » » » found, undefined, or if it is the constant ABS |
| 1364 » » » zero default value. (We broaden that slightly by |
| 1365 » » » not testing the value, just the section; there's |
| 1366 » » » no reason we'd want a reference to any absolute |
| 1367 » » » address to get relocated during rebasing). */ |
| 1368 » » » if (!h2 || h2->root.type == bfd_link_hash_undefined |
| 1369 » » » » || h2->root.u.def.section == &bfd_abs_section) |
| 1370 » » » continue; |
| 1371 » » » } |
| 1372 » » else if (!blhe || blhe->type != bfd_link_hash_defined) |
| 1373 » » » continue; |
1355 } | 1374 } |
1356 | 1375 |
1357 sym_vma = (relocs[i]->addend | 1376 sym_vma = (relocs[i]->addend |
1358 + sym->value | 1377 + sym->value |
1359 + sym->section->vma | 1378 + sym->section->vma |
1360 + sym->section->output_offset | 1379 + sym->section->output_offset |
1361 + sym->section->output_section->vma); | 1380 + sym->section->output_section->vma); |
1362 reloc_data[total_relocs].vma = sec_vma + relocs[i]->address; | 1381 reloc_data[total_relocs].vma = sec_vma + relocs[i]->address; |
1363 | 1382 |
1364 #define BITS_AND_SHIFT(bits, shift) (bits * 1000 | shift) | 1383 #define BITS_AND_SHIFT(bits, shift) (bits * 1000 | shift) |
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 reloc_s->contents = reloc_d; | 3183 reloc_s->contents = reloc_d; |
3165 } | 3184 } |
3166 | 3185 |
3167 bfd_boolean | 3186 bfd_boolean |
3168 pe_bfd_is_dll (bfd *abfd) | 3187 pe_bfd_is_dll (bfd *abfd) |
3169 { | 3188 { |
3170 return (bfd_get_format (abfd) == bfd_object | 3189 return (bfd_get_format (abfd) == bfd_object |
3171 && obj_pe (abfd) | 3190 && obj_pe (abfd) |
3172 && pe_data (abfd)->dll); | 3191 && pe_data (abfd)->dll); |
3173 } | 3192 } |
OLD | NEW |