]> git.pld-linux.org Git - packages/crossx8664-binutils.git/blame - binutils-pr290.patch
- initial release.
[packages/crossx8664-binutils.git] / binutils-pr290.patch
CommitLineData
042033fe
JB
12004-07-29 H.J. Lu <hongjiu.lu@intel.com>
2 Nick Clifton <nickc@redhat.com>
3
4 PR 290
5 * bfd.c (_bfd_default_error_handler): Make it global.
6
7 * elf-bfd.h (elf_backend_data): Add link_order_error_handler.
8
9 * elf.c (assign_section_numbers): Cope gracefully with sections
10 which have SHF_LINK_ORDER set but no sh_link set up.
11 * elflink.c (elf_get_linked_section_vma): Likewise.
12
13 * elfxx-ia64.c (elf_backend_link_order_error_handler): New. Set
14 it to NULL.
15
16 * elfxx-target.h (elf_backend_link_order_error_handler): New.
17 Set it to _bfd_default_error_handler.
18 (elfNN_bed): Add elf_backend_link_order_error_handler.
19
20 * libbfd-in.h (_bfd_default_error_handler): New.
21
22 * libbfd.h: Regenerated.
23
24--- bfd/bfd.c.order 2004-07-03 10:00:44.000000000 -0700
25+++ bfd/bfd.c 2004-07-29 09:52:39.000000000 -0700
26@@ -408,7 +408,7 @@ static const char *_bfd_error_program_na
27
28 /* This is the default routine to handle BFD error messages. */
29
30-static void
31+void
32 _bfd_default_error_handler (const char *s, ...)
33 {
34 va_list p;
35--- bfd/elf-bfd.h.order 2004-07-28 10:50:36.000000000 -0700
36+++ bfd/elf-bfd.h 2004-07-29 09:11:12.000000000 -0700
37@@ -925,6 +925,9 @@ struct elf_backend_data
38 see elf.c. */
39 bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
40
41+ /* Used to handle bad SHF_LINK_ORDER input. */
42+ bfd_error_handler_type link_order_error_handler;
43+
44 /* Name of the PLT relocation section. */
45 const char *relplt_name;
46
47--- bfd/elf.c.order 2004-07-28 10:58:13.000000000 -0700
48+++ bfd/elf.c 2004-07-29 10:08:01.000000000 -0700
49@@ -2885,10 +2885,32 @@ assign_section_numbers (bfd *abfd)
50 int elfsec
51 = _bfd_elf_section_from_bfd_section (s->owner, s);
52 elfsec = elf_shdrp[elfsec]->sh_link;
53- BFD_ASSERT (elfsec != 0);
54- s = elf_shdrp[elfsec]->bfd_section->output_section;
55- BFD_ASSERT (s != NULL);
56- d->this_hdr.sh_link = elf_section_data (s)->this_idx;
57+ /* PR 290:
58+ The Intel C compiler generates SHT_IA_64_UNWIND with
59+ SHF_LINK_ORDER. But it doesn't set theh sh_link or
60+ sh_info fields. Hence we could get the situation
61+ where elfsec is 0. */
62+ if (elfsec == 0)
63+ {
64+ const struct elf_backend_data *bed
65+ = get_elf_backend_data (abfd);
66+ if (bed->link_order_error_handler)
67+ {
68+ char *name = bfd_get_section_ident (s);
69+ bed->link_order_error_handler
70+ (_("%s: warning: sh_link not set for section `%s'"),
71+ bfd_archive_filename (abfd),
72+ name ? name : s->name);
73+ if (name)
74+ free (name);
75+ }
76+ }
77+ else
78+ {
79+ s = elf_shdrp[elfsec]->bfd_section->output_section;
80+ BFD_ASSERT (s != NULL);
81+ d->this_hdr.sh_link = elf_section_data (s)->this_idx;
82+ }
83 break;
84 }
85 }
86--- bfd/elflink.c.order 2004-07-28 10:50:39.000000000 -0700
87+++ bfd/elflink.c 2004-07-29 10:08:03.000000000 -0700
88@@ -7220,8 +7220,32 @@ elf_get_linked_section_vma (struct bfd_l
89 elf_shdrp = elf_elfsections (s->owner);
90 elfsec = _bfd_elf_section_from_bfd_section (s->owner, s);
91 elfsec = elf_shdrp[elfsec]->sh_link;
92- s = elf_shdrp[elfsec]->bfd_section;
93- return s->output_section->vma + s->output_offset;
94+ /* PR 290:
95+ The Intel C compiler generates SHT_IA_64_UNWIND with
96+ SHF_LINK_ORDER. But it doesn't set theh sh_link or
97+ sh_info fields. Hence we could get the situation
98+ where elfsec is 0. */
99+ if (elfsec == 0)
100+ {
101+ const struct elf_backend_data *bed
102+ = get_elf_backend_data (s->owner);
103+ if (bed->link_order_error_handler)
104+ {
105+ char *name = bfd_get_section_ident (s);
106+ bed->link_order_error_handler
107+ (_("%s: warning: sh_link not set for section `%s'"),
108+ bfd_archive_filename (s->owner),
109+ name ? name : s->name);
110+ if (name)
111+ free (name);
112+ }
113+ return 0;
114+ }
115+ else
116+ {
117+ s = elf_shdrp[elfsec]->bfd_section;
118+ return s->output_section->vma + s->output_offset;
119+ }
120 }
121
122
123--- bfd/elfxx-ia64.c.order 2004-07-28 10:50:39.000000000 -0700
124+++ bfd/elfxx-ia64.c 2004-07-29 10:12:45.000000000 -0700
125@@ -4987,6 +4987,13 @@ elfNN_hpux_backend_symbol_processing (bf
126 #define elf_backend_rela_normal 1
127 #define elf_backend_special_sections elfNN_ia64_special_sections
128
129+/* FIXME: PR 290: The Intel C compiler generates SHT_IA_64_UNWIND with
130+ SHF_LINK_ORDER. But it doesn't set theh sh_link or sh_info fields.
131+ We don't want to flood users with so many error messages. We turn
132+ off the warning for now. It will be turned on later when the Intel
133+ compiler is fixed. */
134+#define elf_backend_link_order_error_handler NULL
135+
136 #include "elfNN-target.h"
137
138 /* HPUX-specific vectors. */
139--- bfd/elfxx-target.h.order 2004-07-21 19:49:34.000000000 -0700
140+++ bfd/elfxx-target.h 2004-07-29 09:53:30.000000000 -0700
141@@ -491,6 +491,10 @@
142 #define elf_backend_sign_extend_vma 0
143 #endif
144
145+#ifndef elf_backend_link_order_error_handler
146+#define elf_backend_link_order_error_handler _bfd_default_error_handler
147+#endif
148+
149 extern const struct elf_size_info _bfd_elfNN_size_info;
150
151 #ifndef INCLUDED_TARGET_FILE
152@@ -555,6 +559,7 @@ static const struct elf_backend_data elf
153 elf_backend_ecoff_debug_swap,
154 elf_backend_bfd_from_remote_memory,
155 elf_backend_plt_sym_val,
156+ elf_backend_link_order_error_handler,
157 elf_backend_relplt_name,
158 ELF_MACHINE_ALT1,
159 ELF_MACHINE_ALT2,
160--- bfd/libbfd-in.h.order 2004-07-28 10:50:39.000000000 -0700
161+++ bfd/libbfd-in.h 2004-07-29 09:54:01.000000000 -0700
162@@ -91,6 +91,7 @@ extern void *bfd_realloc
163 extern void *bfd_zmalloc
164 (bfd_size_type);
165
166+extern void _bfd_default_error_handler (const char *s, ...);
167 extern bfd_error_handler_type _bfd_error_handler;
168
169 /* These routines allocate and free things on the BFD's objalloc. */
170--- bfd/libbfd.h.order 2004-07-28 10:50:39.000000000 -0700
171+++ bfd/libbfd.h 2004-07-29 09:54:01.000000000 -0700
172@@ -96,6 +96,7 @@
173 extern void *bfd_zmalloc
174 (bfd_size_type);
175
176+extern void _bfd_default_error_handler (const char *s, ...);
177 extern bfd_error_handler_type _bfd_error_handler;
178
179 /* These routines allocate and free things on the BFD's objalloc. */
This page took 0.20033 seconds and 4 git commands to generate.