• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


コミットメタ情報

リビジョン4e22f78d855c28e90d785d10a5449263df88148f (tree)
日時2006-07-25 01:51:26
作者Nick Clifton <nickc@redh...>
コミッターNick Clifton

ログメッセージ

PR ld/2729
* peXXigen.c (_bfd_XXi_final_link_postscript): Check for the existance of

output sections before putting their entries into the DataDictionary.

変更サマリ

差分

--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
1+2006-07-24 Nick Clifton <nickc@redhat.com>
2+
3+ PR ld/2729
4+ * peXXigen.c (_bfd_XXi_final_link_postscript): Check for the
5+ existance of output sections before putting their entries into the
6+ DataDictionary.
7+
18 2006-07-20 Thiemo Seufer <ths@mips.com>
29
310 * elf32-mips.c (mips16_jump_reloc): Remove function.
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1950,6 +1950,7 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
19501950 {
19511951 struct coff_link_hash_entry *h1;
19521952 struct bfd_link_info *info = pfinfo->info;
1953+ bfd_boolean result = TRUE;
19531954
19541955 /* There are a few fields that need to be filled in now while we
19551956 have symbol table access.
@@ -1963,49 +1964,103 @@ _bfd_XXi_final_link_postscript (bfd * abfd, struct coff_final_link_info *pfinfo)
19631964 ".idata$2", FALSE, FALSE, TRUE);
19641965 if (h1 != NULL)
19651966 {
1966- pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
1967- (h1->root.u.def.value
1968- + h1->root.u.def.section->output_section->vma
1969- + h1->root.u.def.section->output_offset);
1967+ /* PR ld/2729: We cannot rely upon all the output sections having been
1968+ created properly, so check before referencing them. Issue a warning
1969+ message for any sections tht could not be found. */
1970+ if (h1->root.u.def.section != NULL
1971+ && h1->root.u.def.section->output_section != NULL)
1972+ pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress =
1973+ (h1->root.u.def.value
1974+ + h1->root.u.def.section->output_section->vma
1975+ + h1->root.u.def.section->output_offset);
1976+ else
1977+ {
1978+ _bfd_error_handler
1979+ (_("%B: unable to fill in DataDictionary[1] because .idata$2 is missing"),
1980+ abfd);
1981+ result = FALSE;
1982+ }
1983+
19701984 h1 = coff_link_hash_lookup (coff_hash_table (info),
19711985 ".idata$4", FALSE, FALSE, TRUE);
1972- pe_data (abfd)->pe_opthdr.DataDirectory[1].Size =
1973- ((h1->root.u.def.value
1974- + h1->root.u.def.section->output_section->vma
1975- + h1->root.u.def.section->output_offset)
1976- - pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
1986+ if (h1 != NULL
1987+ && h1->root.u.def.section != NULL
1988+ && h1->root.u.def.section->output_section != NULL)
1989+ pe_data (abfd)->pe_opthdr.DataDirectory[1].Size =
1990+ ((h1->root.u.def.value
1991+ + h1->root.u.def.section->output_section->vma
1992+ + h1->root.u.def.section->output_offset)
1993+ - pe_data (abfd)->pe_opthdr.DataDirectory[1].VirtualAddress);
1994+ else
1995+ {
1996+ _bfd_error_handler
1997+ (_("%B: unable to fill in DataDictionary[1] because .idata$4 is missing"),
1998+ abfd);
1999+ result = FALSE;
2000+ }
19772001
19782002 /* The import address table. This is the size/address of
19792003 .idata$5. */
19802004 h1 = coff_link_hash_lookup (coff_hash_table (info),
19812005 ".idata$5", FALSE, FALSE, TRUE);
1982- pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
1983- (h1->root.u.def.value
1984- + h1->root.u.def.section->output_section->vma
1985- + h1->root.u.def.section->output_offset);
2006+ if (h1 != NULL
2007+ && h1->root.u.def.section != NULL
2008+ && h1->root.u.def.section->output_section != NULL)
2009+ pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress =
2010+ (h1->root.u.def.value
2011+ + h1->root.u.def.section->output_section->vma
2012+ + h1->root.u.def.section->output_offset);
2013+ else
2014+ {
2015+ _bfd_error_handler
2016+ (_("%B: unable to fill in DataDictionary[12] because .idata$5 is missing"),
2017+ abfd);
2018+ result = FALSE;
2019+ }
2020+
19862021 h1 = coff_link_hash_lookup (coff_hash_table (info),
19872022 ".idata$6", FALSE, FALSE, TRUE);
1988- pe_data (abfd)->pe_opthdr.DataDirectory[12].Size =
1989- ((h1->root.u.def.value
1990- + h1->root.u.def.section->output_section->vma
1991- + h1->root.u.def.section->output_offset)
1992- - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
2023+ if (h1 != NULL
2024+ && h1->root.u.def.section != NULL
2025+ && h1->root.u.def.section->output_section != NULL)
2026+ pe_data (abfd)->pe_opthdr.DataDirectory[12].Size =
2027+ ((h1->root.u.def.value
2028+ + h1->root.u.def.section->output_section->vma
2029+ + h1->root.u.def.section->output_offset)
2030+ - pe_data (abfd)->pe_opthdr.DataDirectory[12].VirtualAddress);
2031+ else
2032+ {
2033+ _bfd_error_handler
2034+ (_("%B: unable to fill in DataDictionary[12] because .idata$6 is missing"),
2035+ abfd);
2036+ result = FALSE;
2037+ }
19932038 }
19942039
19952040 h1 = coff_link_hash_lookup (coff_hash_table (info),
19962041 "__tls_used", FALSE, FALSE, TRUE);
19972042 if (h1 != NULL)
19982043 {
1999- pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
2000- (h1->root.u.def.value
2001- + h1->root.u.def.section->output_section->vma
2002- + h1->root.u.def.section->output_offset
2003- - pe_data (abfd)->pe_opthdr.ImageBase);
2044+ if (h1->root.u.def.section != NULL
2045+ && h1->root.u.def.section->output_section != NULL)
2046+ pe_data (abfd)->pe_opthdr.DataDirectory[9].VirtualAddress =
2047+ (h1->root.u.def.value
2048+ + h1->root.u.def.section->output_section->vma
2049+ + h1->root.u.def.section->output_offset
2050+ - pe_data (abfd)->pe_opthdr.ImageBase);
2051+ else
2052+ {
2053+ _bfd_error_handler
2054+ (_("%B: unable to fill in DataDictionary[9] because __tls_used is missing"),
2055+ abfd);
2056+ result = FALSE;
2057+ }
2058+
20042059 pe_data (abfd)->pe_opthdr.DataDirectory[9].Size = 0x18;
20052060 }
20062061
20072062 /* If we couldn't find idata$2, we either have an excessively
20082063 trivial program or are in DEEP trouble; we have to assume trivial
20092064 program.... */
2010- return TRUE;
2065+ return result;
20112066 }