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