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