PR ld/2729
* peXXigen.c (_bfd_XXi_final_link_postscript): Check for the existance of output sections before putting their entries into the DataDictionary.
This commit is contained in:
parent
601e61cdeb
commit
4e22f78d85
2 changed files with 86 additions and 24 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2006-07-24 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR ld/2729
|
||||||
|
* peXXigen.c (_bfd_XXi_final_link_postscript): Check for the
|
||||||
|
existance of output sections before putting their entries into the
|
||||||
|
DataDictionary.
|
||||||
|
|
||||||
2006-07-20 Thiemo Seufer <ths@mips.com>
|
2006-07-20 Thiemo Seufer <ths@mips.com>
|
||||||
|
|
||||||
* elf32-mips.c (mips16_jump_reloc): Remove function.
|
* elf32-mips.c (mips16_jump_reloc): Remove function.
|
||||||
|
|
103
bfd/peXXigen.c
103
bfd/peXXigen.c
|
@ -1950,6 +1950,7 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
|
||||||
{
|
{
|
||||||
struct coff_link_hash_entry *h1;
|
struct coff_link_hash_entry *h1;
|
||||||
struct bfd_link_info *info = pfinfo->info;
|
struct bfd_link_info *info = pfinfo->info;
|
||||||
|
bfd_boolean result = TRUE;
|
||||||
|
|
||||||
/* There are a few fields that need to be filled in now while we
|
/* There are a few fields that need to be filled in now while we
|
||||||
have symbol table access.
|
have symbol table access.
|
||||||
|
@ -1963,49 +1964,103 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
|
||||||
".idata$2", FALSE, FALSE, TRUE);
|
".idata$2", FALSE, FALSE, TRUE);
|
||||||
if (h1 != NULL)
|
if (h1 != NULL)
|
||||||
{
|
{
|
||||||
pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
|
/* PR ld/2729: We cannot rely upon all the output sections having been
|
||||||
(h1->root.u.def.value
|
created properly, so check before referencing them. Issue a warning
|
||||||
+ h1->root.u.def.section->output_section->vma
|
message for any sections tht could not be found. */
|
||||||
+ h1->root.u.def.section->output_offset);
|
if (h1->root.u.def.section != NULL
|
||||||
|
&& h1->root.u.def.section->output_section != NULL)
|
||||||
|
pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
|
||||||
|
(h1->root.u.def.value
|
||||||
|
+ h1->root.u.def.section->output_section->vma
|
||||||
|
+ h1->root.u.def.section->output_offset);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bfd_error_handler
|
||||||
|
(_("%B: unable to fill in DataDictionary[1] because .idata$2 is missing"),
|
||||||
|
abfd);
|
||||||
|
result = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
||||||
".idata$4", FALSE, FALSE, TRUE);
|
".idata$4", FALSE, FALSE, TRUE);
|
||||||
pe_data (abfd)->pe_opthdr.DataDirectory[1].Size =
|
if (h1 != NULL
|
||||||
((h1->root.u.def.value
|
&& h1->root.u.def.section != NULL
|
||||||
+ h1->root.u.def.section->output_section->vma
|
&& h1->root.u.def.section->output_section != NULL)
|
||||||
+ h1->root.u.def.section->output_offset)
|
pe_data (abfd)->pe_opthdr.DataDirectory[1].Size =
|
||||||
- pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
|
((h1->root.u.def.value
|
||||||
|
+ h1->root.u.def.section->output_section->vma
|
||||||
|
+ h1->root.u.def.section->output_offset)
|
||||||
|
- pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bfd_error_handler
|
||||||
|
(_("%B: unable to fill in DataDictionary[1] because .idata$4 is missing"),
|
||||||
|
abfd);
|
||||||
|
result = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* The import address table. This is the size/address of
|
/* The import address table. This is the size/address of
|
||||||
.idata$5. */
|
.idata$5. */
|
||||||
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
||||||
".idata$5", FALSE, FALSE, TRUE);
|
".idata$5", FALSE, FALSE, TRUE);
|
||||||
pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
|
if (h1 != NULL
|
||||||
(h1->root.u.def.value
|
&& h1->root.u.def.section != NULL
|
||||||
+ h1->root.u.def.section->output_section->vma
|
&& h1->root.u.def.section->output_section != NULL)
|
||||||
+ h1->root.u.def.section->output_offset);
|
pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
|
||||||
|
(h1->root.u.def.value
|
||||||
|
+ h1->root.u.def.section->output_section->vma
|
||||||
|
+ h1->root.u.def.section->output_offset);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bfd_error_handler
|
||||||
|
(_("%B: unable to fill in DataDictionary[12] because .idata$5 is missing"),
|
||||||
|
abfd);
|
||||||
|
result = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
||||||
".idata$6", FALSE, FALSE, TRUE);
|
".idata$6", FALSE, FALSE, TRUE);
|
||||||
pe_data (abfd)->pe_opthdr.DataDirectory[12].Size =
|
if (h1 != NULL
|
||||||
((h1->root.u.def.value
|
&& h1->root.u.def.section != NULL
|
||||||
+ h1->root.u.def.section->output_section->vma
|
&& h1->root.u.def.section->output_section != NULL)
|
||||||
+ h1->root.u.def.section->output_offset)
|
pe_data (abfd)->pe_opthdr.DataDirectory[12].Size =
|
||||||
- pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
|
((h1->root.u.def.value
|
||||||
|
+ h1->root.u.def.section->output_section->vma
|
||||||
|
+ h1->root.u.def.section->output_offset)
|
||||||
|
- pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bfd_error_handler
|
||||||
|
(_("%B: unable to fill in DataDictionary[12] because .idata$6 is missing"),
|
||||||
|
abfd);
|
||||||
|
result = FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
h1 = coff_link_hash_lookup (coff_hash_table (info),
|
||||||
"__tls_used", FALSE, FALSE, TRUE);
|
"__tls_used", FALSE, FALSE, TRUE);
|
||||||
if (h1 != NULL)
|
if (h1 != NULL)
|
||||||
{
|
{
|
||||||
pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
|
if (h1->root.u.def.section != NULL
|
||||||
(h1->root.u.def.value
|
&& h1->root.u.def.section->output_section != NULL)
|
||||||
+ h1->root.u.def.section->output_section->vma
|
pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
|
||||||
+ h1->root.u.def.section->output_offset
|
(h1->root.u.def.value
|
||||||
- pe_data (abfd)->pe_opthdr.ImageBase);
|
+ h1->root.u.def.section->output_section->vma
|
||||||
|
+ h1->root.u.def.section->output_offset
|
||||||
|
- pe_data (abfd)->pe_opthdr.ImageBase);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bfd_error_handler
|
||||||
|
(_("%B: unable to fill in DataDictionary[9] because __tls_used is missing"),
|
||||||
|
abfd);
|
||||||
|
result = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18;
|
pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we couldn't find idata$2, we either have an excessively
|
/* If we couldn't find idata$2, we either have an excessively
|
||||||
trivial program or are in DEEP trouble; we have to assume trivial
|
trivial program or are in DEEP trouble; we have to assume trivial
|
||||||
program.... */
|
program.... */
|
||||||
return TRUE;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue