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