aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2010-09-22 08:01:56 +0000
committerKai Tietz <kai.tietz@onevision.com>2010-09-22 08:01:56 +0000
commitcb2f80e68a7419ff24651d89699459e6973539d5 (patch)
treeaba64993177dc36711c3f214672da170291cbe4d /bfd
parent5a53e2f2e9fbf86f1b2de94b37a7cb9c9cf9fd03 (diff)
downloadgdb-cb2f80e68a7419ff24651d89699459e6973539d5.zip
gdb-cb2f80e68a7419ff24651d89699459e6973539d5.tar.gz
gdb-cb2f80e68a7419ff24651d89699459e6973539d5.tar.bz2
2010-09-22 Kai Tietz <kai.tietz@onevision.com>
* peXXigen.c (_bfd_XXi_final_link_postscript): Add handling for setting IAT directory entry.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/peXXigen.c43
2 files changed, 48 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 469fa17..c2cd439 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-22 Kai Tietz <kai.tietz@onevision.com>
+
+ * peXXigen.c (_bfd_XXi_final_link_postscript):
+ Add handling for setting IAT directory entry.
+
2010-09-20 Richard Henderson <rth@redhat.com>
* elf64-alpha.c (elf64_alpha_howto_table): Use bfd_elf_generic_reloc.
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 8f351ba..a5b7f68 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -2373,6 +2373,49 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
result = FALSE;
}
}
+ else
+ {
+ h1 = coff_link_hash_lookup (coff_hash_table (info),
+ "__IAT_start__", FALSE, FALSE, TRUE);
+ if (h1 != NULL
+ && (h1->root.type == bfd_link_hash_defined
+ || h1->root.type == bfd_link_hash_defweak)
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ {
+ bfd_vma iat_va;
+
+ iat_va =
+ (h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset);
+
+ h1 = coff_link_hash_lookup (coff_hash_table (info),
+ "__IAT_end__", FALSE, FALSE, TRUE);
+ if (h1 != NULL
+ && (h1->root.type == bfd_link_hash_defined
+ || h1->root.type == bfd_link_hash_defweak)
+ && h1->root.u.def.section != NULL
+ && h1->root.u.def.section->output_section != NULL)
+ {
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].Size =
+ ((h1->root.u.def.value
+ + h1->root.u.def.section->output_section->vma
+ + h1->root.u.def.section->output_offset)
+ - iat_va);
+ if (pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].Size != 0)
+ pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_ADDRESS_TABLE].VirtualAddress =
+ iat_va - pe_data (abfd)->pe_opthdr.ImageBase;
+ }
+ else
+ {
+ _bfd_error_handler
+ (_("%B: unable to fill in DataDictionary[PE_IMPORT_ADDRESS_TABLE(12)]"
+ " because .idata$6 is missing"), abfd);
+ result = FALSE;
+ }
+ }
+ }
h1 = coff_link_hash_lookup (coff_hash_table (info),
"__tls_used", FALSE, FALSE, TRUE);