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