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