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