1 2004-07-29 H.J. Lu <hongjiu.lu@intel.com>
2 Nick Clifton <nickc@redhat.com>
5 * bfd.c (_bfd_default_error_handler): Make it global.
7 * elf-bfd.h (elf_backend_data): Add link_order_error_handler.
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.
13 * elfxx-ia64.c (elf_backend_link_order_error_handler): New. Set
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.
20 * libbfd-in.h (_bfd_default_error_handler): New.
22 * libbfd.h: Regenerated.
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
28 /* This is the default routine to handle BFD error messages. */
32 _bfd_default_error_handler (const char *s, ...)
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
39 bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
41 + /* Used to handle bad SHF_LINK_ORDER input. */
42 + bfd_error_handler_type link_order_error_handler;
44 /* Name of the PLT relocation section. */
45 const char *relplt_name;
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)
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;
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. */
64 + const struct elf_backend_data *bed
65 + = get_elf_backend_data (abfd);
66 + if (bed->link_order_error_handler)
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);
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;
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;
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. */
101 + const struct elf_backend_data *bed
102 + = get_elf_backend_data (s->owner);
103 + if (bed->link_order_error_handler)
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);
117 + s = elf_shdrp[elfsec]->bfd_section;
118 + return s->output_section->vma + s->output_offset;
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
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
136 #include "elfNN-target.h"
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
142 #define elf_backend_sign_extend_vma 0
145 +#ifndef elf_backend_link_order_error_handler
146 +#define elf_backend_link_order_error_handler _bfd_default_error_handler
149 extern const struct elf_size_info _bfd_elfNN_size_info;
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,
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
166 +extern void _bfd_default_error_handler (const char *s, ...);
167 extern bfd_error_handler_type _bfd_error_handler;
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
173 extern void *bfd_zmalloc
176 +extern void _bfd_default_error_handler (const char *s, ...);
177 extern bfd_error_handler_type _bfd_error_handler;
179 /* These routines allocate and free things on the BFD's objalloc. */