bfd/
[platform/upstream/binutils.git] / bfd / ChangeLog
1 2008-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
2
3         PR 6893 - Do not consider FDEs for discarded sections as invalid.
4         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): New REQUIRE_CLEARED_RELOCS.
5         Consider FDEs with cleared relocations as valid and ignorable.
6
7 2008-09-16  H.J. Lu  <hongjiu.lu@intel.com>
8
9         PR ld/6877
10         * elflink.c (_bfd_elf_merge_symbol): Allow a common symbol to
11         override the function in a shared library.
12
13 2008-09-16  Alan Modra  <amodra@bigpond.net.au>
14
15         PR 6844
16         * elf32-ppc.c (SYM_VAL): Define.  Use throughout to find symbol vma.
17         (ppc_elf_relocate_section): Correct GOT offset calculation.
18         (ppc_elf_finish_dynamic_symbol): Use PPC_HA and PPC_LO.
19         (ppc_elf_finish_dynamic_sections): Likewise.  Error if
20         htab->elf.hgot symbol is not defined in htab->got section.
21
22 2008-09-16  Alan Modra  <amodra@bigpond.net.au>
23
24         PR 6888
25         * elf32-ppc.c (ppc_elf_relocate_section): Handle NULL symbol section
26         on R_PPC_TOC16, R_PPC_SDAREL16, R_PPC_EMB_SDA2REL, R_PPC_EMB_SDA21,
27         R_PPC_EMB_RELSDA, R_PPC_SECTOFF* relocs.
28
29 2008-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
30
31         Fix loading large elf64 binaries on 32bit hosts.
32         * configure.in: Call AC_SYS_LARGEFILE.
33         * config.in: Regenerate.
34         * configure: Regenerate.
35
36 2008-09-08  Tom Tromey  <tromey@redhat.com>
37
38         * elfxx-mips.c (mips16_stub_symndx) <sec>: Mark argument as
39         unused.
40
41 2008-09-08  H.J. Lu  <hongjiu.lu@intel.com>
42             Daniel Jacobowitz  <dan@codesourcery.com>
43
44         PR ld/3191
45         * dwarf2.c (struct adjusted_section): Renamed from struct
46         loadable_section.
47         (struct dwarf2_debug): Adjust for renaming.  Add version field.
48         (read_attribute_value): Correctly handle DW_FORM_ref_addr for
49         DWARF3.
50         (find_abstract_instance_name): Pass a pointer to
51         attribute instead of offset.  For DW_FORM_ref_addr, get the
52         entry at the offset from the .debug_info section.
53         (scan_unit_for_symbols): Update.
54         (parse_comp_unit): Allow DWARF3.  Save the version.
55         (unset_sections): Update for renaming.
56         (place_sections): Likewise.  Set new VMAs for DWARF sections
57         also.
58
59 2008-09-08  Tristan Gingold  <gingold@adacore.com>
60
61         * configure.in: Update version to 2.19.50
62         * configure: Regenerated.
63
64 2008-09-05  Daniel Jacobowitz  <dan@codesourcery.com>
65
66         * dwarf2.c: Change leading whitespace to tabs.
67
68 2008-09-05  Tristan Gingold  <gingold@adacore.com>
69
70         Add MacOSX 64 bits support.
71         * mach-o.h (bfd_mach_o_ppc_thread_flavour): Add
72         BFD_MACH_O_PPC_THREAD_STATE_64.
73         (bfd_mach_o_i386_thread_flavour): Add BFD_MACH_O_x86_THREAD_STATE64,
74         BFD_MACH_O_x86_FLOAT_STATE64, BFD_MACH_O_x86_EXCEPTION_STATE64,
75         BFD_MACH_O_x86_THREAD_STATE, BFD_MACH_O_x86_FLOAT_STATE,
76         BFD_MACH_O_x86_EXCEPTION_STATE.
77         (bfd_mach_o_load_command_type): Add
78         BFD_MACH_O_LC_SEGMENT_64, BFD_MACH_O_LC_ROUTINES_64,
79         BFD_MACH_O_LC_UUID.     
80         (BFD_MACH_O_CPU_IS64BIT): Added.
81         (bfd_mach_o_cpu_type): Add BFD_MACH_O_CPU_TYPE_POWERPC_64,
82         BFD_MACH_O_CPU_TYPE_X86_64.
83         (bfd_mach_o_header): Add version field.
84         (bfd_mach_o_section) Add reserved3 field.
85         (bfd_mach_o_segment_command): Add initprot and maxprot fields.
86
87         * mach-o.c (N_TEXT, N_DATA, N_BSS): Added.
88         (bfd_mach_o_version): New function.
89         (bfd_mach_o_valid): Handle 64bits cpus.
90         (bfd_mach_o_write_header): handler 64bits headers.
91         (bfd_mach_o_scan_write_section_32, bfd_mach_o_scan_write_section_64):
92         New functions (from bfd_mach_o_scan_write_section) to handle both
93         flavors.
94         (bfd_mach_o_scan_write_segment): Parameter wide added to support
95         both flavors.
96         (bfd_mach_o_write_contents): Support both flavors.
97         (bfd_mach_o_read_header): Ditto.
98         (bfd_mach_o_scan_read_section_32, bfd_mach_o_scan_read_section_64):
99         New functions (from bfd_mach_o_scan_read_section) to support both
100         flavors.
101         (bfd_mach_o_scan_read_symtab_symbol): Support both flavors.
102         (bfd_mach_o_scan_read_symtab): Ditto.
103         (bfd_mach_o_scan_read_segment): Parameter wide added to support
104         both flavors.
105         (bfd_mach_o_scan_read_segment_32, bfd_mach_o_scan_read_segment_64):
106         New functions to call bfd_mach_o_scan_read_segment.
107         (bfd_mach_o_flatten_sections): Support both flavors.
108         (bfd_mach_o_scan_start_address): Ditto.
109         (bfd_mach_o_scan): Ditto.
110         (bfd_mach_o_lookup_section): Ditto.
111         
112 2008-08-27  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
113
114         * elf-hppa.h (elf_hppa_reloc_final_type): Handle R_PARISC_GPREL64,
115         R_PARISC_SEGREL32 and R_PARISC_SEGREL64.
116         * som.c (som_fixup_formats): Add R_DATA_GPREL fixup.
117         (som_hppa_howto_table): Likewise.
118         (hppa_som_gen_reloc_type): In case R_HPPA_GOTOFF, detect R_DATA_GPREL
119         final type.
120         (som_write_fixups): Handle R_DATA_GPREL.
121
122 2008-08-26  Nick Clifton  <nickc@redhat.com>
123
124         * elf32-arm.c: Fix up comment describing Thumb to ARM interworking
125         stub.
126
127 2008-08-25  Christophe Lyon  <christophe.lyon@st.com>
128
129         * elf32-arm.c (arm_thumb_arm_v4t_short_branch_stub): Define.
130         (elf32_arm_stub_type): Add arm_thumb_arm_v4t_stub_short_branch.
131         (arm_type_of_stub): Handle armv4t short branches. Update
132         prototype.
133         (arm_stub_is_thumb): Handle arm_thumb_arm_v4t_stub_short_branch.
134         (arm_build_one_stub): Likewise.
135         (arm_size_one_stub): Likewise.
136         (elf32_arm_size_stubs): Use new arm_type_of_stub prototype.
137         (arm_map_one_stub): Handle arm_thumb_arm_v4t_stub_short_branch.
138
139 2008-08-24  Andreas Schwab  <schwab@suse.de>
140
141         * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Do proper
142         extension when calculating difference of offsets.
143
144 2008-08-24  Alan Modra  <amodra@bigpond.net.au>
145
146         * configure.in: Update a number of obsolete autoconf macros.
147         * aclocal.m4: Regenerate.
148
149 2008-08-23  Andreas Schwab  <schwab@suse.de>
150
151         * opncls.c (find_separate_debug_file): Use the canonical
152         absolute name of the bfd object for finding the debug file in
153         the global debugfile directory.
154
155 2008-08-22  Jakub Jelinek  <jakub@redhat.com>
156
157         Fix PR ld/3290 regression for cross-files DW_FORM_ref_addr relocations.
158         * elflink.c (elf_link_add_object_symbols): Make debug symbols local
159         now only for non-RELOCATABLE targets.
160
161 2008-08-20  Bob Wilson  <bob.wilson@acm.org>
162
163         * elf-bfd.h (elf_object_id): Add XTENSA_ELF_TDATA.
164         * elf32-xtensa.c (elf_howto_table): Add TLS relocations.
165         (elf_xtensa_reloc_type_lookup): Likewise.
166         (TCB_SIZE): Define.
167         (elf_xtensa_link_hash_entry): New.
168         (GOT_UNKNOWN, GOT_NORMAL, GOT_TLS_GD, GOT_TLS_IE, GOT_TLS_ANY): Define.
169         (elf_xtensa_hash_entry): Define.
170         (elf_xtensa_obj_tdata): New.
171         (elf_xtensa_tdata): Define.
172         (elf_xtensa_local_got_tls_type): Define.
173         (elf_xtensa_local_tlsfunc_refcounts): Define.
174         (is_xtensa_elf): Define.
175         (elf_xtensa_mkobject): New.
176         (elf_xtensa_link_hash_table): Add tlsbase field.
177         (elf_xtensa_link_hash_newfunc): New.
178         (elf_xtensa_link_hash_table_create): Use elf_xtensa_link_hash_newfunc.
179         Create an entry for "_TLS_MODULE_BASE_" and save it in tlsbase field.
180         (elf_xtensa_copy_indirect_symbol): New.
181         (elf_xtensa_check_relocs): Rewrite to handle TLS relocations.
182         (elf_xtensa_gc_sweep_hook): Likewise.
183         (elf_xtensa_allocate_dynrelocs): Optimize away GOT entries for
184         TLSDESC_FN relocations when an IE reference is seen.
185         (elf_xtensa_allocate_local_got_size): Likewise.
186         (elf_xtensa_always_size_sections): New.
187         (dtpoff_base, tpoff): New.
188         (elf_xtensa_do_reloc): Handle TLS relocations.
189         (replace_tls_insn): New.
190         (IS_XTENSA_TLS_RELOC): Define.
191         (elf_xtensa_relocate_section): Handle TLS relocations.
192         (get_indirect_call_dest_reg): New.
193         (bfd_elf32_mkobject): Define.
194         (elf_backend_always_size_sections): New.
195         (elf_backend_copy_indirect_symbol): New.
196         * reloc.c (BFD_RELOC_XTENSA_TLSDESC_FN, BFD_RELOC_XTENSA_TLSDESC_ARG)
197         (BFD_RELOC_XTENSA_TLS_DTPOFF, BFD_RELOC_XTENSA_TLS_TPOFF)
198         (BFD_RELOC_XTENSA_TLS_FUNC, BFD_RELOC_XTENSA_TLS_ARG)
199         (BFD_RELOC_XTENSA_TLS_CALL): New.
200         * bfd-in2.h: Regenerate.
201         * libbfd.h: Regenerate.
202
203 2008-08-18  Richard Sandiford  <rdsandiford@googlemail.com>
204
205         * elfxx-mips.c (_bfd_mips_elf_copy_indirect_symbol): Copy MIPS16
206         stub information.
207
208 2008-08-17  Nick Clifton  <nickc@redhat.com>
209
210         * elf32-arm.c: Tidy up the code.
211         (bfd_elf32_arm_allocate_interworking_sections): Move common code
212         into...
213         (arm_allocate_glue_section_space): ... New function.
214         (bfd_elf32_arm_add_glue_sections_to_bfd): Move common code
215         into...
216         (arm_make_glue_section): ... New function.
217
218         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Handle the situation
219         where the sym_hashes are not available.
220
221 2008-08-17  Alan Modra  <amodra@bigpond.net.au>
222
223         * bfd.c (struct _bfd): Correct outsymbols comment.
224         * bfd-in2.h: Regenerate.
225         * linker.c (bfd_generic_link_read_symbols): Renamed from..
226         (generic_link_read_symbols): ..this, and made global.
227
228 2008-08-15  Alan Modra  <amodra@bigpond.net.au>
229
230         PR 6526
231         * configure.in: Invoke AC_USE_SYSTEM_EXTENSIONS.
232         * Makefile.in: Regenerate.
233         * aclocal.m4: Regenerate.
234         * config.in: Regenerate.
235         * configure: Regenerate.
236
237 2008-08-14  Jaka Močnik  <jaka@xlab.si>
238
239         * coffgen.c (coff_find_nearest_line): Correct cached line index.
240
241 2008-08-12  Alan Modra  <amodra@bigpond.net.au>
242
243         * elf32-ppc.c (allocate_dynrelocs): Ignore dyn_relocs when
244         !dynamic_sections_created.  Don't make symbols with got
245         references dynamic if !dynamic_sections_created.
246         * elf64-ppc.c (allocate_dynrelocs): Likewise.  Alloc dynamic
247         relocs on undefined symbols.
248         (ppc64_elf_relocate_section): Allow dynamic relocs on
249         undefined symbols.
250
251 2008-08-11  Alan Modra  <amodra@bigpond.net.au>
252
253         * elf64-ppc.c (toc_adjusting_stub_needed): Any call via the plt
254         needs r2 valid, not just those to external syms.
255
256 2008-08-09  Pedro Alves  <pedro@codesourcery.com>
257
258         * archive.c (_bfd_archive_bsd_update_armap_timestamp): Cast stat
259         st_mtime to long before comparison.
260
261 2008-08-08  Anatoly Sokolov  <aesok@post.ru>
262
263         * archures.c (bfd_mach_avr25, bfd_mach_avr31, bfd_mach_avr35,
264         bfd_mach_avr51): New.
265         * bfd-in2.h: Regenerate.
266         * cpu-avr.c (arch_info_struct): Add avr25, avr31, avr35, and avr51
267         architectures. Change comments to match architecture comments in GCC.
268         (compatible): Add test for new AVR architectures.
269         * elf32-avr.c (bfd_elf_avr_final_write_processing): Recognize
270         bfd_mach_avr25, bfd_mach_avr31, bfd_mach_avr35 and bfd_mach_avr51.
271         (elf32_avr_object_p): Recognize E_AVR_MACH_AVR25, E_AVR_MACH_AVR31,
272         E_AVR_MACH_AVR35 and E_AVR_MACH_AVR51.
273
274
275 2008-08-08  Richard Sandiford  <rdsandiford@googlemail.com>
276             Daniel Jacobowitz  <dan@codesourcery.com>
277             Catherine Moore  <clm@codesourcery.com>
278             Mark Shinwell  <shinwell@codesourcery.com>
279             Maxim Kuvyrkov  <maxim@codesourcery.com>
280
281         * elf32-mips.c (mips_vxworks_copy_howto_rela): Replace with...
282         (elf_mips_copy_howto): ...this howto.  Clear the size fields.
283         (mips_vxworks_jump_slot_howto_rela): Replace with...
284         (elf_mips_jump_slot_howto): ...this howto.
285         (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_MIPS_COPY
286         and BFD_RELOC_MIPS_JUMP_SLOT.
287         (bfd_elf32_bfd_reloc_name_lookup): Handle "R_MIPS_COPY" and
288         "R_MIPS_JUMP_SLOT".
289         (mips_elf32_rtype_to_howto): Handle R_MIPS_COPY and R_MIPS_JUMP_SLOT.
290         (elf_backend_plt_readonly): Define.
291         (elf_backend_plt_sym_val): Define for non-VxWorks targets.
292         (mips_vxworks_bfd_reloc_type_lookup): Delete.
293         (mips_vxworks_bfd_reloc_name_lookup): Likewise.
294         (mips_vxworks_rtype_to_howto): Likewise.
295         (elf_backend_want_dynbss): Don't define for VxWorks.
296         (elf_backend_plt_readonly): Likewise.
297         (bfd_elf32_bfd_reloc_type_lookup): Likewise.
298         (bfd_elf32_bfd_reloc_name_lookup): Likewise.
299         (elf_backend_mips_rtype_to_howto): Likewise.
300         (elf_backend_adjust_dynamic_symbol): Likewise.
301         (elf_backend_got_symbol_offset): Don't define.
302         * elfn32-mips.c (elf_mips_copy_howto, elf_mips_jump_slot_howto): New.
303         (bfd_elf32_bfd_reloc_type_lookup): Handle BFD_RELOC_MIPS_COPY
304         and BFD_RELOC_MIPS_JUMP_SLOT.
305         (bfd_elf32_bfd_reloc_name_lookup): Handle "R_MIPS_COPY" and
306         "R_MIPS_JUMP_SLOT".
307         (mips_elf32_n32_rtype_to_howto): Handle R_MIPS_COPY and
308         R_MIPS_JUMP_SLOT.
309         (elf_backend_rela_plts_and_copies_p, elf_backend_plt_readonly)
310         (elf_backend_plt_sym_val): Define.
311         * elf64-mips.c (elf_mips_copy_howto, elf_mips_jump_slot_howto): New.
312         (bfd_elf64_bfd_reloc_type_lookup): Handle BFD_RELOC_MIPS_COPY
313         and BFD_RELOC_MIPS_JUMP_SLOT.
314         (bfd_elf64_bfd_reloc_name_lookup): Handle "R_MIPS_COPY" and
315         "R_MIPS_JUMP_SLOT".
316         (mips_elf64_rtype_to_howto): Handle R_MIPS_COPY and R_MIPS_JUMP_SLOT.
317         (elf_backend_rela_plts_and_copies_p, elf_backend_plt_readonly)
318         (elf_backend_plt_sym_val): Define.
319         * elfxx-mips.h (_bfd_mips_vxworks_adjust_dynamic_symbol): Delete.
320         (_bfd_mips_elf_use_plts_and_copy_relocs, _bfd_mips_elf_init_stubs)
321         (_bfd_mips_elf_plt_sym_val, _bfd_mips_post_process_headers): Declare.
322         * elfxx-mips.c (mips_elf_la25_stub): New structure.
323         (LA25_LUI, LA25_J, LA25_ADDIU): New macros.
324         (mips_elf_link_hash_entry): Add "la25_stubs", "has_static_relocs"
325         and "has_nonpic_branches" fields.  Remove "is_relocation_target" and
326         "is_branch_target".
327         (mips_elf_link_hash_table): Add blank lines.  Add
328         "use_plts_and_copy_relocs", "reserved_gotno", "strampoline",
329         "la25_stubs" and "add_stub_section" fields.
330         (mips_htab_traverse_info): New structure.
331         (PIC_OBJECT_P, MIPS_ELF_LOAD_WORD): New macros.
332         (MIPS_RESERVED_GOTNO): Delete.
333         (mips_o32_exec_plt0_entry, mips_n32_exec_plt0_entry)
334         (mips_n64_exec_plt0_entry, mips_exec_plt_entry): New tables.
335         (mips_elf_link_hash_newfunc): Update after the changes to
336         mips_elf_link_hash_entry.
337         (mips_elf_check_mips16_stubs): Replace the DATA parameter with
338         an INFO parameter.  Don't look through warnings symbols here;
339         do it in mips_elf_check_symbols instead.
340         (mips_elf_create_stub_symbol): New function.
341         (mips_elf_la25_stub_hash, mips_elf_la25_stub_eq): New functions.
342         (_bfd_mips_elf_init_stubs, mips_elf_local_pic_function_p): Likewise.
343         (mips_elf_add_la25_intro, mips_elf_add_la25_trampoline): Likewise.
344         (mips_elf_add_la25_stub, mips_elf_check_symbols): New functions.
345         (mips_elf_gotplt_index): Check for VxWorks.
346         (mips_elf_output_dynamic_relocation): Take the relocation index
347         as an extra parameter.  Do not increment reloc_count here.
348         (mips_elf_initialize_tls_slots): Update the calls to
349         mips_elf_output_dynamic_relocation accordingly.
350         (mips_elf_multi_got): Use htab->reserved_gotno instead of
351         MIPS_RESERVED_GOTNO.
352         (mips_elf_create_got_section): Don't allocate reserved GOT
353         entries here.  Unconditionally create .got.plt, but don't
354         set its alignment here.
355         (mips_elf_relocation_needs_la25_stub): New function.
356         (mips_elf_calculate_relocation): Redirect branches and jumps to
357         a non-PIC stub if one exists.  Check !h->has_static_relocs instead
358         of !htab->is_vxworks when deciding whether to create dynamic
359         relocations for R_MIPS_32, R_MIPS_REL32 and R_MIPS_64.
360         (_bfd_mips_elf_create_dynamic_sections): Unconditionally call
361         _bfd_elf_create_dynamic_sections.  Unconditionally set up
362         htab->splt and htab->sdynbss.  Set htab->srelplt to ".rel.plt"
363         if !htab->is_vxworks.  Add non-VxWorks values of
364         htab->plt_header_size and htab->plt_entry_size.
365         (_bfd_mips_elf_check_relocs): Set pointer_equality_needed for
366         non-branch static relocations.  Set has_nonpic_branches when an la25
367         stub might be required.  Set can_make_dynamic_p to TRUE if R_MIPS_32,
368         R_MIPS_REL32 and R_MIPS_64 relocations can be made dynamic,
369         rather than duplicating the condition.  Do not make them dynamic
370         for read-only sections in non-PIC executable objects.
371         Do not protect this code with dynobj == NULL || htab->sgot == NULL;
372         handle each group of cases separately.  Add a default case that
373         sets has_static_relocs for non-GOT relocations that cannot be
374         made dynamic.  Don't set is_relocation_target and is_branch_target.
375         Reject non-PIC static relocations in shared objects.
376         (_bfd_mips_vxworks_adjust_dynamic_symbol): Fold into...
377         (_bfd_mips_elf_adjust_dynamic_symbol): ...here, using
378         htab->use_plts_and_copy_relocs instead of htab->is_vxworks
379         to select PLT and copy-reloc handling.  Set the alignment of
380         .plt and .got.plt when allocating the first entry.  Generalize
381         code to handle REL as well as RELA sections and 64-bit as well as
382         32-bit GOT entries.  Complain if we find a static-only reloc
383         against an externally-defined symbol and if we cannot create
384         dynamic relocations for it.  Allocate copy relocs using
385         mips_elf_allocate_dynamic_relocations on non-VxWorks targets.
386         Set possibly_dynamic_relocs to 0 when using PLTs or copy relocs.
387         Skip reserved .got.plt entries.
388         (_bfd_mips_elf_always_size_sections): Use mips_elf_check_symbols
389         instead of mips_elf_check_mips16_stubs to process each symbol.
390         Do the traversal for relocatable objects too.
391         (mips_elf_lay_out_got): Use htab->reserved_gotno instead of
392         MIPS_RESERVED_GOTNO.
393         (_bfd_mips_elf_size_dynamic_sections): Exclude sdynbss if it
394         is empty.  Extend the DT_PLTREL, DT_JMPREL and DT_PLTRELSZ handling
395         to non-VxWorks targets.  Only add DT_REL{,A}, DT_REL{,A}SZ and
396         DT_REL{,A}ENT if .rel.dyn is nonempty.  Create a symbol for the
397         PLT.  Allocate a nop at the end of the PLT.  Allocate DT_MIPS_PLTGOT.
398         (mips_elf_create_la25_stub_info): New function.
399         (_bfd_mips_elf_finish_dynamic_symbol): Write out PLT entries
400         and copy relocs where necessary.  Check pointer_equality_needed.
401         (mips_finish_exec_plt): New function.
402         (_bfd_mips_elf_finish_dynamic_sections): Always set DT_PLTGOT
403         to the beginning of htab->sgot.  Use htab->reserved_gotno instead
404         of MIPS_RESERVED_GOTNO.  Assert htab->use_plts_and_copy_relocs
405         instead of htab->is_vxworks for DT_PLTREL, DT_PLTRELSZ and DT_JMPREL.
406         Set DT_PLTREL to DT_REL instead of DT_RELA on non-VxWorks targets.
407         Use mips_finish_exec_plt to create non-VxWorks PLT headers.  Set
408         DT_MIPS_PLTGOT.
409         (_bfd_mips_elf_copy_indirect_symbol): Copy has_static_relocs
410         from the indirect symbol to the direct symbol.  Also copy
411         has_nonpic_branches for indirect symbols.
412         (_bfd_mips_elf_get_target_dtag): Handle DT_MIPS_PLTGOT and
413         DT_MIPS_RWPLT.
414         (_bfd_mips_elf_link_hash_table_create): Initialize the new
415         mips_elf_link_hash_table fields.
416         (_bfd_mips_vxworks_link_hash_table_create): Set
417         use_plts_and_copy_relocs to TRUE.  Use TRUE rather than 1
418         when setting is_vxworks.
419         (_bfd_mips_elf_use_plts_and_copy_relocs): New function.
420         (_bfd_mips_elf_final_link): Call mips_elf_create_la25_stub for
421         each la25_stub.
422         (_bfd_mips_elf_merge_private_bfd_data): Treat dynamic objects
423         as PIC.  Generalize message about linking PIC and non-PIC.
424         (_bfd_mips_elf_plt_sym_val, _bfd_mips_post_process_headers): New
425         functions.
426         * reloc.c: Update comment near BFD_RELOC_MIPS_JUMP_SLOT.
427         * bfd-in2.h: Regenerated.
428
429 2008-08-08  Alan Modra  <amodra@bigpond.net.au>
430
431         * elf.c (bfd_elf_get_elf_syms): Don't leak memory on error.
432         * elflink.c (_bfd_elf_link_read_relocs): bfd_release on error.
433         (elf_link_add_object_symbols): Don't leak memory on error.
434         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
435         (elf_fixup_link_order): Free sections.
436
437 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
438
439         * elf-bfd.h (elf_backend_data): Add a "rela_plts_and_copies_p" field.
440         * elfxx-target.h (elf_backend_rela_plts_and_copies_p): New macro.
441         (elfNN_bed): Use it.
442         * elf.c (_bfd_elf_get_synthetic_symtab): Use rela_plts_and_copies_p
443         instead of default_use_rela_p to choose between ".rel.plt" and
444         ".rela.plt".
445         * elflink.c (_bfd_elf_create_dynamic_sections): Use
446         rela_plts_and_copies_p instead of default_use_rela_p to choose
447         between ".rel.plt" and ".rela.plt", and between ".rel.bss" and
448         ".rela.bss".
449
450 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
451
452         * elf-bfd.h (MIPS_ELF_TDATA): New elf_object_id.
453         * elf32-mips.c (bfd_elf32_mkobject): Define.
454         * elf64-mips.c (bfd_elf64_mkobject): Likewise.
455         * elfn32-mips.c (bfd_elf32_mkobject): Likewise.
456         * elfxx-mips.h (_bfd_mips_elf_mkobject): Declare.
457         * elfxx-mips.c (is_mips_elf): New macro.
458         (_bfd_mips_elf_mkobject): New function.
459         (_bfd_mips_elf_final_link): Use is_mips_elf.
460         (_bfd_mips_elf_merge_private_bfd_data): Likewise.
461
462 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
463
464         * elfxx-mips.c (mips_elf_record_relocs): Defer allocation of a
465         global GOT entry when deferring allocation of dynamic relocations.
466         (allocate_dynrelocs): When allocating deferred dynamic relocations,
467         also do the deferred allocation of a GOT entry.
468
469 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
470
471         * elfxx-mips.c (mips_got_info): Add a "reloc_only_gotno" field.
472         (mips_elf_got_section): Delete.
473         (mips_elf_sort_hash_table): Use g->reloc_only_gotno to decide
474         how many reloc-only entries there are.
475         (mips_elf_count_got_symbols): Adjust g->reloc_only_gotno as
476         well as g->global_gotno.
477         (mips_elf_make_got_per_bfd): Initialize reloc_only_gotno.
478         (mips_elf_multi_got): Likewise.  Use gg->reloc_only_gotno
479         rather than gg->assigned_gotno to store the number of
480         reloc-only GOT entries.
481         (mips_elf_create_got_section): Remove the MAYBE_EXCLUDE parameter.
482         Initialize reloc_only_gotno.
483         (mips_elf_calculate_relocation): Check htab->got_info instead of
484         dynobj when deciding whether to call mips_elf_adjust_gp,
485         (_bfd_mips_elf_create_dynamic_sections): Adjust the call
486         to mips_elf_create_got_section.
487         (mips_elf_record_relocs): Likewise.  Remove redundant
488         "dynobj == NULL" code.  Do not use mips_elf_create_got_section
489         or mips_elf_record_global_got_symbol for R_MIPS_32, R_MIPS_REL32
490         and R_MIPS_64; limit global_got_area to GGA_RELOC_ONLY instead.
491         (_bfd_mips_elf_finish_dynamic_symbol): Use htab->sgot instead
492         of mips_elf_got_section.
493         (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
494         (_bfd_mips_elf_finish_dynamic_sections): Likewise.
495         Move the initial assignment of G to the block that uses it;
496         it is used for an unrelated purpose later.
497
498 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
499
500         * elfxx-mips.c (count_section_dynsyms): Move before the new first use.
501         (mips_elf_sort_hash_table): Take the output bfd as a parameter.
502         Remove the MAX_LOCAL parameter.  Exit early if there are no
503         dynamic symbols, if there is no dynobj, or if there is no
504         GOT section.  Use count_section_dynsyms instead of MAX_LOCAL.
505         Assert == rather than <= when checking hsd.max_unref_got_dynindx.
506         Also assert that g->global_gotno is right.
507         (mips_elf_count_forced_local_got_symbols): Rename to...
508         (mips_elf_count_got_symbols): ...and count global GOT entries too.
509         Set the global_got_area of a forced-local GGA_RELOC_ONLY symbol
510         to GGA_NONE.
511         (mips_elf_multi_got): Don't sort the symbol table.
512         (mips_elf_lay_out_got): Likewise.  Use mips_elf_count_got_symbols
513         to count the number of global GOT entries.
514         (_bfd_mips_elf_final_link): Unconditionally call
515         mips_elf_sort_hash_table.
516
517 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
518
519         * elfxx-mips.c (GGA_NORMAL, GGA_RELOC_ONLY, GGA_NONE): New macros.
520         (mips_elf_link_hash_entry): Add a "global_got_area" field.
521         (mips_elf_link_hash_newfunc): Initialize it.
522         (mips_elf_sort_hash_table_f): Use h->global_got_area instead of
523         h->root.got.offset.  Do not handle forced_local symbols specially.
524         (mips_elf_record_global_got_symbol): Set h->global_got_area
525         instead of h->root.got.offset.
526         (mips_elf_recreate_got): Assert that h->global_got_area == GGA_NONE
527         for indirect and warning symbols.
528         (mips_elf_count_forced_local_got_symbols): Change the argument
529         from a "elf_link_hash_entry" to "mips_elf_link_hash_entry".
530         Use and set h->global_got_area instead of h->root.got.offset.
531         Set it to GGA_NONE for all forced-local symbols.
532         (mips_elf_set_global_got_offset): Set h->global_got_area
533         instead of h->root.got.offset.  Use g->global_got_area instead
534         of a combination of dynindx, forced_local and tls_type.
535         (mips_elf_multi_got): Remove disabled code.  Pass GGA_* values to
536         mips_elf_set_global_got_offset.
537         (mips_elf_lay_out_got): Use mips_elf_link_hash_traverse instead
538         of elf_link_hash_traverse.
539         (_bfd_mips_elf_copy_indirect_symbol): Copy the indirect symbol's
540         global_got_area to the direct symbol if the latter's value is higher.
541         Set the indirect symbol's area to GGA_NONE.
542
543 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
544
545         * elf32-mips.c (elf_backend_hide_symbol): Delete.
546         * elfn32-mips.c (elf_backend_hide_symbol): Likewise.
547         * elf64-mips.c (elf_backend_hide_symbol): Likewise.
548         * elfxx-mips.h (elf_backend_hide_symbol): Likewise.
549         * elfxx-mips.c (mips_elf_link_hash_entry): Remove "forced_local"
550         and add "needs_lazy_stub".
551         (mips_elf_link_hash_newfunc): Update accordingly.
552         (mips_elf_link_hash_table): Remove "computed_got_sizes" and
553         add "lazy_stub_count".
554         (_bfd_mips_elf_link_hash_table_create): Update accordingly.
555         (mips_elf_output_extsym): Use hd->needs_lazy_stub to detect
556         cases where a lazy stub is being used.
557         (mips_elf_sort_hash_table_f): Use h->root.forced_local instead
558         of h->forced_local.
559         (mips_elf_record_global_got_symbol): Use _bfd_elf_link_hash_hide_symbol
560         instead of _bfd_mips_elf_hide_symbol.  Do not increment local_gotno
561         here.
562         (mips_elf_allocate_dynamic_relocations): Move before new first use.
563         (mips_elf_check_recreate_got, mips_elf_recreate_got): New functions.
564         (mips_elf_resolve_final_got_entries): Move earlier in file.  Make at
565         most two passes over the hash table.  Use mips_elf_check_recreate_got
566         to see if there are any indirect or warning entries and
567         mips_elf_recreate_got to create a new GOT without them.
568         Return a boolean success value.
569         (mips_elf_count_forced_local_got_entries): New function.
570         (mips_elf_make_got_per_bfd): Check h->root.forced_local instead of
571         h->forced_local.
572         (mips_elf_set_global_got_offset): Likewise.
573         (mips_elf_set_no_stub): Replace with...
574         (mips_elf_forbid_lazy_stubs): ...this new function.
575         (mips_elf_resolve_final_got_entry): Delete.
576         (mips_elf_multi_got): Fix formatting.  Use mips_elf_forbid_lazy_stubs
577         instead of mips_elf_set_no_stub.  Move the code that sets
578         global offsets and allocates dynamic relocations from the main
579         _bfd_mips_elf_size_dynamic_sections loop to here.
580         (_bfd_mips_elf_adjust_dynamic_symbol): Do not allocate room in
581         .MIPS.stubs here; just set hmips->needs_lazy_stub and increment
582         htab->lazy_stub_count.
583         (_bfd_mips_elf_always_size_sections): Move the stub-estimation
584         code to mips_elf_estimate_stub_size and the GOT-sizing code to
585         mips_elf_lay_out_got.  Do not call these functions here.
586         (mips_elf_estimate_stub_size): New function, split
587         out from _bfd_mips_elf_always_size_sections.  Call
588         mips_elf_resolve_final_got_entries earlier.  Count the number
589         of forced-local entries.  Do not add stub sizes to loadable_size;
590         after this patch, the stub sizes are already included in the main
591         estimate.  Allocate dynamic relocations here rather than in the
592         main _bfd_mips_elf_size_dynamic_sections loop.
593         (mips_elf_estimate_stub_size): New function, split out from
594         _bfd_mips_elf_always_size_sections.
595         (mips_elf_allocate_lazy_stub): New function.
596         (mips_elf_lay_out_lazy_stubs): Likewise.
597         (_bfd_mips_elf_size_dynamic_sections): Call mips_elf_estimate_stub_size,
598         mips_elf_lay_out_got and mips_elf_lay_out_lazy_stubs.  Do not handle
599         the allocation of sreldyn specially.
600         (_bfd_mips_elf_hide_symbol): Delete.
601
602 2008-08-07  Richard Sandiford  <rdsandiford@googlemail.com>
603
604         * elfxx-mips.c (allocate_dynrelocs): Ignore indirect and warning
605         symbols.
606
607 2008-08-06  Richard Sandiford  <rdsandiford@googlemail.com>
608
609         * elfxx-mips.c (mips_elf_link_hash_entry): Move bfd_boolean
610         fields to the end of the structure and make them single-bit
611         bitfields.
612         (mips_elf_link_hash_newfunc): Make the initialization statements
613         follow the new field order.
614
615 2008-08-06  Richard Sandiford  <rdsandiford@googlemail.com>
616
617         * elfxx-mips.c (_mips_elf_section_data): Remove the "u.got_info" field.
618         (mips_elf_link_hash_table): Add "sgot" and "got_info" fields.
619         (_bfd_mips_elf_link_hash_table_create): Initialize them.
620         (mips_elf_got_section): Always apply the !maybe_excluded behavior.
621         (mips_elf_got_info): Delete.
622         (mips_elf_initialize_tls_slots): Remove the DYNOBJ local variable.
623         Adjust the call to mips_elf_got_section.
624         (mips_elf_local_got_index): Don't call mips_elf_got_info.
625         Update the call to mips_elf_create_local_got_entry.
626         Use htab->got_info.
627         (mips_elf_global_got_index): Don't call mips_elf_got_info;
628         use htab->got_info and htab->sgot instead.
629         (mips_elf_got_page): Don't call mips_elf_got_info.  Update the
630         call to mips_elf_create_local_got_entry.
631         (mips_elf_got16_entry): Likewise.
632         (mips_elf_got_offset_from_index): Replace with DYNOBJ parameter
633         with an INFO parameter.  Don't call mips_elf_got_info; use htab->sgot
634         and htab->got_info instead.
635         (mips_elf_create_local_got_entry): Remove the GG and SGOT parameters.
636         Use htab->sgot and htab->got_info.
637         (mips_elf_sort_hash_table): Remove the DYNOBJ local variable.
638         Don't call mips_elf_got_info; use htab->got_info instead.
639         (mips_elf_record_global_got_symbol): Turn G from a paramter to
640         a local variable and read it from htab->got_info.
641         (mips_elf_record_local_got_symbol): Replace the G parameter with
642         an INFO parameter.  Make G a local variable and read it from
643         htab->got_info instead.
644         (mips_elf_record_got_page_entry): Likewise.
645         (mips_elf_multi_got): Remove the G parameter and make it a local
646         variable instead.  Read it from htab->got_info.
647         (mips_elf_create_got_section): Cache the GOT section in htab->sgot.
648         Store the GOT information in htab->got_info.
649         (mips_elf_calculate_relocation): Don't call mips_elf_got_section
650         and mips_elf_got_info; use htab->sgot and htab->got_info instead.
651         Adjust the calls to mips_elf_got_offset_from_index and
652         mips_elf_adjust_gp.
653         (_bfd_mips_elf_check_relocs): Remove the G and SGOT local variables.
654         Adjust the calls to mips_elf_record_local_got_symbol,
655         mips_elf_record_global_got_symbol and mips_elf_record_got_page_entry.
656         Use htab->sgot.
657         (_bfd_mips_elf_always_size_sections): Remove the DYNOBJ local variable.
658         Don't call mips_elf_got_info; use htab->sgot and htab->got_info instead.
659         Update the call to mips_elf_multi_got.
660         (_bfd_mips_elf_size_dynamic_sections): Don't call mips_elf_got_info;
661         use htab->got_info instead.
662         (_bfd_mips_elf_finish_dynamic_symbol): Update the call to
663         mips_elf_got_section.  Get the got_info from the hash table
664         rather than the GOT section.
665         (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
666         (_bfd_mips_elf_finish_dynamic_sections): Likewise.
667         (_bfd_mips_elf_hide_symbol): Don't call mips_elf_got_section;
668         get the got_info from the hash table instead.  Remove the GOT
669         local variable.
670         (_bfd_mips_elf_final_link): Likewise.  Also remove the DYNOBJ
671         local variable.
672
673 2008-08-06  Richard Sandiford  <rdsandiford@googlemail.com>
674
675         * elfxx-mips.c (mips_elf_link_hash_table): Add an "sstubs" field.
676         (_bfd_mips_elf_create_dynamic_sections): Use it to cache the stubs
677         section.  Don't check whether the section already exists.
678         (_bfd_mips_elf_adjust_dynamic_symbol): Use htab->sstubs.
679         (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
680         (_bfd_mips_elf_finish_dynamic_sections): Likewise.
681         (_bfd_mips_elf_size_dynamic_sections): Likewise.  Don't add the
682         dummy stub to an empty section.
683         (_bfd_mips_elf_link_hash_table_create): Initialize the "sstubs" field.
684
685 2008-08-06  Richard Sandiford  <rdsandiford@googlemail.com>
686
687         * reloc.c (BFD_RELOC_MIPS16_GOT16, BFD_RELOC_MIPS16_CALL16): Declare.
688         * libbfd.h, bfd-in2.h: Regenerate.
689         * elf32-mips.c (elf_mips16_howto_table_rel): Fill in reserved
690         R_MIPS16_GOT16 and R_MIPS16_CALL16 entries.
691         (mips16_reloc_map): Add mappings.
692         * elf64-mips.c (mips16_elf64_howto_table_rel): Fill in reserved
693         R_MIPS16_GOT16 and R_MIPS16_CALL16 entries.
694         (mips16_elf64_howto_table_rela): Likewise.
695         (mips16_reloc_map): Add mappings.
696         * elfn32-mips.c (elf_mips16_howto_table_rel): Fill in reserved
697         R_MIPS16_GOT16 and R_MIPS16_CALL16 entries.
698         (elf_mips16_howto_table_rela): Likewise.
699         (mips16_reloc_map): Add mappings.
700         * elfxx-mips.c (mips_elf_create_shadow_symbol): New function.
701         (section_allows_mips16_refs_p): Likewise.
702         (mips16_stub_symndx): Likewise.
703         (mips_elf_check_mips16_stubs): Treat the data argument as a
704         bfd_link_info.  Mark every dynamic symbol as needing MIPS16 stubs
705         and create a "shadow" symbol for the original MIPS16 definition.
706         (mips16_reloc_p, got16_reloc_p, call16_reloc_p, hi16_reloc_p)
707         (lo16_reloc_p, mips16_call_reloc_p): New functions.
708         (_bfd_mips16_elf_reloc_unshuffle): Use mips16_reloc_p to generalize
709         relocation checks.
710         (_bfd_mips16_elf_reloc_shuffle): Likewise.
711         (_bfd_mips_elf_lo16_reloc): Handle R_MIPS16_GOT16.
712         (mips_elf_got16_entry): Add comment.
713         (mips_elf_calculate_relocation): Use hi16_reloc_p,
714         lo16_reloc_p, mips16_call_reloc_p, call16_reloc_p and got16_reloc_p
715         to generalize relocation checks.  Use section_allows_mips16_refs_p
716         instead of mips16_stub_section_p.   Handle R_MIPS16_CALL16 and
717         R_MIPS16_GOT16, allowing the former to refer directly to a
718         MIPS16 function if its stub is not needed.
719         (mips16_stub_section_p): Delete.
720         (_bfd_mips_elf_symbol_processing): Convert odd-valued function
721         symbols into even MIPS16 symbols.
722         (mips_elf_add_lo16_rel_addend): Use mips16_reloc_p to generalize
723         a relocation check.
724         (_bfd_mips_elf_check_relocs): Calculate "bed" and "rel_end"
725         earlier in the function.  Use mips16_stub_symndx to identify
726         the target function.  Avoid out-of-bounds accesses when the
727         stub has no relocations; report an error instead.  Use
728         section_allows_mips16_refs_p instead of mips16_stub_section_p.
729         Use mips16_call_reloc_p and got16_reloc_p to generalize relocation
730         checks.  Handle R_MIPS16_CALL16 and R_MIPS16_GOT16.  Don't create
731         dynamic relocations for absolute references to __gnu_local_gp.
732         (_bfd_mips_elf_always_size_sections): Pass a bfd_link_info as
733         the argument to mips_elf_check_mips16_stubs.  Generalize comment.
734         (_bfd_mips_elf_relocate_section): Use hi16_reloc_p and got16_reloc_p
735         to generalize relocation checks.
736         (_bfd_mips_elf_finish_dynamic_symbol): If a dynamic MIPS16 function
737         symbol has a non-MIPS16 stub, redirect the symbol to the stub.
738         Fix an overly long line.  Don't give dynamic symbols type STO_MIPS16.
739         (_bfd_mips_elf_gc_sweep_hook): Handle R_MIPS16_CALL16 and
740         R_MIPS16_GOT16.
741
742 2008-08-06  Alan Modra  <amodra@bigpond.net.au>
743
744         * elf32-ppc.c (ppc_elf_relax_section): Clear R_PPC_PLTREL24 addend.
745         (ppc_elf_relocate_section <R_PPC_RELAX32_PLT>): Don't bother here.
746
747 2008-08-05  Alan Modra  <amodra@bigpond.net.au>
748             Jaka Močnik <jaka@xlab.si>
749
750         * coffcode.h (coff_slurp_line_table): bfd_alloc lineno_cache first
751         so that we don't inadvertently free it.  Use bfd_alloc for sort
752         arrays, and memcpy sorted line table.
753
754 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
755
756         * elf32-spu.c (spu_elf_auto_overlay): Use the maximum possible
757         if --fixed-space request is too large.
758
759 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
760
761         * Makefile.am (SRC-POTFILES.in, BLD-POTFILES.in): Set LC_ALL=C.
762         * Makefile.in: Regenerate.
763         * po/SRC-POTFILES.in: Regenerate.
764
765 2008-08-02  Alan Modra  <amodra@bigpond.net.au>
766
767         * elf32-spu.c (mark_overlay_section): Move code calculating
768         max_overlay_size to correct block.
769         (spu_elf_auto_overlay): Don't use %x in einfo error message.
770
771 2008-08-01  Alan Modra  <amodra@bigpond.net.au>
772             Jan Kratochvil  <jan.kratochvil@redhat.com>
773
774         * elfcore.h (elf_core_file_p): Ensure we have a backend match
775         with the correct arch size before rejecting the generic fallback.
776         * elfcode.h (elf_object_p): Likewise.  Ensure arch size matches
777         before accepting a target.
778
779 2008-08-01  Alan Modra  <amodra@bigpond.net.au>
780
781         PR 6774
782         * elf.c (rewrite_elf_program_header): Don't wrap p_paddr to
783         include file or program headers.
784
785 2008-07-30  Alan Modra  <amodra@bigpond.net.au>
786
787         * coff-ppc.c, coffgen.c, ecoff.c, ecofflink.c, elf.c, elf32-frv.c,
788         elf32-iq2000.c, elf32-m32c.c, elf32-mep.c, elf32-mt.c,
789         elf32-sh-symbian.c, elf64-hppa.c, mach-o.c, peXXigen.c, pef.c,
790         ppcboot.c, vms-misc.c, xsym.c: Silence gcc warnings.
791
792 2008-07-28  Daniel Jacobowitz  <dan@codesourcery.com>
793
794         * elfxx-mips.c (mips_elf_calculate_relocation): Avoid generating
795         relocations for undefined weak symbols with non-default visibility.
796         (_bfd_mips_elf_check_relocs): Use possibly_dynamic_relocs for
797         global symbols in shared libraries.
798         (allocate_dynrelocs): New function.
799         (_bfd_mips_elf_adjust_dynamic_symbol): Do not handle
800         possibly_dynamic_relocs here.
801         (_bfd_mips_elf_size_dynamic_sections): Call allocate_dynrelocs.
802
803 2008-07-28  Alexandre Oliva  <aoliva@redhat.com>
804
805         * elf32-i386.c (struct elf_i386_link_hash_table): Added field
806         tls_module_base.
807         (elf_i386_link_hash_table_create): Initialize it.
808         (elf_i386_always_size_sections): Set it.
809         (set_tls_module_base): New.
810         (elf_i386_relocate_sections): Call it.
811         * elf64-x86-64.c (struct elf64_x86_64_link_hash_table): Added
812         field tls_module_base.
813         (elf64_x86_64_link_hash_table_create): Initialize it.
814         (elf64_x86_64_always_size_sections): Set it.
815         (set_tls_module_base): New.
816         (elf64_x86_64_relocate_sections): Call it.
817         Reported by Cary Coutant <ccoutant@google.com>
818
819 2008-07-28  Ineiev  <ineiev@yahoo.co.uk>
820
821         * elf32-arm.c (arm_map_one_stub): Declare variables at beginning
822         of block.
823         * elf32-avr.c (get_local_syms): Likewise.
824
825 2008-07-28  Alan Modra  <amodra@bigpond.net.au>
826
827         PR 6769
828         * bfd-in.h (BFD_VMA_FMT): Define.
829         (printf_vma, sprintf_vma): Use the above.
830         (_bfd_int64_low, _bfd_int64_high): Delete.
831         * bfd-in2.h: Regenerate.
832
833 2008-07-27  Alan Modra  <amodra@bigpond.net.au>
834
835         * elf.c (_bfd_elf_make_section_from_shdr): Ignore return from
836         elf_parse_notes.  Use bfd_malloc_and_get_section.
837         (elf_parse_notes): Validate note namesz and descsz.
838
839 2008-07-26  Michael Eager <eager@eagercon.com>
840
841         * elf32-ppc.c (ppc_elf_merge_obj_attributes): Check compatibility
842         between single-float, double-float, and soft-float.
843
844 2008-07-24  Daniel Jacobowitz  <dan@codesourcery.com>
845
846         * elf32-mips.c (elf_backend_write_section): Define.
847
848 2008-07-24  Nick Clifton  <nickc@redhat.com>
849
850         * elf.c (_bfd_elf_map_sections_to_segments): Catch off by one
851         error assigning sections to segments.
852
853 2008-07-22  Nick Clifton  <nickc@redhat.com>
854
855         * elf.c (_bfd_elf_map_sections_to_segments): Allow sections in
856         adjoining pages to be included in the same segment.
857
858 2008-07-22  Simon Baldwin  <simonb@google.com>
859
860         * elflink.c (elf_link_output_extsym): Set st_size to zero for
861         symbols from dynamic libraries.
862
863 2008-07-21  H.J. Lu  <hongjiu.lu@intel.com>
864
865         PR ld/4424
866         * elflink.c (_bfd_elf_merge_symbol): Call bed->relocs_compatible
867         to check if 2 inputs are compatible.
868
869 2008-07-21  Sterling Augustine  <sterling@tensilica.com>
870
871         * elf.c (assign_file_positions_for_load_sections): Print vma in
872         error message about overlapping section vmas.
873
874 2008-07-21  H.J. Lu  <hongjiu.lu@intel.com>
875
876         PR ld/6747
877         * elf32-frv.c (elf32_frv_relocate_section): Revert the change
878         for PR ld/6446 checked in by accident on May 21, 2008.
879
880 2008-07-21  Nick Clifton  <nickc@redhat.com>
881
882         * coff-sh.c (bfd_pe_print_pdata): Define to NULL for non
883         COFF_WITH_PE based SH ports.
884         * libpei.h (_bfd_XX_print_ce_compressed_pdata): Prototype.
885         * arm-wince-pe.c (bfd_pe_print_pdata): Use
886         _bfd_pe_print_ce_compressed_pdata.
887         (slurp_symcache, cleanup_syms, pe_print_ce_compressed_pdata): Move
888         to...
889         * peXXigen.c: ... here and rename pe_print_ce_compressed_pdata to
890         _bfd_XX_print_ce_compressed_pdata.
891
892 2008-07-21  Alan Modra  <amodra@bigpond.net.au>
893
894         * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Drop
895         unwanted zero terminators.
896
897 2008-07-21  Alan Modra  <amodra@bigpond.net.au>
898
899         * elf32-spu.c (spu_elf_relocate_section): Expand
900         RELOC_FOR_GLOBAL_SYMBOL.  Don't warn about undefined symbols for
901         R_SPU_PPU32 and R_SPU_PPU64 relocations.
902
903 2008-07-21  Luis Machado  <luisgpm@br.ibm.com>
904
905         * elf-bfd.h: Declare elfcore_write_ppc_vsx.
906         * elf.c (elfcore_grok_ppc_vsx): New function.
907         (elfcore_write_ppc_vsx): New function
908         (elfcore_grok_note): Handle VSX notes.
909         (elfcore_write_register_note): Handle VSX notes.
910
911 2008-07-18  Joseph Myers  <joseph@codesourcery.com>
912
913         * bfd-in.h (bfd_elf32_arm_set_target_relocs): Add new parameter.
914         * bfd-in2.h: Regenerate.
915         * elf32-arm.c (struct elf_arm_obj_tdata): Add field
916         no_wchar_size_warning.
917         (bfd_elf32_arm_set_target_relocs): Add new parameter
918         no_wchar_warn.
919         (elf32_arm_merge_eabi_attributes): Give a warning, not an error,
920         for conflicting wchar_t attributes.  Do not warn if
921         --no-wchar-size-warning.  Make diagnostic text more specific.
922
923 2008-07-18  H.J. Lu  <hongjiu.lu@intel.com>
924
925         PR ld/6748
926         * elf32-arm.c (elf32_arm_link_hash_table_create): Initialize
927         new fields added for ARM long call support.
928
929 2008-07-18  Danny Backx  <dannybackx@users.sourceforge.net>
930
931         * pe-arm-wince.c (pe_print_compressed_pdata): Define new function to
932         print compressed pdata structure as described on MSDN. This only
933         applies to a limited set of architectures (ARM, SH4).
934         (slurp_symtab, my_symbol_for_address): Define static helper
935         functions for pe_print_compressed_pdata.
936         * coffcode.h (bfd_coff_backend_data): Add _bfd_coff_print_pdata field.
937         (bfd_coff_have_print_pdata, bfd_coff_print_pdata): Define.
938         * bfd/peXXigen.c (_bfd_XX_print_private_bfd_data_common): Add check on
939         bfd_coff_backend_data, call the function if non-null.
940         * pei-mcore.c: Add target dependent initialisation for
941         bfd_coff_backend_data.
942         * coff-sh.c: Likewise.
943         * coff64-rs6000.c: Likewise.
944         * coff-rs6000.c: Likewise.
945         * libcoff-in.h: Likewise.
946         * cf-i386lynx.c: Likewise.
947         * coff-alpha.c: Likewise.
948         * coff-apollo.c: Likewise.
949         * coff-arm.c: Likewise.
950         * coff-aux.c: Likewise.
951         * coff-h8300.c: Likewise.
952         * coff-h8500.c: Likewise.
953         * coff-i386.c: Likewise.
954         * coff-i860.c: Likewise.
955         * coff-i960.c: Likewise.
956         * coff-ia64.c: Likewise.
957         * coff-m68k.c: Likewise.
958         * coff-m88k.c: Likewise.
959         * coff-maxq.c: Likewise.
960         * coff-mips.c: Likewise.
961         * coff-or32.c: Likewise.
962         * coff-sparc.c: Likewise.
963         * coff-tic30.c: Likewise.
964         * coff-tic4x.c: Likewise.
965         * coff-tic54x.c: Likewise.
966         * coff-tic80.c: Likewise.
967         * coff-w65.c: Likewise.
968         * coff-we32k.c: Likewise.
969         * coff-x86_64.c: Likewise.
970         * coff-z80.c: Likewise.
971         * coff-z8k.c: Likewise.
972         * pe-mcore.c: Likewise.
973         * pe-mips.c: Likewise.
974         * pe-ppc.c: Likewise.
975         * peXXigen.c: Likewise.
976         * pei-ppc.c: Likewise.
977         * libcoff.h: Regenerate.
978
979 2008-07-16  Bernd Schmidt  <bernd.schmidt@analog.com>
980
981         * elf32-bfin.c (bfin_check_relocs, bfin_relocate_section,
982         bfin_final_link_relocate, bfin_gc_mark_hook, bfin_gc_sweep_hook,
983         ELF_DYNAMIC_INTERPRETER, DEFAULT_STACK_SIZE,
984         struct _bfinfdpic_dynamic_got_info): Moved around to keep FD-PIC code
985         separate from non-FD-PIC.
986
987 2008-07-14  DJ Delorie  <dj@redhat.com>
988
989         * elf-m10300.c (mn10300_elf_final_link_relocate): Correct overflow
990         checks for PCREL8, PCREL16, GOTPC16, GOTOFF16, PLT16, and GOT16
991         relocs.
992         (mn10300_elf_relax_section): Correct jump offset check when target
993         is in a different section.
994
995 2008-07-15  Jie Zhang  <jie.zhang@analog.com>
996
997         * elf32-bfin.c (elf32_bfin_special_sections[]): New.
998         (elf_backend_special_sections): Define.
999
1000 2008-07-13  Craig Silverstein  <csilvers@google.com>
1001
1002         PR binutils/6743
1003         * dwarf2.c (struct dwarf2_debug): New variable info_ptr_memory.
1004         (find_line): Use info_ptr_memory instead of sec_info_ptr.
1005         (_bfd_dwarf2_cleanup_debug_info): Likewise.
1006
1007 2008-07-12  Jie Zhang  <jie.zhang@analog.com>
1008
1009         Revert
1010         2008-07-12  Jie Zhang  <jie.zhang@analog.com>
1011         * elf.c (_bfd_elf_map_sections_to_segments): Don't put
1012         executable sections into the same segment with other
1013         read only sections if --sep-code.
1014         * elf32-bfin.c (elf32_bfin_code_in_l1): New variable.
1015         (elf32_bfin_data_in_l1): New variable.
1016         (elf32_bfin_final_write_processing): New.
1017         (elf32_bfin_special_sections[]): New.
1018         (elf_backend_final_write_processing): Define.
1019         (elf_backend_special_sections): Define.
1020
1021 2008-07-12  Jie Zhang  <jie.zhang@analog.com>
1022
1023         * elf.c (_bfd_elf_map_sections_to_segments): Don't put
1024         executable sections into the same segment with other
1025         read only sections if --sep-code.
1026         * elf32-bfin.c (elf32_bfin_code_in_l1): New variable.
1027         (elf32_bfin_data_in_l1): New variable.
1028         (elf32_bfin_final_write_processing): New.
1029         (elf32_bfin_special_sections[]): New.
1030         (elf_backend_final_write_processing): Define.
1031         (elf_backend_special_sections): Define.
1032
1033 2008-07-11  Andreas Schwab  <schwab@suse.de>
1034
1035         * dwarf2.c (read_section): Take pointer to bfd_size_type instead
1036         of unsigned long as last parameter.
1037         (struct dwarf2_debug): Define dwarf_abbrev_size, dwarf_line_size,
1038         dwarf_str_size and dwarf_ranges_size as bfd_size_type instead of
1039         unsigned long.
1040
1041 2008-07-10  Richard Sandiford  <rdsandiford@googlemail.com>
1042
1043         * elfxx-mips.c (mips_elf_calculate_relocation): Calculate GP and GP0
1044         for all relocation types.  Allow any type of relocation to refer to
1045         __gnu_local_gp.
1046
1047 2008-07-10  Richard Sandiford  <rdsandiford@googlemail.com>
1048
1049         * elfxx-mips.c (mips_elf_check_mips16_stubs): Use ELF_ST_IS_MIPS16.
1050         (mips_elf_calculate_relocation): Likewise.
1051         (_bfd_mips_elf_add_symbol_hook): Likewise.
1052         (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
1053         (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
1054
1055 2008-07-10  Andreas Schwab  <schwab@suse.de>
1056
1057         * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Add missing
1058         paren.
1059
1060 2008-07-09  Craig Silverstein  <csilvers@google.com>
1061
1062         * Makefile.am (BFD32_LIBS): Add compress.lo.
1063         (BFD32_LIBS_CFILES): Add compress.c.
1064         (BFD_H_FILES): Likewise.
1065         * Makefile.in: Regenerate.
1066         * bfd-in2.h: Regenerate.
1067         * config.in: Add HAVE_ZLIB_H
1068         * configure.in: Add test for libz and zlib.h
1069         * configure: Regenerate.
1070         * dwarf2.c (read_section): New function.
1071         (read_indirect_string): Call new function read_section.
1072         (read_abbrevs): Likewise.
1073         (decode_line_info): Likewise.
1074         (read_debug_ranges): Likewise.
1075         (find_line): Call new function read_section when just one
1076         .zdebug_info section is found, otherwise read and compress
1077         multiple sections.
1078         (_bfd_dwarf2_cleanup_debug_info): Free sec_info_ptr.
1079         * elf.c (_bfd_elf_make_section_from_shdr): Add zdebug prefix.
1080         (special_sections_z): New struct.
1081         (special_sections): Refer to special_sections_z.
1082         * elfxx-mips.c (_bfd_mips_elf_section_from_shdr): Recognize
1083         sections named .zdebug_*.
1084         (_bfd_mips_elf_fake_sections): Likewise.
1085         * compress.c: New file.
1086         (bfd_uncompress_section_contents): New function.
1087
1088 2008-07-07  Christophe Lyon  <christophe.lyon@st.com>
1089
1090         * elf32-arm.c (arm_type_of_stub): Don't crash on local symbols in
1091         the presence of a PLT.
1092
1093 2008-07-07  Alan Modra  <amodra@bigpond.net.au>
1094
1095         * bfd.c (bfd_demangle): Always trim off bfd_get_symbol_leading_char.
1096
1097 2008-07-02  Alan Modra  <amodra@bigpond.net.au>
1098
1099         * elf32-ppc.c (is_pic_glink_stub): New function.
1100         (ppc_elf_get_synthetic_symtab): Don't generate symbols when
1101         multiple shared/pie stubs per plt entry.
1102
1103 2008-06-30  Richard Sandiford  <rdsandiford@googlemail.com>
1104
1105         * elf.c (_bfd_elf_get_synthetic_symtab): Increment p by
1106         bed->s->int_rels_per_ext_rel.
1107
1108 2008-06-30  Richard Sandiford  <rdsandiford@googlemail.com>
1109
1110         * syms.c (BSF_SYNTHETIC): New flag.
1111         * elf.c (_bfd_elf_get_synthetic_symtab): Set it.
1112         * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Likewise.
1113         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise.
1114         * bfd-in.h (bfd_asymbol_flavour): Return bfd_target_unknown_flavour
1115         for synthetic symbols.
1116         * bfd-in2.h: Regenerate.
1117
1118 2008-06-30  Daniel Jacobowitz  <dan@codesourcery.com>
1119
1120         * elf32-arm.c (record_arm_to_thumb_glue, record_thumb_to_arm_glue):
1121         Expand comments.
1122         (arm_map_one_stub): Use | 1 when setting the low bit.
1123
1124 2008-06-29  Andreas Schwab  <schwab@suse.de>
1125
1126         * elf32-m68k.c (elf_m68k_relocate_section): Don't ignore existing
1127         addend on _GLOBAL_OFFSET_TABLE_.
1128
1129 2008-06-24  Daniel Jacobowitz  <dan@codesourcery.com>
1130
1131         * elf32-arm.c (STUB_ENTRY_NAME): Define.
1132         (arm_thumb_thumb_long_branch_stub): Use bx instead of b.n.
1133         (arm_pic_long_branch_stub): Mention R_ARM_REL32 instead of
1134         R_ARM_ABS32.
1135         (struct elf32_arm_stub_hash_entry): Add output_name.
1136         (arm_build_one_stub): Move offsets into the offset argument
1137         of _bfd_final_link_relocate.  Correct offset for
1138         arm_thumb_arm_v4t_stub_long_branch.
1139         (elf32_arm_size_stubs): Set stub_entry->output_name.
1140         (elf32_arm_ouput_plt_map_sym): Rename to elf32_arm_output_map_sym.
1141         Update all callers.
1142         (elf32_arm_output_stub_sym): New.
1143         (arm_map_one_stub): Correct formatting.  Use elf32_arm_output_stub_sym.
1144
1145 2008-06-20  Alan Modra  <amodra@bigpond.net.au>
1146
1147         * elf32-spu.c (needs_ovl_stub): Correctly return nonovl_stub for
1148         non-branch insns.
1149
1150 2008-06-20  Alan Modra  <amodra@bigpond.net.au>
1151
1152         * elf32-spu.c (build_stub): Allow wraparound on stub branches.
1153         (allocate_spuear_stubs, build_spuear_stubs): Return value from
1154         count_stub/build_stub.
1155         (spu_elf_build_stubs): Correct location of stub reloc error message.
1156
1157 2008-06-18  M R Swami Reddy <MR.Swami.Reddy@nsc.com>
1158
1159         * elf32-cr16.c (ELF_MACHINE_ALT1): Define to EM_CR16_OLD.
1160
1161 2008-06-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1162
1163         * configure: Regenerate.
1164
1165 2008-06-17  Alan Modra  <amodra@bigpond.net.au>
1166
1167         * elf32-spu.c (struct spu_link_hash_table): Add extra_stack_space.
1168         (spu_elf_check_vma): Add extra_stack_space param, copy to htab.
1169         (spu_elf_auto_overlay): Use it.
1170         (RECURSE_UNMARK): Define as 0.
1171         (unmark_overlay_section): Heed RECURSE_UNMARK.
1172         * elf32-spu.h (spu_elf_check_vma): Update prototype.
1173
1174 2008-06-12  DJ Delorie  <dj@redhat.com>
1175
1176         * elf32-m32c.c (ELF_MACHINE_ALT1): Define as EM_M32C_OLD.
1177
1178 2008-06-09  Paul Brook  <paul@codesourcery.com>
1179
1180         bfd/
1181         * elf32-arm.c (elf32_arm_merge_private_bfd_data): Allow BE8 shared
1182         libraries.
1183
1184 2008-06-09  Christophe Lyon  <christophe.lyon@st.com>
1185
1186         * elf32-arm.c (arm_stub_is_thumb): Define.
1187         (elf32_arm_final_link_relocate): Handle near mode switching stubs.
1188
1189 2008-06-07  Alan Modra  <amodra@bigpond.net.au>
1190
1191         * elf32-spu.c (spu_elf_auto_overlay): Add valid area below sp
1192         to stack calculation.
1193
1194 2008-06-06  Paul Brook  <paul@codesourcery.com>
1195
1196         bfd/
1197         * elf32-arm.c (elf32_arm_merge_private_bfd_data): Reject BE8 input.
1198
1199 2008-06-06  Alan Modra  <amodra@bigpond.net.au>
1200
1201         * elf32-spu.c (spu_elf_auto_overlay): Relax requirement that
1202         file names be unique.  Specify archive:path in overlay script.
1203
1204 2008-06-05  Alan Modra  <amodra@bigpond.net.au>
1205
1206         PR ld/6590
1207         * elf64-ppc.c (ppc_build_one_stub): Correct reloc offsets.
1208
1209 2008-06-04  Alan Modra  <amodra@bigpond.net.au>
1210
1211         * elf.c (ignore_section_sym): Don't test section sym value here.
1212         (elf_map_symbols): Instead check zero value here as was done prior
1213         to 2006-05-26 change.
1214
1215 2008-06-04  Nick Clifton  <nickc@redhat.com>
1216
1217         PR ld/6019
1218         * elf32-avr.c (elf32_avr_relax_section): Handle the case where
1219         there are no local symbols.
1220
1221 2008-06-04  Alan Modra  <amodra@bigpond.net.au>
1222
1223         * elf32-spu.c (get_sym_h): Don't attempt to read global syms.
1224         (process_stubs): Likewise.
1225         (discover_functions): Don't used cached symbols.
1226         (maybe_insert_function): Correct condition under which function
1227         array is realloc'd.
1228         (mark_functions_via_relocs): Delete unused variable.
1229
1230 2008-05-30  Frediano Ziglio  <frediano.ziglio@vodafone.com>
1231             Nick Clifton  <nickc@redhat.com>
1232
1233         PR ld/6511
1234         * elf64-hppa.c (allocate_global_data_opd): Default to using the
1235         dynamic symbol table for local function names in shared libraries.
1236
1237 2008-05-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
1238
1239         * elf.c (assign_file_positions_for_load_sections): Adjust pre-section
1240         gaps based on VMA and P_VADDR instead of LMA and P_PADDR addresses.
1241
1242 2008-05-28  Alan Modra  <amodra@bigpond.net.au>
1243
1244         * elf32-spu.c (spu_elf_object_p): New function.
1245         (elf_backend_object_p): Define.
1246         (build_stub): Correct second word of 8 byte overlay stubs.
1247         (spu_elf_relocate_section): Formatting.
1248
1249 2008-05-24  Carlos Eduardo Seo  <cseo@linux.vnet.ibm.com>
1250
1251         * elf.c (elfcore_write_register_note): New function.
1252         * elf-bfd.h (elfcore_write_register_note): New prototype.
1253
1254 2008-05-22  Christophe Lyon  <christophe.lyon@st.com>
1255
1256         * elf32-arm.c (arm_type_of_stub): Ignore STT_SECTION symbols.
1257         (elf32_arm_stub_add_mapping_symbol): Remove.
1258         (elf32_arm_add_stub): Don't generate mapping symbols. Change
1259         prototype.
1260         (elf32_arm_size_stubs): Use new elf32_arm_add_stub
1261         prototype. Don't generate thumb to arm glue for calls.
1262         (arm_map_one_stub): Define.
1263         (elf32_arm_output_arch_local_syms): Generate mapping symbols for
1264         long calls stubs.
1265
1266 2008-05-21  Nick Clifton  <nickc@redhat.com>
1267
1268         * elf32-arm.c (group_sections): Reformat comments.
1269
1270         PR ld/6446
1271         * elf32-frv.c (elf32_frv_relocate_section): Set EF_FRV_PIC by
1272         default (for FDPIC). Clear it if any inter-segment relocations
1273         are found.
1274
1275         * elf64-hppa.c (elf64_hppa_finalize_opd): Check NULL return
1276         from elf_link_hash_lookup.
1277
1278 2008-05-21  Maxim Kuvyrkov  <maxim@codesourcery.com>
1279
1280         Add multi-GOT support for m68k.
1281         * elf32-m68k.c (struct elf_m68k_link_hash_entry: got_entry_key,
1282         glist): New fields.
1283         (struct elf_m68k_got_entry_key, struct elf_m68k_got_entry,
1284         struct elf_m68k_got, struct elf_m68k_bfd2got_entry,
1285         struct elf_m68k_multi_got): New data structures.
1286         (struct elf_m68k_link_hash_table: local_gp_p, use_neg_got_offsets_p,
1287         allow_multigot_p, multi_got_): New fields.
1288         (elf_m68k_multi_got): New macro.
1289         (elf_m68k_link_hash_newfunc): Initialize new fields of
1290         struct elf_m68k_link_hash_entry.
1291         (elf_m68k_link_hash_table_create): Initialize new fields of
1292         struct elf_m68k_link_hash_table.
1293         (elf_m68k_link_hash_table_free): New static function implementing hook.
1294         (elf_m68k_init_got, elf_m68k_clear_got, elf_m68k_create_empty_got): New
1295         static functions for struct elf_m68k_got.
1296         (elf_m68k_init_got_entry_key, elf_m68k_got_entry_hash,
1297         elf_m68k_got_entry_eq): New static functions for
1298         struct elf_m68k_got_entry.
1299         (ELF_M68K_REL_8O_MAX_N_ENTRIES_IN_GOT,
1300         ELF_M68K_REL_8O_16O_MAX_N_ENTRIES_IN_GOT): New macros.
1301         (enum elf_m68k_get_entry_howto): New enum.
1302         (elf_m68k_get_got_entry, elf_m68k_update_got_entry_type,
1303         elf_m68k_remove_got_entry_type): New static functions for
1304         struct elf_m68k_got_entry.
1305         (elf_m68k_add_entry_to_got): New static function.
1306         (elf_m68k_bfd2got_entry_hash, elf_m68k_bfd2got_entry_eq,
1307         elf_m68k_bfd2got_entry_del, elf_m68k_get_bfd2got_entry): New static
1308         functions for struct elf_m68k_bfd2got_entry.
1309         (struct elf_m68k_can_merge_gots_arg, elf_m68k_can_merge_gots_1,
1310         elf_m68k_can_merge_gots): New traversal.
1311         (struct elf_m68k_merge_gots_arg, elf_m68k_merge_gots_1,
1312         elf_m68k_merge_gots): Ditto.
1313         (struct elf_m68k_finalize_got_offsets_arg,
1314         elf_m68k_finalize_got_offsets_1, elf_m68k_finalize_got_offsets): Ditto.
1315         (struct elf_m68k_partition_multi_got_arg,
1316         elf_m68k_partition_multi_got_1, elf_m68k_init_symndx2h_1,
1317         elf_m68k_partition_multi_got): Ditto.
1318         (elf_m68k_find_got_entry_ptr, elf_m68k_remove_got_entry): New static
1319         functions.
1320         (elf_m68k_copy_indirect_symbol): New static function implementing
1321         a hook.
1322         (elf_m68k_check_relocs): Update to add entries to multi-GOT.
1323         (elf_m68k_gc_sweep_hook): Update to remove entries from multi-GOT.
1324         (elf_m68k_always_size_sections): Assign BFDs to GOTs.
1325         (elf_m68k_relocate_section): Update to properly handle GOT relocations.
1326         (elf_m68k_finish_dynamic_symbol): Update to traverse all GOT entries
1327         of a global symbol.
1328         (bfd_elf_m68k_set_target_options): New function.
1329         (bfd_elf32_bfd_link_hash_table_free): Define hook.
1330         (bfd_elf32_bfd_final_link): Change expansion to bfd_elf_final_link
1331         to skip generic calculation of GOT offsets.
1332         (elf_backend_copy_indirect_symbol): Define hook.
1333         * bfd-in.h (bfd_elf_m68k_set_target_options): Declare function.
1334         * bfd-in2.h: Regenerate.
1335
1336 2008-05-21  André Johansen  <andrejoh@gmail.com>
1337
1338         PR 868
1339         * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free memory allocated
1340         for filenames in function tables and variable tables.
1341
1342 2008-05-19  Alan Modra  <amodra@bigpond.net.au>
1343
1344         PR 2995, PR 6473
1345         * elf.c (_bfd_elf_make_section_from_shdr): Leave lma equal to
1346         vma when all p_paddr fields are zero and there is more than
1347         one PT_LOAD header.
1348
1349 2008-05-15  Christophe Lyon  <christophe.lyon@st.com>
1350
1351         Add long call support for ARM.
1352         * elf32-arm.c (THM2_MAX_FWD_BRANCH_OFFSET): Define.
1353         (THM2_MAX_BWD_BRANCH_OFFSET): Define.
1354         (ARM_MAX_FWD_BRANCH_OFFSET): Define.
1355         (ARM_MAX_BWD_BRANCH_OFFSET): Define.
1356         (THM_MAX_FWD_BRANCH_OFFSET): Define.
1357         (THM_MAX_BWD_BRANCH_OFFSET): Define.
1358         (arm_long_branch_stub): Define.
1359         (arm_pic_long_branch_stub): Define.
1360         (arm_thumb_v4t_long_branch_stub): Define.
1361         (arm_thumb_thumb_long_branch_stub): Define.
1362         (arm_thumb_arm_v4t_long_branch_stub): Define.
1363         (STUB_SUFFIX): Define.
1364         (elf32_arm_stub_type): Define.
1365         (elf32_arm_stub_hash_entry): Define.
1366         (elf32_arm_link_hash_entry): Add stub_cache field.
1367         (arm_stub_hash_lookup): Define.
1368         (elf32_arm_link_hash_table): Add stub_hash_table, stub_bfd,
1369         add_stub_section, layout_sections_again, stub_group, bfd_count,
1370         top_index, input_list fields.
1371         (elf32_arm_link_hash_newfunc): Init new field.
1372         (stub_hash_newfunc): New function.
1373         (elf32_arm_link_hash_table_create): Init stub_hash_table.
1374         (elf32_arm_hash_table_free): New function.
1375         (arm_type_of_stub): New function.
1376         (elf32_arm_stub_name): New function.
1377         (elf32_arm_get_stub_entry): New function.
1378         (elf32_arm_stub_add_mapping_symbol): New function.
1379         (elf32_arm_add_stub): New function.
1380         (arm_build_one_stub): New function.
1381         (arm_size_one_stub): New function.
1382         (elf32_arm_setup_section_lists): New function.
1383         (elf32_arm_next_input_section): New function.
1384         (group_sections): New function.
1385         (elf32_arm_size_stubs): New function.
1386         (elf32_arm_build_stubs): New function.
1387         (bfd_elf32_arm_add_glue_sections_to_bfd): Skip stub sections.
1388         (bfd_elf32_arm_process_before_allocation): No longer handle
1389         R_ARM_CALL and R_ARM_THM_CALL.
1390         (using_thumb_only): New function.
1391         (elf32_arm_final_link_relocate): Redirect calls to stub if range
1392         exceeds encoding capabilities.
1393         (bfd_elf32_bfd_link_hash_table_free): Define.
1394         * bfd-in.h (R_ARM_max): Fix value to 130.
1395         (elf32_arm_setup_section_lists): Protype.
1396         (elf32_arm_next_input_section): Protype.
1397         (elf32_arm_size_stubs): Protype.
1398         (elf32_arm_build_stubs): Protype.
1399         * bfd-in2.h: Regenerate.
1400
1401 2008-05-14  Ulrich Weigand  <uweigand@de.ibm.com>
1402
1403         * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Fix memset calls.
1404         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Likewise.
1405
1406 2008-05-14  Alan Modra  <amodra@bigpond.net.au>
1407
1408         * Makefile.am: Run "make dep-am".
1409         * Makefile.in: Regenerate.
1410
1411 2008-05-14  Ulrich Weigand  <uweigand@de.ibm.com>
1412             Alan Modra  <amodra@bigpond.net.au>
1413
1414         * elf32-ppc.c (section_covers_vma): New function.
1415         (ppc_elf_get_synthetic_symtab): New function.
1416         (bfd_elf32_get_synthetic_symtab): Define.
1417         * elf64-ppc.c (section_covers_vma): New function.
1418         (ppc64_elf_get_synthetic_symtab): Generate sym@plt on glink branch
1419         table entries, and __glink_PLTresolve on resolver stub.
1420         (ppc64_elf_build_stubs): Rename __glink sym to __glink_PLTresolve.
1421
1422 2008-05-12  Alan Modra  <amodra@bigpond.net.au>
1423
1424         PR 6443
1425         * elf32-ppc.c (MUST_BE_DYN_RELOC): Delete.
1426         (must_be_dyn_reloc): New function.
1427         (ppc_elf_check_relocs): Don't set DF_STATIC_TLS for tprel relocs
1428         in pies.
1429         (ppc_elf_tls_optimize): Optimise pies.
1430         (ppc_elf_relocate_section): Use a section symbol rather than no
1431         symbol if possible for LD->IE TLS sequence, but don't error if
1432         we must use no symbol.
1433         * elf64-ppc.c (MUST_BE_DYN_RELOC): As for elf32-ppc.c.
1434         (must_be_dyn_reloc): Likewise.
1435         (ppc64_elf_check_relocs): Likewise.
1436         (ppc64_elf_tls_optimize): Likewise.
1437         (ppc64_elf_relocate_section): Likewise.
1438
1439 2008-05-12  Alan Modra  <amodra@bigpond.net.au>
1440
1441         * elf32-spu.c (spu_elf_relocate_section): Rename is_ea to is_ea_sym.
1442
1443 2008-05-10  Paul Pluzhnikov  <ppluzhnikov@google.com>
1444
1445         * elfcore.h (elf_core_file_p): Warn about core truncation.
1446
1447 2008-05-07  Bob Wilson  <bob.wilson@acm.org>
1448
1449         * elf32-xtensa.c (xtensa_property_section_name): New.
1450         (xtensa_make_property_section): New.
1451         (xtensa_get_property_section): Make static.  Do not create a new
1452         section if it does not exist.
1453
1454 2008-05-08  Alan Modra  <amodra@bigpond.net.au>
1455
1456         * elf32-spu.c (spu_elf_special_sections): Add "._ea".
1457         (spu_elf_relocate_section): Handle relocations against symbols
1458         defined in ._ea specially.
1459
1460 2008-05-03  Daniel Jacobowitz  <dan@codesourcery.com>
1461
1462         * elf32-arm.c (elf32_arm_symbian_link_hash_table_create): Use
1463         ARRAY_SIZE.
1464         (elf32_arm_symbian_plt_sym_val): New.
1465         (elf_backend_plt_sym_val): Define.
1466
1467 2008-05-03  Alan Modra  <amodra@bigpond.net.au>
1468
1469         PR 2995, PR 6473
1470         * elf.c (rewrite_elf_program_header): Rather than clearing
1471         p_paddr_valid at end, don't set it in the first place.  Delete
1472         comment no longer relevant.  When not p_paddr_valid, don't set
1473         paddr from vaddr, and don't set p_vaddr_offset.
1474
1475 2008-05-01  Cary Coutant  <ccoutant@google.com>
1476
1477         * elf.c (bfd_elf_get_str_section): Fix memory leak caused by
1478         corrupt string table.
1479
1480 2008-05-01  Joel Brobecker  <brobecker@adacore.com>
1481
1482         * cache.c (cache_bread_1): Renames cache_bread.
1483         (cache_bread): New function.
1484
1485 2008-05-01  Alan Modra  <amodra@bigpond.net.au>
1486
1487         PR 2995, PR 6473
1488         * elf.c (_bfd_elf_make_section_from_shdr): Always set lma from p_paddr.
1489         (assign_file_positions_for_load_sections): Combine nested "if".
1490         (copy_elf_program_header): Don't set p_paddr_valid or p_vaddr_offset
1491         when all header p_paddr fields are zero.
1492
1493 2008-04-30  Edmar Wienskoski  <edmar@freescale.com>
1494
1495         * cpu-powerpc.c (bfd_powerpc_archs): Add e500mc entry.
1496
1497 2008-04-29  Daniel Jacobowitz  <dan@codesourcery.com>
1498
1499         * elf.c (_bfd_elf_get_dynamic_reloc_upper_bound)
1500         (_bfd_elf_canonicalize_dynamic_reloc): Find dynamic relocations
1501         even if they are not loaded.
1502         * elflink.c (_bfd_elf_init_2_index_sections): Set data_index_section
1503         first.
1504
1505 2008-04-25  Jay Foad  <jay.foad@gmail.com>
1506
1507         * reloc16.c (bfd_coff_reloc16_get_value): Add support for
1508         undefined weak symbols.
1509
1510 2008-04-25  Nick Clifton  <nickc@redhat.com>
1511
1512         * po/vi.po: Updated Vietnamese translation.
1513
1514 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
1515
1516         * aclocal.m4: Regenerate.
1517         * configure: Regenerate.
1518
1519 2008-04-21  Cary Coutant  <ccoutant@google.com>
1520
1521         * archive.c (_bfd_write_archive_contents): Fix incorrect use of
1522         ARFMAG.
1523
1524 2008-04-21  Nathan Sidwell  <nathan@codesourcery.com>
1525
1526         * elfxx-mips.c (_bfd_mips_vxworks_adjust_dynamic_symbol): Don't
1527         set the value of undefined symbols in shared objects.
1528         (_bfd_mips_vxworks_finish_dynamic_symbol): Clear value for
1529         undefined symbols unless pointer equality is needed.
1530
1531 2008-04-18  Dennis Roberts  <dennis.roberts@sunquestinfo.com>
1532
1533         * aix5ppc-core.c: Define macros for the default architecture and
1534         machine for matching core files.
1535         (xcoff64_core_p): Set the architecture and machine to the default
1536         values defined in the macros mentioned above.
1537         * rs6000-core.c: Define macros to determine whether or not the
1538         core file header uses the core_dumpxx header format.
1539         (rs6000coff_core_p): Don't match core files that use the
1540         core_dumpxx header format.
1541
1542 2008-04-16  Pedro Alves  <pedro@codesourcery.com>
1543
1544         * config.bfd (i[3-7]86-*-dicos*, x86_64-*-dicos*): Add.
1545
1546 2008-04-16  David S. Miller  <davem@davemloft.net>
1547
1548         * reloc.c (BFD_RELOC_SPARC_GOTDATA_HIX22,
1549         BFD_RELOC_SPARC_GOTDATA_LOX10, BFD_RELOC_SPARC_GOTDATA_OP_HIX22,
1550         BFD_RELOC_SPARC_GOTDATA_OP_LOX10, BFD_RELOC_SPARC_GOTDATA_OP): New.
1551         * libbfd.h: Regnerate.
1552         * bfd-in2.h: Regenerate.
1553         * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Add entries for
1554         GOTDATA relocations.
1555         (sparc_reloc_map): Likewise.
1556         (_bfd_sparc_elf_check_relocs): Handle R_SPARC_GOTDATA_* like
1557         R_SPARC_GOT*.
1558         (_bfd_sparc_elf_gc_sweep_hook): Likewise.
1559         (_bfd_sparc_elf_relocate_section): Transform R_SPARC_GOTDATA_HIX22,
1560         R_SPARC_GOTDATA_LOX10, R_SPARC_GOTDATA_OP_HIX22, and
1561         R_SPARC_GOTDATA_OP_LOX10 into the equivalent R_SPARC_GOT* reloc.
1562         Simply ignore R_SPARC_GOTDATA_OP relocations.
1563
1564 2008-04-14  Aurelien Jarno  <aurelien@aurel32.net>
1565
1566         * configure.in: Link with the PIC version of libiberty on
1567         Linux/MIPS hosts.
1568         * configure: Regenerate.
1569
1570 2008-04-14  Edmar Wienskoski  <edmar@freescale.com>
1571
1572         * archures.c: Add bfd_mach_ppc_e500mc.
1573         * bfd-in2.h: Regenerate.
1574
1575 2008-04-08  Alan Modra  <amodra@bigpond.net.au>
1576
1577         * elf32-spu.c (spu_elf_build_stubs): Correct error message.
1578         (mark_functions_via_relocs): Remove premature init of symtab_hdr.
1579         (collect_overlays): Commment typo fix.
1580
1581 2008-04-08  Kees Cook  <kees@canonical.com>
1582
1583         * elflink.c (bfd_elf_size_dynamic_sections): Ignore GNU-stack note
1584         in EXEC_P bfds.
1585
1586 2008-04-08  Alan Modra  <amodra@bigpond.net.au>
1587
1588         * elf32-spu.c: Include libiberty.h.
1589         (struct spu_link_hash_table): Add local_stire, overlay_fixed, reserved,
1590         non_ovly_stub, spu_elf_load_ovl_mgr, spu_elf_open_overlay_script,
1591         spu_elf_relink, auto_overlay fields.
1592         (AUTO_OVERLAY, AUTO_RELINK, OVERLAY_RODATA): Define.
1593         (needs_ovl_stub): Flip test so that call to non-function warning
1594         is emitted during relocate_section rather than earlier.
1595         (spu_elf_check_vma): Stash --auto-overlay parameters, and clear
1596         auto_overlay if no section exceeds local store.
1597         (struct call_info): Add count, max_depth, is_pasted fields.
1598         (struct function_info): Add rodata, last_caller, call_count,
1599         depth, new visit flags.
1600         (insert_callee): Increment call count.
1601         (copy_callee): New function.
1602         (mark_functions_via_relocs): Investigate all reloc types to count
1603         possible function pointer stubs for --auto-overlay.  Track
1604         last_caller and increment function call_count.
1605         (pasted_function): Insert a "call" into call info for pasted section.
1606         (remove_cycles): Track max depth of calls.  Don't emit call graph
1607         pruning warning for --auto-overlay.
1608         (build_call_tree): Don't transfer_calls for --auto-overlay.
1609         Adjust remove_cycles call.
1610         (sort_calls, sort_lib, sort_bfds): New functions.
1611         (struct _mos_param, struct _uos_param, struct _cl_param): New.
1612         (mark_overlay_section, unmark_overlay_section): New functions.
1613         (collect_lib_sectios, auto_ovl_lib_functions): New functions.
1614         (collect_overlays, find_pasted_call): New functions.
1615         (sum_stack): Deal with is_pasted "calls".  Exit before printing
1616         when --auto-overlay.
1617         (spu_elf_auto_overlay): New function.
1618         (spu_elf_final_link): Call spu_elf_auto_overlay.
1619         * elf32-spu.h (spu_elf_check_vma): Update prototype.
1620
1621 2008-04-07  Alan Modra  <amodra@bigpond.net.au>
1622
1623         * elf32-spu.c (allocate_spuear_stubs): Ensure _SPUEAR_ symbol
1624         is defined in overlay section before creating a stub.
1625         (build_spuear_stubs): Likewise.
1626         (spu_elf_size_stubs, spu_elf_build_stubs): Adjust calls.
1627
1628 2008-04-02  Alan Modra  <amodra@bigpond.net.au>
1629
1630         * elf32-spu.c (insert_callee): Reorder call list so most recent
1631         call is always first.
1632         (interesting_section): Move.
1633         (mark_functions_via_relocs): Fold interesting_section and
1634         reloc_count tests in callers to here.  Simplify output section
1635         owner test.
1636         (discover_functions): Set "gaps" when no symbols and some
1637         "interesting_section".  Run pasted_function loop for no symbol
1638         bfds.
1639         (for_each_node, transfer_calls): New functions.
1640         (mark_non_root): Adjust to suit for_each_node.
1641         (call_graph_traverse): Likewise.  Fix memory leak.  Rename to..
1642         (remove_cycles): ..this.
1643         (build_call_tree): Use for_each_node and transfer_calls.
1644         (struct _sum_stack_param): New.
1645         (sum_stack): Adjust to suit for_each_node.  Return error on
1646         malloc failure.  Move code to print root node cumulative stack from..
1647         (spu_elf_stack_analysis): ..here.  Use for_each_node.
1648
1649 2008-03-31  Cary Coutant  <ccoutant@google.com>
1650
1651         PR 6006
1652         * archive.c (_bfd_slurp_extended_name_table): Change
1653         ARFMAG[0] to ARFMAG[1].
1654         (_bfd_construct_extended_name_table): Likewise.
1655
1656 2008-03-31  Daniel Jacobowitz  <dan@codesourcery.com>
1657
1658         * elfxx-mips.c (mips_elf_record_got_page_entry): Update comment.
1659         (_bfd_mips_elf_check_relocs): Update comments.  Always call
1660         mips_elf_record_got_page_entry for R_MIPS_GOT_PAGE.
1661
1662 2008-03-27  Cary Coutant  <ccoutant@google.com>
1663
1664         Add support for thin archives.
1665         * archive.c (_bfd_find_nested_archive): New function.
1666         (get_extended_arelt_filename): Add origin parameter.
1667         (_bfd_generic_read_ar_hdr_mag): Deal with extended name
1668         combined with a file offset.
1669         (append_relative_path): New function.
1670         (_bfd_get_elt_at_filepos): Deal with external members and
1671         nested archives.
1672         (bfd_generic_openr_next_archived_file): Thin archives.
1673         (bfd_generic_archive_p): Recognize new magic string.
1674         (adjust_relative_path): New function.
1675         (_bfd_construct_extended_name_table): Construct extended
1676         names for thin archive members.
1677         (_bfd_write_archive_contents): Emit new magic string, skip
1678         copying files for thin archives.
1679         * bfd-in.h (bfd_is_thin_archive): New macro.
1680         * bfd.c (struct bfd): New fields for thin archives.
1681         * libbfd-in.h (struct areltdata): New field for thin archives.
1682         * opncls.c (bfd_close): Delete BFDs for nested archives.
1683
1684 2008-03-25  Bernd Schmidt  <bernd.schmidt@analog.com>
1685
1686         * elf32-bfin.c (bfin_final_link_relocate): New function, wrapper around
1687         _bfd_final_link_relocate that also handles R_pcrel24 relocs.
1688         (bfinfdpic_relocate_section, bfin_relocate_section): Use it.
1689
1690 2008-03-25  Nathan Sidwell  <nathan@codesourcery.com>
1691
1692         * elf32-arm.c (elf32_arm_final_link_relocate): Skip dynamic relocs
1693         in vxworks tls_vars sections.
1694         (allocate_dynrelocs, elf32_arm_size_dynamic_sections): Likewise.
1695         * elf32-i386.c (allocate_dynrelocs,
1696         elf_i386_size_dynamic_sections, elf_i386_relocate_section): Likewise.
1697         * elf32-ppc.c (allocate_dynrelocs, ppc_elf_size_dynamic_sections,
1698         ppc_elf_relocate_section): Likewise.
1699         * elf32-sh.c (allocate_dynrelocs, sh_elf_size_dynamic_sections,
1700         sh_elf_relocate_section): Likewise.
1701         * elfxx-sparc.c (allocate_dynrelocs,
1702         _bfd_sparc_elf_size_dynamic_sections,
1703         _bfd_sparc_elf_relocate_section): Likewise.
1704
1705 2008-03-21  Adam Nemet  <anemet@caviumnetworks.com>
1706
1707         * elf.c (_bfd_elf_print_private_bfd_data): Use bfd_fprintf_vma to
1708         print the values from the dynamic section.
1709
1710 2008-03-20  Richard Sandiford  <rsandifo@nildram.co.uk>
1711
1712         * elfxx-mips.c (MIPS_ELF_GNU_GOT1_MASK): New macro.
1713         (_bfd_mips_elf_finish_dynamic_sections): Use it instead of 0x80000000.
1714
1715 2008-03-20  Alan Modra  <amodra@bigpond.net.au>
1716
1717         * elf32-spu.c (spu_elf_create_sections): Remove output_bfd parameter.
1718         (spu_elf_find_overlays, spu_elf_size_stubs): Likewise
1719         (process_stubs, discover_functions, build_call_tree): Likewise.
1720         (spu_elf_stack_analysis): Likewise.
1721         (spu_elf_check_vma): Likewise.  Move.
1722         (struct call_info): Make "is_tail" a bitfield.
1723         (insert_callee): Clear fun->start and set fun->is_func if we find
1724         a non-tail call.
1725         * elf32-spu.h (spu_elf_create_sections): Update prototype.
1726         (spu_elf_find_overlays, spu_elf_size_stubs, spu_elf_check_vma): Ditto.
1727
1728 2008-03-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
1729
1730         * aclocal.m4: Regenerate.
1731         * configure: Likewise.
1732         * Makefile.in: Likewise.
1733
1734 2008-03-16  H.J. Lu  <hongjiu.lu@intel.com>
1735
1736         PR ld/5789
1737         PR ld/5943
1738         * elf32-i386.c  (elf_i386_relocate_section): Issue an error
1739         for R_386_GOTOFF relocaton against undefined hidden/internal
1740         symbols when building a shared object.
1741
1742         * elf64-x86-64.c (elf64_x86_64_relocate_section): Issue an
1743         error for R_X86_64_PC8/R_X86_64_PC16/R_X86_64_PC32
1744         relocaton against undefined hidden/internal symbols when
1745         building a shared object.
1746         (elf64_x86_64_finish_dynamic_symbol): Return FALSE when symbol
1747         is referenced locally, but isn't defined in a regular file.
1748
1749 2008-03-15  H.J. Lu  <hongjiu.lu@intel.com>
1750
1751         * bfd-in.h (BFD_NO_FLAGS, HAS_RELOC, EXEC_P, HAS_LINENO,
1752         HAS_DEBUG, HAS_SYMS, HAS_LOCALS, DYNAMIC, WP_TEXT, D_PAGED,
1753         BFD_IS_RELAXABLE, BFD_TRADITIONAL_FORMAT, BFD_IN_MEMORY,
1754         HAS_LOAD_PAGE, BFD_LINKER_CREATED): Moved to ...
1755         * bfd.c: Here.
1756
1757         * bfd.c (bfd): Change cacheable, target_defaulted, opened_once,
1758         mtime_set, no_export, output_has_begun and has_armap to bit
1759         field.
1760
1761         * bfd-in2.h: Regenerated.
1762
1763 2008-03-14  Daniel Jacobowitz  <dan@codesourcery.com>
1764
1765         * cache.c (close_one): Remove mtime hack.
1766
1767 2008-03-14  H.J. Lu  <hongjiu.lu@intel.com>
1768
1769         PR ld/5913
1770         * elfxx-ia64.c (elfNN_ia64_tprel_base): Remove BFD_ASSERT.
1771         (elfNN_ia64_dtprel_base): Likewise.
1772         (elfNN_ia64_relocate_section): Go to missing_tls_sec if
1773         tls_sec is NULL before calling elfNN_ia64_tprel_base or
1774         elfNN_ia64_dtprel_base.  Report unsupported TLS relocations.
1775
1776 2008-03-14  Alan Modra  <amodra@bigpond.net.au>
1777
1778         * elf32-spu.c (process_stubs, spu_elf_relocate_section): Move
1779         common code to..
1780         (maybe_needs_stub): ..here, a new function that also omits stubs
1781         for .eh_frame, and..
1782         (needs_ovl_stub): ..here.  Create stubs for labels in code section
1783         referenced by switch jump table.
1784         (spu_elf_find_overlays): Set htab->ovly_load and htab->ovly_return.
1785         (enum _insn_type): Delete.
1786         (enum _stub_type): New.
1787         (count_stub, build_stub): Adjust.
1788         (allocate_spuear_stubs, build_spuear_stubs): Adjust.
1789
1790 2008-03-13  Alan Modra  <amodra@bigpond.net.au>
1791
1792         * elf.c (_bfd_elf_make_section_from_shdr): Remove unnecessary cast.
1793         (_bfd_elf_assign_file_position_for_section): Simplify align.
1794         (_bfd_elf_init_reloc_shdr): Ensure shift expression wide enough
1795         for sh_addralign.
1796         (elf_fake_sections, swap_out_syms): Likewise.
1797         * elflink.c (bfd_elf_final_link): Likewise.
1798
1799 2008-03-13  Alan Modra  <amodra@bigpond.net.au>
1800
1801         * Makefile.am: Run "make dep-am".
1802         * Makefile.in: Regenerate.
1803         * po/SRC-POTFILES.in: Regenerate.
1804
1805 2008-03-12  Bernd Schmidt  <bernd.schmidt@analog.com>
1806
1807         From Jie Zhang <jie.zhang@analog.com>
1808         * elf32-bfin.c (struct bfinfdpic_relocs_info): Make got17m4,
1809         gothilo, fd, fdgot17m4, fdgothilo, fdgoff17m4, fdgoffhilo,
1810         gotoff, call and sym not bitfields.
1811         (bfinfdpic_gc_sweep_hook): New function; update the relocation
1812         information for the relocations of the section being removed.
1813         (bfinfdpic_check_relocs): Accumulate the number of relocations
1814         which set got17m4, gothilo, fd, fdgot17m4, fdgothilo, fdgoff17m4,
1815         fdgoffhilo, gotoff, call and sym fields.
1816         (elf_backend_gc_sweep_hook): Redefine for FD-PIC.
1817
1818 2008-03-12  Alan Modra  <amodra@bigpond.net.au>
1819
1820         PR 5900
1821         * elf-bfd.h: Include elf/internal.h after elf/external.h.
1822         * elfcode.h (elf_swap_symbol_in): Map reserved shndx range.
1823         (elf_swap_symbol_out): Adjust SHN_XINDEX test.
1824         (elf_swap_ehdr_out): Mask SHN_LORESERVE and SHN_XINDEX to values
1825         seen in external structs.
1826         (valid_section_index_p): Delete.
1827         (elf_object_p): Don't increment section numbers over reserved range.
1828         Simplify test for valid sh_link, sh_info and e_shstrndx fields.
1829         (elf_write_shdrs_and_ehdr): Mask SHN_LORESERVE and SHN_XINDEX to values
1830         seen in external structs.  Don't increment section numbers over
1831         reserved range.
1832         * elf.c (bfd_elf_sym_name): Remove redundant tests on st_shndx.
1833         (bfd_section_from_shdr): Likewise.
1834         (group_signature): Range check before accessing elf_elfsections.
1835         (_bfd_elf_setup_sections): Likewise.
1836         (bfd_section_from_shdr): Likewise.
1837         (bfd_section_from_shdr): Don't increment section number over
1838         reserved sections.
1839         (assign_file_positions_for_non_load_sections): Likewise.
1840         (assign_file_positions_except_relocs): Likewise.
1841         (_bfd_elf_write_object_contents): Likewise.
1842         (assign_section_numbers): Likewise.  Adjust for changed SHN_*.
1843         (prep_headers): Delete unused variable.
1844         * elflink.c (bfd_elf_link_record_local_dynamic_symbol): Adjust
1845         for changed SHN_* values.
1846         (check_dynsym, elf_link_input_bfd): Likewise.
1847         (bfd_elf_final_link): Likewise.  Don't skip over reserved section
1848         range.
1849         (elf_fixup_link_order): Check that sh_link field is valid.
1850         * elf-hppa.h (elf_hppa_add_symbol_hook): Make "index" unsigned.
1851         * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Range check before
1852         accesssing elf_elfsections.
1853         * elf32-avr.c (elf32_avr_size_stubs): Likewise.
1854         * elf32-hppa.c (elf32_hppa_size_stubs): Likewise.
1855         * elf32-m68hc1x.c (elf32_m68hc11_size_stubs): Likewise.
1856         * elf64-hppa.c (elf64_hppa_check_relocs): Adjust for changed
1857         SHN_* defines.  Test for SHN_BAD return from
1858         _bfd_elf_section_from_bfd_section
1859
1860 2008-03-12  Alan Modra  <amodra@bigpond.net.au>
1861
1862         * elf-bfd.h (_bfd_elf_section_from_bfd_section): Update prototype.
1863         * elf.c (_bfd_elf_section_from_bfd_section): Return unsigned int,
1864         SHN_BAD on error.
1865         (_bfd_elf_print_private_bfd_data): Test for SHN_BAD result from
1866         _bfd_elf_section_from_bfd_section, not -1.
1867         (swap_out_syms): Likewise.
1868         * elflink.c (elf_link_add_object_symbols): Likewise.
1869         (bfd_elf_get_bfd_needed_list): Likewise.
1870         (bfd_elf_match_symbols_in_sections): Likewise.
1871         (elf_link_add_object_symbols): Don't bother testing for symbols
1872         using normal sections before calling bfd_section_from_elf_index.
1873         (elf_link_input_bfd, bfd_elf_final_link): Likewise.
1874         (bfd_elf_reloc_symbol_deleted_p): Likewise.
1875         * elfcode.h (elf_slurp_symbol_table): Likewise.
1876         * elf32-spu.c (get_sym_h): Likewise.
1877         * elf32-xtensa.c (get_elf_r_symndx_section): Likewise.
1878         * elf64-ppc.c (opd_entry_value, get_sym_h, ppc64_elf_edit_toc): Ditto.
1879         * elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
1880
1881 2008-03-11  Alan Modra  <amodra@bigpond.net.au>
1882
1883         * elf32-spu.c (spu_elf_relocate_section): Test identical conditions
1884         to those in process_stubs for overlay symbols.
1885
1886 2008-03-09  Paul Brook  <paul@codesourcery.com>
1887
1888         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
1889         Tag_VFP_arch values.
1890
1891 2008-03-08  Paul Brook  <paul@codesourcery.com>
1892
1893         * elf32-arm.c (insert_thumb_branch): Rewrite.
1894         (elf32_thumb_to_arm_stub): Use new insert_thumb_branch.
1895
1896 2008-03-07  Paul Brook  <paul@codesourcery.com>
1897
1898         * elf32-arm.c (elf32_arm_howto_table_1): Fix bitmasks for MOVW and
1899         MOVT relocations.
1900         (elf32_arm_final_link_relocate): Fix off by one MOVW/MOVT sign
1901         extension.
1902         (elf32_arm_relocate_section): Handle MOVW and MOVT
1903         relocations.  Improve safety check for other weird relocations.
1904         (elf32_arm_check_relocs): Only set h->needs_plt for branch/call
1905         relocations.
1906
1907 2008-03-03  Bob Wilson  <bob.wilson@acm.org>
1908
1909         * xtensa-isa.c (xtensa_isa_num_pipe_stages): Make max_stage static and
1910         only compute its value once.
1911
1912 2008-03-03  Alan Modra  <amodra@bigpond.net.au>
1913
1914         * elf32-spu.c (struct got_entry): Add "addend" field.
1915         (count_stub, build_stub): Use a new stub if relocation addend
1916         differs from existing stubs for this symbol.
1917         (process_stubs): Deal with addends.
1918         (spu_elf_relocate_section, spu_elf_output_symbol_hook): Likewise.
1919
1920 2008-03-02  H.J. Lu  <hongjiu.lu@intel.com>
1921
1922         PR ld/5789
1923         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return true
1924         for hidden and local symbols.
1925
1926 2008-03-03  Alan Modra  <amodra@bigpond.net.au>
1927
1928         * elf32-ppc.c (allocate_dynrelocs): Discard relocs on
1929         undefined symbols with internal or hidden visibility.
1930         (ppc_elf_relocate_section): Likewise.  Use SYMBOL_CALLS_LOCAL
1931         rather than SYMBOL_REFERENCES_LOCAL on branches.  Don't
1932         return immediately on dynamic reloc error.
1933
1934 2008-03-01  Alan Modra  <amodra@bigpond.net.au>
1935
1936         * elf64-ppc.c (build_plt_stub): Add relocs on plt call stubs
1937         if emitrelocations.
1938         (get_relocs): New function, split out from..
1939         (ppc_build_one_stub): ..here.  Add relocs on plt_branch stubs if
1940         emitrelocations.  Remove indx temp.
1941         (ppc_size_one_stub): Count new stub relocs.
1942         (ppc64_elf_size_stubs): Count new glink reloc.
1943         (ppc64_elf_build_stubs): Emit glink reloc if emitrelocations.
1944         (ppc64_elf_finish_dynamic_sections): Output glink relocs.
1945         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Describe non-pic
1946         glink code.
1947
1948 2008-02-28  Alan Modra  <amodra@bigpond.net.au>
1949
1950         * elf32-spu.c (mark_functions_via_relocs): Don't assume that
1951         the "->start" pointer reaches to function origin, so that we
1952         can handle functions split over more than two sections.
1953         (build_call_tree): Likewise.
1954         (pasted_function): Don't attempt to set fun->start back to the
1955         function origin, just go back one section.
1956
1957 2008-02-27  Catherine Moore  <clm@codesourcery.com>
1958
1959         * elf.c ( _bfd_elf_print_private_bfd_data): Call
1960         elf_backend_get_target_dtag if defined.
1961         * elf32-mips.c (elf_backend_get_target_dtag): Define.
1962         * elf64-mips.c: Likewise.
1963         * elfn32-mips.c: Likewise.
1964         * elfxx-mips.c (_bfd_mips_elf_get_target_dtag): New.
1965         * elfxx-mips.h (_bfd_mips_elf_get_target_dtag): Declare.
1966         * elf-bfd.h (elf_backend_get_target_dtag): Add prototype.
1967         * elfxx-target.h (elf_backend_get_target_dtag): Add default.
1968         (elf_backend_data): Add elf_backend_get_target_dtag.
1969
1970 2008-02-26  Alan Modra  <amodra@bigpond.net.au>
1971
1972         * elf32-ppc.c (ppc_elf_check_relocs): Set pointer_equality_needed
1973         for R_PPC_REL32 syms.  Don't set non_got_ref on branch reloc syms,
1974         and assume branch relocs are not dynamic when non-shared.
1975         (readonly_dynrelocs): New function, split out from..
1976         (maybe_set_textrel): ..here, renamed from old readonly_dynrelocs.
1977         (ppc_elf_adjust_dynamic_symbol): For symbols generating plt entries,
1978         clear non_got_ref..
1979         (allocate_dynrelocs): ..and don't set u.def for undefined weak.
1980         Do allow dynamic relocs on undefined symbols.
1981         (ppc_elf_adjust_dynamic_symbol): Use readonly_dynrelocs.
1982         (ppc_elf_relocate_section): Mirror dynamic reloc changes in
1983         check_relocs.
1984         (ppc_elf_finish_dynamic_symbol): Don't give a warning on weak
1985         plt symbols needing pointer_equality_needed.
1986
1987 2008-02-23  Alan Modra  <amodra@bigpond.net.au>
1988
1989         * elf32-ppc.c (ppc_elf_check_relocs): Revert non_got_ref change.
1990
1991 2008-02-23  Alan Modra  <amodra@bigpond.net.au>
1992
1993         * elf32-ppc.c (ppc_elf_copy_indirect_symbol): Copy
1994         pointer_equality_needed.
1995         (ppc_elf_check_relocs): Split out non-branch relocs from others
1996         that might emit dynamic relocs.  Set pointer_equality_needed
1997         for their symbols.  Don't set non_got_ref on branch reloc symbols.
1998         (ppc_elf_hash_symbol): New function.
1999         (elf_backend_hash_symbol): Define.
2000         (ppc_elf_finish_dynamic_symbol): Handle pointer_equality_needed.
2001         Error if pointer_equality_needed on weak plt symbol.
2002
2003 2008-02-22  H.J. Lu  <hongjiu.lu@intel.com>
2004
2005         PR ld/5788
2006         * elflink.c (elf_create_symbuf): Correct buffer size and
2007         position.
2008
2009 2008-02-22  Nick Clifton  <nickc@redhat.com>
2010
2011         PR 868
2012         * dwarf2.c: Revert previous patch.  All of the allocate memory is
2013         on an obstack which will be freed at some other time.
2014
2015 2008-02-20  Nick Clifton  <nickc@redhat.com>
2016
2017         PR 868
2018         * libbfd.c (bfd_realloc_or_free): New function.  Performs like
2019         bfd_realloc, but if the (re)allocation fails, the pointer is
2020         freed.
2021         * libbfd-in.h: Prototype.
2022         * libbfd.h: Regenerate.
2023         * bfdio.c (bfd_bwrite): Use the new function.
2024         (bfd_seek): Likewise.
2025         * bfdwin.c:(bfd_get_file_window): Likewise.
2026         * elf-strtab.c (_bfd_elf_strtab_add): Likewise.
2027         * elf32-ppc.c (ppc_elf_relax_section): Likewise.
2028         * elf32-xtensa.c (vsprintf_msg): Likewise.
2029         * mach-o.c (bfd_mach_o_core_fetch_environment): Likewise.
2030         * stabs.c (_bfd_link_seciton_stabs): Likewise.
2031         * vms-misc.c (_bfd_vms_get_record): Likewise.
2032         * vms-tir.c (check_section): Likewise.
2033         * vms.c (vms_new_section_hook): Likewise.
2034         * elf32-arm.c (elf32_arm_section_map_add): Check that the
2035         allocation of sec_data->map succeeded before using it.
2036         * elflink.c (elf_link_output_sym): Do not overwrite finfo->
2037         symshndxbuf until it is known that the reallocation succeeded.
2038
2039 2008-02-20  Diogo de Carvalho Kraemer  <diogo@kraemer.eng.br>
2040             Nick Clifton  <nickc@redhat.com>
2041
2042         PR 868
2043         * dwarf2.c (read_abbrevs): Free the abbreviation table if we run
2044         out of memory.
2045         (decode_line_info): Free the line_info_table before returning a
2046         failure result.
2047         (_bfd_dwarf2_cleanup_debug_info): Free the abbreviation table.
2048         Free the line table.  Free the function table.  Free the variable
2049         table.
2050
2051 2008-02-17  Mark Kettenis  <kettenis@gnu.org>
2052
2053         * elf.c (swap_out_syms): Avoid preprocessing directive within
2054         macro arg.
2055
2056 2008-02-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
2057
2058         * elf.c (assign_file_positions_for_load_sections): Set the type of
2059         PT_NOTE sections to SHT_NOTE.
2060
2061 2008-02-17  Ulrich Weigand  <uweigand@de.ibm.com>
2062
2063         * simple.c (bfd_simple_get_relocated_section_contents): Set
2064         link_info.output_bfd.
2065
2066 2008-02-16  Nathan Sidwell  <nathan@codesourcery.com>
2067
2068         * dwarf2.c (find_line): Don't trust debug information after an
2069         unparseable compilation unit.
2070
2071 2008-02-15  Alan Modra  <amodra@bigpond.net.au>
2072
2073         PR 5765
2074         * section.c (SEC_LINK_DUPLICATES): Correct.  Renumber following flags.
2075         * bfd-in2.h: Regenerate.
2076
2077 2008-02-15  Alan Modra  <amodra@bigpond.net.au>
2078
2079         * elf-bfd.h (enum elf_object_id): Add HPPA_ELF_TDATA.
2080         * elf.c (bfd_elf_allocate_object): Don't check for already allocated
2081         tdata.
2082         * elf32-hppa.c (elf32_hppa_mkobject): New function.
2083         (bfd_elf32_mkobject): Define.
2084         * elf32-ppc.c (is_ppc_elf_target): Delete.  Replace all uses with..
2085         (is_ppc_elf): ..this new macro.
2086         * elf64-ppc.c (is_ppc64_elf_target): Delete.  Replace all uses with..
2087         (is_ppc64_elf): ..this new macro.
2088
2089 2008-02-15  Alan Modra  <amodra@bigpond.net.au>
2090
2091         * elflink.c: Replace all accesses to hash->creator field with
2092         output_bfd->xvec.
2093         * cofflink.c: Likewise.
2094         * coff-h8300.c: Likewise.
2095         * ecoff.c: Likewise.
2096         * elf32-m68hc1x.c: Likewise.
2097         * elf32-ppc.c: Likewise.
2098         * elf64-alpha.c: Likewise.
2099         * elf64-ppc.c: Likewise.
2100         * elf64-sparc.c: Likewise.
2101         * elfxx-mips.c: Likewise.
2102         * i386linux.c: Likewise.
2103         * m68klinux.c: Likewise.
2104         * sparclinux.c: Likewise.
2105         * sunos.c: Likewise.
2106         * xcofflink.c: Likewise.
2107         * linker.c: Likewise.
2108         (_bfd_link_hash_table_init): Don't store creator.
2109
2110 2008-02-14  Peter Jones  <pjones@redhat.com>
2111
2112         * efi-rtdrv-ia32.c: New file.
2113         * efi-bsdrv-ia32.c: New file.
2114         * efi-rtdrv-ia64.c: New file.
2115         * efi-bsdrv-ia64.c: New file.
2116         * efi-rtdrv-x86_64.c: New file.
2117         * efi-bsdrv-x86_64.c: New file.
2118         * peicode.h (pe_bfd_object_p): Add support for boot service and
2119         runtime service drivers.
2120         * libpei.h: Add macros for EFI formats, and rename the efi application
2121         format macros to disambiguate.
2122         * targets.c: Add bfd_target _vec externs.
2123         (_bfd_tar): Add EFI _vec entries.
2124         * config.bfd: Add EFI vectors into the selection routines.
2125         * configure.in: add EFI _vec entries.
2126         * configure: Regenerate.
2127         * Makefile.am: Add EFI files.
2128         * Makefile.in: Regenerate.
2129
2130 2008-02-14  Nathan Sidwell  <nathan@codesourcery.com>
2131
2132         * dwarf1.c (struct dwarf1_debug): Add syms member.
2133         (alloc_dwarf1_unit, alloc_dwarf1_func): Check for out of memory.
2134         (parse_line_table, _bfd_dwarf1_find_nearest_line): Relocate
2135         section contents, check for out of memory.
2136
2137         * dwarf1.c (struct dwarf1_debug): Change data pointers to bfd_byte.
2138         (parse_die): Change data pointers to bfd_byte.
2139         (parse_line_table, parse_functions_in_unit): Likewise.
2140
2141 2008-02-14  Alan Modra  <amodra@bigpond.net.au>
2142
2143         * elflink.c (compute_bucket_count): Warning fixes.
2144
2145 2008-02-12  DJ Delorie  <dj@redhat.com>
2146
2147         * elf32-iq2000.c (iq2000_elf_relocate_section): Adjust addend of
2148         relocation pointing to local symbol in merged section.
2149
2150         * elf32-iq2000.c (iq2000_elf_relocate_offset16): New.
2151         (iq2000_elf_relocate_section): Call it.
2152
2153 2008-02-12  Nick Clifton  <nickc@redhat.com>
2154
2155         PR ld/5692
2156         * elf-bfd.h (enum elf_object_id): New enum, used to identify
2157         target specific extensions to the elf_obj_tdata structure.
2158         (struct elf_obj_tdata): New field 'object_id'.
2159         (elf_object_id, elf_program_header_size, elf_symtab_hdr): New
2160         macros for accessing fields in the elf_obj_tdata structure.
2161         (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object.
2162         (bfd_elf_allocate_object): New function.
2163         * elf.c (bfd_elf_mkobject): Rename to bfd_elf_make_generic_object
2164         and implement by calling bfd_elf_allocate_object.
2165         (bfd_elf_allocate_object): New function: Allocates an
2166         elf_obj_tdata structure, possibly with a target specific
2167         extension.
2168         * elfxx-target.h (bfd_elfNN_mkobject): Use
2169         bfd_elf_make_generic_object as the default value.
2170         * elf32-arm.c (elf32_arm_obj_tdata): Rename to elf_arm_obj_tdata
2171         for consistency with other, similar structures.
2172         (is_arm_elf): New macro.  Checks a BFD to make sure that is an ARM
2173         ELF bfd.
2174         (elf32_arm_mkobject): Call bfd_elf_allocate_object.
2175         (bfd_elf32_arm_vfp11_erratum_scan): Use is_arm_elf macro to check
2176         the bfd being processed.
2177         (bfd_elf32_arm_vfp11_fix_veneer_locations): Likewise.
2178         (bfd_elf32_arm_set_target_relocs): Likewise.
2179         (bfd_elf32_arm_final_link_relocate): Likewise.
2180         (bfd_elf32_arm_copy_private_bfd_data): Likewise.
2181         (bfd_elf32_arm_merge_eabi_attributes): Likewise.
2182         (bfd_elf32_arm_merge_private_bfd_data): Likewise.
2183         (bfd_elf32_arm_check_relocs): Likewise.
2184         (bfd_elf32_arm_gc_mark_extra_sections): Likewise.
2185         (bfd_elf32_arm_size_dynamic_sections): Likewise.
2186         (bfd_elf32_arm_process_before_allocation): Use elf_symtab_hdr.
2187         (bfd_elf32_arm_init_maps): Likewise.
2188         (bfd_elf32_arm_final_link_relocate): Likewise.
2189         (bfd_elf32_arm_relocate_section): Likewise.
2190         (bfd_elf32_arm_gc_sweep_hook): Likewise.
2191         (bfd_elf32_arm_check_relocs): Likewise.
2192         (bfd_elf32_arm_size_dynamic_sections): Likewise.
2193         * elf32-i386.c (elf_i386_mkobject): Call bfd_elf_allocate_object.
2194         (is_i386_elf): New macro.  Checks a BFD to make sure that is an x86
2195         ELF bfd.
2196         (elf_i386_check_relocs): Use is_i386_elf macro to check    the bfd
2197         being processed.
2198         (elf_i386_size_dynamic_sections): Likewise.
2199         (elf_i386_relocate_section): Likewise.
2200         (elf_i386_check_relocs): Use elf_symtab_hdr.
2201         (elf_i386_gc_sweep_hook): Likewise.
2202         (elf_i386_size_dynamic_sections): Likewise.
2203         (elf_i386_relocate_section): Likewise.
2204         * elf32-ppc.c (ppc_elf_mkobject): Call bfd_elf_allocate_object.
2205         (elf_create_pointer_linker_section): Use is_ppc_elf_target to
2206         verify that the bfd before accessing target specific fields.
2207         (ppc_elf_check_relocs): Likewise.
2208         (elf_finish_pointer_linker_section): Likewise.
2209         (elf_create_pointer_linker_section): Use elf_symtab_hdr.
2210         (ppc_elf_check_relocs): Likewise.
2211         (ppc_elf_gc_sweep_hook): Likewise.
2212         (ppc_elf_tls_optimize): Likewise.
2213         (ppc_elf_size_dynamic_sections): Likewise.
2214         (ppc_elf_relax_section): Likewise.
2215         (ppc_elf_relocate_section): Likewise.
2216         * elf32-s390.c (struct elf_s390_obj_tdata): Add a comment
2217         reminding programmers to keep this structure in sync with the one
2218         defined in elf64-s390.c.
2219         (elf_s390_mkobject): Call bfd_elf_allocate_object.
2220         (is_s390_elf): New macro.  Checks a BFD to make sure that is an s390
2221         ELF bfd.
2222         (elf_s390_check_relocs): Use is_s390_elf macro to check    the bfd
2223         being processed.
2224         (elf_s390_size_dynamic_sections): Likewise.
2225         (elf_s390_relocate_section): Likewise.
2226         (elf_s390_check_relocs): Use elf_symtab_hdr.
2227         (elf_s390_gc_sweep_hook): Likewise.
2228         (elf_s390_size_dynamic_sections): Likewise.
2229         (elf_s390_relocate_section): Likewise.
2230         * elf32-sh.c (sh_elf_mkobject): Call bfd_elf_allocate_object.
2231         (is_sh_elf): New macro.  Checks a BFD to make sure that is an SH
2232         ELF bfd.
2233         (sh_elf_size_dynamic_sections): Use is_sh_elf macro to check the
2234         bfd being processed.
2235         (sh_elf_relocate_section): Likewise.
2236         (sh_elf_check_relocs): Likewise.
2237         (sh_elf_copy_private_data): Likewise.
2238         (sh_elf_relax_section): Use elf_symtab_hdr.
2239         (sh_elf_size_dynamic_sections): Likewise.
2240         (sh_elf_relocate_section): Likewise.
2241         (sh_elf_get_relocated_section_contents): Likewise.
2242         (sh_elf_gc_sweep_hook): Likewise.
2243         (sh_elf_check_relocs): Likewise.
2244         * elf64-alpha.c (elf64_alpha_mkobject): Call bfd_elf_allocate_object.
2245         (is_alpha_elf): New macro.  Checks a BFD to make sure that is an
2246         Alpha ELF bfd.
2247         (elf64_alpha_create_got_section): Use is_alpha_elf macro to check
2248         the bfd being processed.
2249         (elf64_alpha_create_dynamic_section): Likewise.
2250         (elf64_alpha_check_relocs): Likewise.
2251         (elf64_alpha_size_got_sections): Likewise.
2252         (elf64_alpha_relax_section): Likewise.
2253         (elf64_alpha_relocate_section): Likewise.
2254         (elf64_alpha_final_link): Likewise.
2255         (elf64_alpha_check_relocs): Use elf_symtab_hdr.
2256         (elf64_alpha_relax_section): Likewise.
2257         (elf64_alpha_relocate_section_r): Likewise.
2258         (elf64_alpha_relocate_section): Likewise.
2259         * elf64-ppc.c (ppc64_elf_mkobject): Call bfd_elf_allocate_object.
2260         (ppc64_elf_check_relocs): Use is_ppc64_elf_target to check the bfd
2261         being processed.
2262         (opd_entry_value): Likewise.
2263         (allocate_dynrelocs): Likewise.
2264         (ppc64_elf_relocate_section): Likewise.
2265         (ppc64_elf_check_relocs): Use elf_symtab_hdr.
2266         (opd_entry_value): Likewise.
2267         (ppc64_elf_gc_sweep_hook): Likewise.
2268         (get_sym_h): Likewise.
2269         (ppc64_elf_edit_opd): Likewise.
2270         (ppc64_elf_tls_optimize): Likewise.
2271         (ppc64_elf_edit_toc): Likewise.
2272         (ppc64_elf_size_dynamic_sections): Likewise.
2273         (toc_adjusting_stub_needed): Likewise.
2274         (ppc64_elf_size_stubs): Likewise.
2275         (ppc64_elf_relocate_section): Likewise.
2276         * elf64-s390.c (struct elf_s390_obj_tdata): Add a comment
2277         reminding programmers to keep this structure in sync with the one
2278         defined in elf32-s390.c.
2279         (elf_s390_mkobject): Call bfd_elf_allocate_object.
2280         (is_s390_elf): New macro.  Checks a BFD to make sure that is an s390
2281         ELF bfd.
2282         (elf_s390_check_relocs): Use is_s390_elf macro to check    the bfd
2283         being processed.
2284         (elf_s390_size_dynamic_sections): Likewise.
2285         (elf_s390_relocate_section): Likewise.
2286         (elf_s390_check_relocs): Use elf_symtab_hdr.
2287         (elf_s390_gc_sweep_hook): Likewise.
2288         (elf_s390_size_dynamic_sections): Likewise.
2289         (elf_s390_relocate_section): Likewise.
2290         * elf64-x86_64.c (elf64_x86_64_mkobject): Call bfd_elf_allocate_object.
2291         (is_x86_64_elf): New macro.  Checks a BFD to make sure that is an
2292         x86_64 ELF bfd.
2293         (elf64_x86_64_check_relocs): Use is_x86_64_elf macro to check the bfd
2294         being processed.
2295         (elf64_x86_64_size_dynamic_sections): Likewise.
2296         (elf64_x86_64_relocate_section): Likewise.
2297         (elf64_x86_64_check_relocs): Use elf_symtab_hdr.
2298         (elf64_x86_64_gc_sweep_hook): Likewise.
2299         (elf64_x86_64_size_dynamic_sections): Likewise.
2300         (elf64_x86_64_relocate_section): Likewise.
2301         * elfxx-sparc.c (_bfd_sparc_elf_mkobject): Call bfd_elf_allocate_object.
2302         (is_sparc_elf): New macro.  Checks a BFD to make sure that is a Sparc
2303         ELF bfd.
2304         (_bfd_sparc_elf_check_relocs): Use is_sparc_elf macro to check the
2305         bfd being processed.
2306         (_bfd_sparc_elf_gc_sweep_hook): Likewise.
2307         (_bfd_sparc_elf_size_dynamic_sections): Likewise.
2308         (_bfd_sparc_elf_check_relocs): Use elf_symtab_hdr.
2309         (_bfd_sparc_elf_gc_sweep_hook): Likewise.
2310         (_bfd_sparc_elf_size_dynamic_sections): Likewise.
2311         (_bfd_sparc_elf_relocate_section): Likewise.
2312
2313 2008-02-12  Alan Modra  <amodra@bigpond.net.au>
2314
2315         PR 5303, 5755
2316         * arange-set.c: Delete.
2317         * arange-set.h: Delete.
2318         * dwarf2.c: Revert 2007-09-21 changes.
2319         * Makefile.am: Likewise.
2320         * Makefile.in: Regenerate.
2321         * po/SRC-POTFILES.in: Regenerate.
2322
2323 2008-02-11  Bernd Schmidt  <bernd.schmidt@analog.com>
2324
2325         * elf32-bfin.c (bfin_relocate_section): Set up dynobj before using it
2326         if necessary.
2327         (elf32_bfin_merge_private_bfd_data): Simplify, and ensure object type
2328         mismatches are detected.
2329
2330         * elf32-bfin.c (bfinfdpic_relocate_section): Take more care not to
2331         emit invalid relocs or rofixup entries for deleted .eh_frame entries.
2332
2333 2008-02-11  Daniel Jacobowitz  <dan@codesourcery.com>
2334
2335         * cache.c (cache_bread): Set bfd_error_file_truncated if EOF
2336         was reached.
2337         * srec.c (srec_scan): Calculate the checksum.  Complain on mismatch.
2338
2339 2008-02-07  Alan Modra  <amodra@bigpond.net.au>
2340
2341         * elf32-spu.c (spu_elf_size_stubs): Revert 2008-01-28 doubling
2342         of _ovly_buf_table size.
2343         (spu_elf_build_stubs): Use low bit of .size as "present" bit.
2344         Adjust initialisations relating to _ovly_buf_table.
2345
2346 2008-02-04  Bob Wilson  <bob.wilson@acm.org>
2347
2348         * elf32-xtensa (elf_xtensa_relocate_section): After finding an invalid
2349         relocation, do not continue processing it.  Ignore R_XTENSA_ASM_EXPAND
2350         relocations against dynamic symbols.
2351         (elf_xtensa_finish_dynamic_sections): Do not fail if there is no
2352         .xt.lit section.
2353
2354 2008-02-04  Kai Tietz  <kai.tietz@onevision.com>
2355             H.J. Lu  <hongjiu.lu@intel.com>
2356
2357         PR 5715
2358         * warning.m4: Enable -Wno-format by default when using gcc on
2359         mingw.
2360         * configure: Regenerated.
2361
2362 2008-02-04  Adam Nemet  <anemet@caviumnetworks.com>
2363
2364         * archures.c: Update copyright.
2365         (bfd_mach_mips_octeon): New macro.
2366         * bfd-in2.h: Regenerate.
2367         * elfxx-mips.c (_bfd_elf_mips_mach): Handle Octeon.
2368         (mips_set_isa_flags): Likewise.
2369         (mips_mach_extensions): Add Octeon.
2370         * cpu-mips.c: Update copyright.
2371         (I_mipsocteon): New enum constant.
2372         (arch_info_struct): Add Octeon.
2373
2374 2008-02-04  Alan Modra  <amodra@bigpond.net.au>
2375
2376         * elf32-spu.c (spu_elf_relocate_section): Correct return type.
2377         Return error status on unexpected relocation errors.
2378
2379 2008-02-04  Alan Modra  <amodra@bigpond.net.au>
2380
2381         PR ld/5692
2382         * elf.c (bfd_elf_get_elf_syms): Revert 2008-01-31.  Instead abort
2383         on non-ELF input.
2384         * elf32-arm.c (elf32_arm_size_dynamic_sections): Skip glue
2385         processing on non-ELF input.
2386
2387 2008-01-31  Marc Gauthier  <marc@tensilica.com>
2388
2389         * config.bfd (xtensa*-*-*): Recognize processor variants.
2390
2391 2008-01-31  Nick Clifton  <nickc@redhat.com>
2392
2393         PR ld/5692
2394         * elf.c (bfd_elf_get_elf_syms): Check the return value of
2395         get_elf_backend_data.
2396
2397 2008-01-28  Fabian Groffen  <grobian@gentoo.org>
2398
2399         * config.bfd (x86_64-*-solaris2): Add support for this target.
2400
2401 2008-01-28  Alan Modra  <amodra@bigpond.net.au>
2402
2403         Rewrite SPU overlay handling code.  Put overlay calls stubs in the
2404         overlays where possible.  Use a faster call stub, or optionally at
2405         compile time, a more compact stub.  Double size of _ovly_buf_table
2406         so that low bit of _ovly_table.buf can be used as a "present" bit.
2407         Reserve an extra _ovly_table entry for index zero.
2408         * elf32-spu.c: (struct spu_link_hash_table): Delete a number of fields,
2409         add new ones.
2410         (struct got_entry): New.
2411         (struct spu_stub_hash_entry): Delete.
2412         (stub_hash_newfunc, spu_elf_link_hash_table_free): Delete.
2413         (spu_elf_link_hash_table_create): Adjust for struct changes.
2414         (spu_stub_name): Delete.
2415         (spu_elf_find_overlays): Don't track sections from overlay regions.
2416         Instead set ovl_buf number in spu elf section data.  Error if
2417         overlays in one region don't start at the same address.  Adjust
2418         for struct _spu_elf_section_data changes.
2419         (SIZEOF_STUB1, SIZEOF_STUB2, ILA_79, ILA_78): Delete.
2420         (OVL_STUB_SIZE, BRSL, LNOP, ILA): Define.
2421         (needs_ovl_stub): Adjust for struct _spu_elf_section_data changes.
2422         (enum _insn_type): New.
2423         (count_stub, build_stub): New functions.
2424         (allocate_spuear_stubs): Use count_stub.
2425         (build_spuear_stubs): Use build_stub.
2426         (populate_stubs, sort_stubs): Delete.
2427         (process_stubs): New function.
2428         (write_one_stub): Delete.
2429         (spu_elf_size_stubs, spu_elf_build_stubs): Rewrite.
2430         (alloc_stack_info): Adjust for struct _spu_elf_section_data changes.
2431         (maybe_insert_function, check_function_ranges): Likewise.
2432         (find_function, pasted_function, build_call_tree): Likewise.
2433         (spu_elf_stack_analysis, spu_elf_modify_segment_map): Likewise.
2434         (spu_elf_modify_program_headers): Likewise.
2435         (interesting_section): Detect stub sections differently.  Delete
2436         htab param, adjust all callers.
2437         (spu_elf_relocate_section): Rewrite stub handling.
2438         (spu_elf_output_symbol_hook): Likewise.
2439         (bfd_elf32_bfd_link_hash_table_free): Delete.
2440         * elf32-spu.h (struct _spu_elf_section_data): Move input-only and
2441         output-only fields into a union.  Add ovl_buf.
2442         (spu_elf_size_stubs, spu_elf_build_stubs): Update prototypes.
2443
2444 2008-01-25  DJ Delorie  <dj@redhat.com>
2445
2446         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): New.
2447
2448 2008-01-25  Kai Tietz  <kai.tietz@onevision.com>
2449
2450         * bfd-in.h: Add mingw I64 support.
2451         * bfd-in2.h: Regenerated.
2452         * bfd.c: (bfd_get_sign_extend_vma): Add pe-x86-64 and pei-x86-64.
2453
2454 2008-01-21  Alan Modra  <amodra@bigpond.net.au>
2455
2456         PR 4453
2457         * format.c (bfd_check_format_matches): Don't accept archives as
2458         fully matching unless they have a map.
2459
2460 2008-01-21  Alan Modra  <amodra@bigpond.net.au>
2461
2462         * elflink.c (_bfd_elf_link_output_relocs): Correct error return.
2463
2464 2008-01-21  Alan Modra  <amodra@bigpond.net.au>
2465
2466         * ecoff.c (_bfd_ecoff_archive_p): Delete.
2467         * libecoff.h (_bfd_ecoff_archive_p): Delete.
2468         * coff-alpha.c (ecoffalpha_little_vec): Use bfd_generic_archive_p.
2469         * coff-mips.c (ecoff_little_vec, ecoff_big_vec): Likewise.
2470         (ecoff_biglittle_vec): Likewise.
2471
2472 2008-01-19  Alan Modra  <amodra@bigpond.net.au>
2473
2474         PR 5646
2475         * elf64-ppc.c (ppc64_elf_tls_optimize): Ensure htab->tls_get_addr
2476         non-NULL before dereferencing.
2477
2478 2008-01-15  Alan Modra  <amodra@bigpond.net.au>
2479
2480         PR 5604
2481         * elf-bfd.h (struct elf_backend_data): Add gc_keep.  Remove param
2482         names from others.
2483         (_bfd_elf_gc_keep): Declare.
2484         * elfxx-target.h (elf_backend_gc_keep): Define.
2485         (elfNN_bed): Init new field.
2486         * elflink.c (_bfd_elf_gc_keep): New function.
2487         (bfd_elf_gc_sections): Call gc_keep.
2488         * elf64-ppc.c (elf_backend_gc_keep): Define.
2489         (struct _ppc64_elf_section_data): Move .opd related fields to
2490         a struct so they don't occupy the same storage.  Adjust accesses
2491         throughout file.
2492         (ppc64_elf_gc_keep): New function, split out from..
2493         (ppc64_elf_gc_mark_hook): ..here.  Don't call _bfd_elf_gc_mark
2494         to mark .opd section, just set gc_mark.
2495         (ppc64_elf_edit_opd): Remove no_opd_opt parm.  Don't set opd->adjust
2496         unless we are changing .opd.  Test non-NULL opd->adjust at all
2497         accesses throughout file.
2498         * elf64-ppc.h (ppc64_elf_edit_opd): Update prototype.
2499
2500 2008-01-15  Alan Modra  <amodra@bigpond.net.au>
2501
2502         * bfd-in.h (BFD_HOST_LONG_LONG): Delete.
2503         * bfd-in2.h: Regenerate.
2504
2505 2008-01-11  Tristan Gingold  <gingold@adacore.com>
2506             Eric Botcazou  <ebotcazou@adacore.com>
2507
2508         * elf32-ppc.c (ppc_elf_gc_sweep_hook): Exit early if generating a
2509         relocatable.
2510         * elf32-arm.c (elf32_arm_gc_sweep_hook): Likewise.
2511         * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise.
2512         * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise.
2513         * elf32-i386.c (elf_i386_gc_sweep_hook): Likewise.
2514         * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise.
2515         * elf32-m68k.c (elf_m68k_gc_sweep_hook): Likewise.
2516         * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
2517         * elf32-sh.c (sh_elf_gc_sweep_hook): Likewise.
2518         * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.
2519         * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise.
2520         * elf64-x86-64.c (elf64_x86_64_gc_sweep_hook): Likewise.
2521         * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
2522         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Likewise.
2523         * elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise.
2524         * elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise.
2525         * elflink.c (bfd_elf_gc_sections): Do not punt on relocatable output
2526         or executable output with relocations.
2527
2528 2008-01-09  Nick Clifton  <nickc@redhat.com>
2529
2530         PR gas/5552
2531         * elf32-fr30.c (fr30_elf_howto_table): Set partial_inplace field
2532         to FALSE for all relocs.
2533
2534 2008-01-09  Richard Sandiford  <rsandifo@nildram.co.uk>
2535
2536         PR ld/5526
2537         * elf-bfd.h (eh_cie_fde): Add u.cie.u.full_cie and u.cie.merged
2538         fields.  Rename u.cie.u.merged to u.cie.u.merged_with.
2539         (eh_frame_sec_info): Add a cies field.
2540         (eh_frame_hdr_info): Add a merge_cies field.
2541         * elf-eh-frame.c (cie): Add a reloc_index member to the personality
2542         union.
2543         (_bfd_elf_begin_eh_frame_parsing): Set hdr_info->merge_cies instead
2544         of hdr_info->cies.
2545         (_bfd_elf_parse_eh_frame): Remove tmp_cie.  Ccreate an array of
2546         cie structures in all cases and use it instead of extended_cies.
2547         If merging, store the cie array in sec_info->cies and point each
2548         CIE's eh_fde_cie at the associated element.  Do not try to
2549         calculate the value of the personality routine here; record the
2550         offset of the relocation instead.  Do not merge CIEs here.
2551         (_bfd_elf_end_eh_frame_parsing): Do not free hdr_info->cies here...
2552         (_bfd_elf_discard_section_eh_frame_hdr): ...do it here instead.
2553         (_bfd_elf_gc_mark_fdes): Mark the original (unmerged) CIE.
2554         (find_merged_cie): New function.
2555         (_bfd_elf_gc_mark_fdes): Use it.  Free sec_info->cies.
2556
2557 2008-01-07  Nick Clifton  <nickc@redhat.com>
2558
2559         PR binutils/5535
2560         * vms.c (vms_close_and_cleanup): Check for the presence of a
2561         vms_private_data_struct before examining any of its fields.
2562
2563 2008-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2564
2565         PR ld/5522
2566         * elflink.c (elf_link_input_bfd): Don't write out a section if
2567         its output section is marked with SEC_NEVER_LOAD.
2568
2569 For older changes see ChangeLog-2007
2570 \f
2571 Local Variables:
2572 mode: change-log
2573 left-margin: 8
2574 fill-column: 74
2575 version-control: never
2576 End: