Add assembler, disassembler and linker support for power9.
[external/binutils.git] / bfd / ChangeLog
1 2015-11-11  Alan Modra  <amodra@gmail.com>
2             Peter Bergner <bergner@vnet.ibm.com>
3
4         * elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_REL16DX_HA.
5         (ppc_elf_reloc_type_lookup): Handle R_PPC_REL16DX_HA.
6         (ppc_elf_addr16_ha_reloc): Likewise.
7         (ppc_elf_check_relocs): Likewise.
8         (ppc_elf_relocate_section): Likewise.
9         (is_insn_dq_form): Handle lxv and stxv instructions.
10         * elf64-ppc.c (ppc64_elf_howto_raw): Add R_PPC64_REL16DX_HA.
11         (ppc64_elf_reloc_type_lookup): Handle R_PPC64_REL16DX_HA.
12         (ppc64_elf_ha_reloc): Likewise.
13         (ppc64_elf_check_relocs): Likewise.
14         (ppc64_elf_relocate_section): Likewise.
15         * bfd-in2.h: Regenerate.
16         * libbfd.h: Likewise.
17         * reloc.c (BFD_RELOC_PPC_REL16DX_HA): New.
18
19 2015-11-10  H.J. Lu  <hongjiu.lu@intel.com>
20
21         * elf32-i386.c (elf_i386_relocate_section): Handle VTINHERIT
22         and VTENTRY relocations when deleting relocations.
23         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
24
25 2015-11-10  H.J. Lu  <hongjiu.lu@intel.com>
26
27         * elf32-i386.c (elf_i386_relocate_section): Properly move
28         kept relocations when deleting relocations.
29         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
30
31 2015-11-09  H.J. Lu  <hongjiu.lu@intel.com>
32
33         * elf32-i386.c (elf_i386_relocate_section): Use read and write
34         pointers to reloc array, rather than memmove when deleting a
35         reloc.  Don't use RELOC_AGAINST_DISCARDED_SECTION.  Adjust
36         reloc counts at end of loop.
37         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
38
39 2015-11-10  Alan Modra  <amodra@gmail.com>
40
41         * elf64-ppc.c (ppc64_elf_relocate_section): Use read and write
42         pointers to reloc array, rather than memmove when deleting a
43         reloc.  Don't use RELOC_AGAINST_DISCARDED_SECTION.  Adjust
44         reloc counts at end of loop.
45         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
46
47 2015-11-09  Dominik Vogt  <vogt@linux.vnet.ibm.com>
48
49         * elf64-ppc.c (ppc64_elf_size_stubs, ppc64_elf_build_stubs): Fix left
50         shift of negative value.
51         * libbfd.c (safe_read_leb128): Likewise.
52         * dwarf2.c (place_sections): Likewise.
53         * bfd-in.h (align_power): Likewise.
54         * bfd-in2.h (align_power): Likewise.
55
56 2015-10-30  Nick Clifton  <nickc@redhat.com>
57
58         * po/zh_CN.po: Updated (simplified) Chinese translation.
59
60 2015-10-29  Catherine Moore  <clm@codesourcery.com>
61
62         * elfxx-mips.c (mips_elf_check_mips16_stubs): Set a stub's output
63         section to bfd_abs_section_ptr if the stub is discarded.
64
65 2015-10-29  Ed Schouten  <ed@nuxi.nl>
66
67         * config.bfd (targ_defvec): Add support for CloudABI on aarch64.
68         For this target we have to make sure we use ELFOSABI_CLOUDABI
69         instead of ELFOSABI_NONE.
70         * configure.ac (tb): Likewise.
71         * elfnn-aarch64.c: Likewise.
72         * targets.c (_bfd_target_vector): Likewise.
73         * configure: Regenerate.
74
75 2015-10-29  Pedro Alves  <palves@redhat.com>
76
77         * libhppa.h (bfd_hppa_insn2fmt): Add cast.
78
79 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
80
81         * elf32-i386.c (elf_i386_relocate_section): Fix a typo in
82         comment.
83
84 2015-10-28  Nick Clifton  <nickc@redhat.com>
85
86         * elf32-arm.c (create_instruction_branch_absolute): Replace
87         pointer parameters with a simple integer parameter.
88         (stm32l4xx_create_replacing_stub_ldmia): Update calls to
89         create_instruction_branch_absolute.
90         (stm32l4xx_create_replacing_stub_ldmdb): Likewise.
91         (stm32l4xx_create_replacing_stub_vldm): Likewise.
92         (elf32_arm_write_section): Use pointer type for veneer addresses.
93
94 2015-10-28  Cupertino Miranda  <cmiranda@synopsys.com>
95
96         * reloc.c (BFD_RELOC_ARC_32_PCREL): New entry.
97         * elf32-arc.c (arc_elf_howto_ini): Update formula.
98         (get_middle_endian_relocation): New function.
99         (PDATA): Define.
100         * bfd-in2.h: Regenerate.
101         * libbfd.h: Likewise.
102
103 2015-10-28  Alan Modra  <amodra@gmail.com>
104
105         PR ld/19162
106         * elflink.c (_bfd_elf_gc_mark_reloc): Move code iterating over
107         linker input bfds..
108         * section.c (bfd_get_next_section_by_name): ..to here.  Add ibfd param.
109         (bfd_get_linker_section): Adjust bfd_get_next_section_by_name call.
110         * tekhex.c (first_phase): Likewise.
111         * elflink.c (bfd_elf_gc_sections): Likewise.
112         * bfd-in2.h: Regenerate.
113
114 2015-10-27  Laurent Alfonsi <laurent.alfonsi@st.com>
115             Christophe Monat <christophe.monat@st.com>
116
117         * bfd-in2.h: Regenerate.
118         * bfd-in.h (bfd_arm_stm32l4xx_fix): New enum. Specify how
119         STM32L4XX instruction scanning should be done.
120         (bfd_elf32_arm_set_stm32l4xx_fix)
121         (bfd_elf32_arm_stm32l4xx_erratum_scan)
122         (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Add prototypes.
123         (bfd_elf32_arm_set_target_relocs): Add stm32l4xx fix type argument
124         to prototype.
125         * elf32-arm.c (STM32L4XX_ERRATUM_VENEER_SECTION_NAME)
126         (STM32L4XX_ERRATUM_VENEER_ENTRY_NAME): Define macros.
127         (elf32_stm32l4xx_erratum_type): New enum.
128         (elf32_stm32l4xx_erratum_list): New struct. List of veneers or
129         jumps to veneers.
130         (_arm_elf_section_data): Add stm32l4xx_erratumcount,
131         stm32l4xx_erratumlist.
132         (elf32_arm_link_hash_table): Add stm32l4xx_erratum_glue_size,
133         stm32l4xx_fix and num_stm32l4xx_fixes fields.
134         (ctz): New function.
135         (popcount): New function.
136         (elf32_arm_link_hash_table_create): Initialize stm32l4xx_fix.
137         (put_thumb2_insn): New function.
138         (STM32L4XX_ERRATUM_LDM_VENEER_SIZE): Define. Size of a veneer for
139         LDM instructions.
140         (STM32L4XX_ERRATUM_VLDM_VENEER_SIZE): Define. Size of a veneer for
141         VLDM instructions.
142         (bfd_elf32_arm_allocate_interworking_sections): Initialise erratum
143         glue section.
144         (record_stm32l4xx_erratum_veneer) : New function. Create a single
145         veneer, and its associated symbols.
146         (bfd_elf32_arm_add_glue_sections_to_bfd): Add STM32L4XX erratum glue.
147         (bfd_elf32_arm_set_stm32l4xx_fix): New function. Set the type of
148         erratum workaround required.
149         (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): New function. Find
150         out where veneers and branches to veneers have been placed in
151         virtual memory after layout.
152         (is_thumb2_ldmia): New function.
153         (is_thumb2_ldmdb): Likewise.
154         (is_thumb2_vldm ): Likewise.
155         (stm32l4xx_need_create_replacing_stub): New function. Decide if a
156         veneer must be emitted.
157         (bfd_elf32_arm_stm32l4xx_erratum_scan): Scan the sections of an
158         input BFD for potential erratum-triggering insns. Record results.
159         (bfd_elf32_arm_set_target_relocs): Set stm32l4xx_fix field in
160         global hash table.
161         (elf32_arm_size_dynamic_sections): Collect glue information.
162         (create_instruction_branch_absolute): New function.
163         (create_instruction_ldmia): Likewise.
164         (create_instruction_ldmdb): Likewise.
165         (create_instruction_mov): Likewise.
166         (create_instruction_sub): Likewise.
167         (create_instruction_vldmia): Likewise.
168         (create_instruction_vldmdb): Likewise.
169         (create_instruction_udf_w): Likewise.
170         (create_instruction_udf): Likewise.
171         (push_thumb2_insn32): Likewise.
172         (push_thumb2_insn16): Likewise.
173         (stm32l4xx_fill_stub_udf): Likewise.
174         (stm32l4xx_create_replacing_stub_ldmia): New function. Expands the
175         replacing stub for ldmia instructions.
176         (stm32l4xx_create_replacing_stub_ldmdb): Likewise for ldmdb.
177         (stm32l4xx_create_replacing_stub_vldm): Likewise for vldm.
178         (stm32l4xx_create_replacing_stub): New function. Dispatches the
179         stub emission to the appropriate functions.
180         (elf32_arm_write_section): Output veneers, and branches to veneers.
181
182 2015-10-27  Sangamesh Mallayya  <nickc@redhat.com>sangamesh.swamy@in.ibm.com>
183
184         * configure.ac (powerpc64-*-aix[5-9].*): Match powerpc64 running
185         aix for core file support.
186         * configure: Regenerate.
187         * rs6000-core.c: Check for __ld_info64 if compiling 64-bit gdb.
188         Added BFD64 check if we are using old core file format for 32-bit gdb.
189         Set sizeof CORE_COMMONSZ appropriately in case of either new or
190         old core file format.
191         (read_hdr): Added BFD64 check for 64-bit support.
192         (rs6000coff_core_p): Likewise.
193         (rs6000coff_core_file_matches_executable_p): Likewise.
194         (rs6000coff_core_file_failing_command): Likewise.
195         (rs6000coff_core_file_failing_signal): Likewise.
196         Add support for debugging core files generated by binaries in
197         Large Memory model.
198         (rs6000coff_core_p): If Large Memory Model is used, then the .data
199         segment should start from BDATAORG which has been defined in the
200         system header files.
201
202 2015-10-26  H.J. Lu  <hongjiu.lu@intel.com>
203
204         PR ld/19175
205         * elf32-i386.c (elf_i386_convert_load): Check bfd_link_hash_new
206         instead of calling bfd_link_get_defined_symbol.
207         * elf64-x86-64.c (elf_x86_64_convert_load): Likewise.  Skip
208         relocation overflow for bfd_link_hash_new.
209         * linker.c (bfd_link_get_defined_symbol): Removed.
210         * bfd-in2.h: Regenerated.
211
212 2015-10-26  H.J. Lu  <hongjiu.lu@intel.com>
213
214         PR ld/19171
215         * elf32-i386.c (elf_i386_convert_load): Call
216         bfd_link_get_defined_symbol to check if a symbol is defined.
217         * elf64-x86-64.c (elf_x86_64_convert_load): Call
218         bfd_link_get_defined_symbol to get defined symbol section and
219         value.
220         * linker.c (bfd_link_get_defined_symbol): New function.
221         * bfd-in2.h: Regenerated.
222
223 2015-10-23  Alan Modra  <amodra@gmail.com>
224
225         PR ld/11133
226         PR ld/19161
227         PR ld/19167
228         * elflink.c (_bfd_elf_gc_mark_hook): Delete code handling __start_*
229         and __stop_* symbol refs.
230         (_bfd_elf_gc_mark_rsec): Add start_stop parameter.  Handle __start_*
231         and __stop_* symbol refs here..
232         (_bfd_elf_gc_mark_reloc): ..and here.
233         * elf-bfd.h (_bfd_elf_gc_mark_hook): Update prototype.
234         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Update
235         _bfd_elf_gc_mark_rsec call.
236
237 2015-10-23  Alan Modra  <amodra@gmail.com>
238
239         PR ld/11133
240         PR ld/19161
241         * elflink.c (elf_gc_sweep): Revert last patch.
242         (_bfd_elf_gc_mark_hook): Don't set SEC_KEEP here.
243
244 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
245
246         PR ld/19161
247         * elflink.c (elf_gc_sweep): Always keep sections marked with
248         SEC_KEEP.
249
250 2015-10-22  Hans-Peter Nilsson  <hp@bitrange.com>
251
252         * mmo.c (struct mmo_data_struct): New members
253         symbol_consistency_override_calculated and ignore_symbol_consistency.
254         (mmo_section_has_contents, mmo_ignore_symbol_consistency): New
255         functions.
256         (mmo_create_symbol): Check with mmo_ignore_symbol_consistency if to
257         report an error for unexpected value of Main.
258         (mmo_write_symbols_and_terminator): Similar.
259
260 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
261
262         * elf32-i386.c (elf_i386_convert_load): Use call_nop_byte and
263         check call_nop_as_suffix for 1-byte NOP padding to pad call.
264         * elf64-x86-64.c (elf_x86_64_convert_load): Likewise.
265
266 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
267
268         * elf64-x86-64.c: Include opcode/i386.h.
269         (x86_64_elf_howto_table): Add R_X86_64_GOTPCRELX and
270         R_X86_64_REX_GOTPCRELX.
271         (R_X86_64_standard): Replace R_X86_64_PLT32_BND with
272         R_X86_64_REX_GOTPCRELX.
273         (x86_64_reloc_map): Add BFD_RELOC_X86_64_GOTPCRELX and
274         BFD_RELOC_X86_64_REX_GOTPCRELX.
275         (need_convert_mov_to_lea): Renamed to ...
276         (need_convert_load): This.
277         (elf_x86_64_check_relocs): Handle R_X86_64_GOTPCRELX and
278         R_X86_64_REX_GOTPCRELX.  Replace need_convert_mov_to_lea with
279         need_convert_load.
280         (elf_x86_64_gc_sweep_hook): Handle R_X86_64_GOTPCRELX and
281         R_X86_64_REX_GOTPCRELX.
282         (elf_x86_64_size_dynamic_sections): Likewise.
283         (elf_x86_64_relocate_section): Likewise.
284         (elf_x86_64_convert_mov_to_lea): Renamed to ...
285         (elf_x86_64_convert_load): This.  Replace need_convert_mov_to_lea
286         with need_convert_load.  Support R_X86_64_GOTPCRELX and
287         R_X86_64_REX_GOTPCRELX transformations.
288         * reloc.c (BFD_RELOC_X86_64_GOTPCRELX): New.
289         (BFD_RELOC_X86_64_REX_GOTPCRELX): Likewise.
290         * bfd-in2.h: Regenerated.
291         * libbfd.h: Likewise.
292
293 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
294
295         * elf32-i386.c: Include opcode/i386.h.
296         (elf_howto_table): Add R_386_GOT32X.
297         (R_386_ext2): Replace R_386_IRELATIVE with R_386_GOT32X.
298         (elf_i386_reloc_type_lookup): Handle BFD_RELOC_386_GOT32X.
299         (need_convert_mov_to_lea): Renamed to ...
300         (need_convert_load): This.
301         (elf_i386_check_relocs): Handle R_386_GOT32X.  Replace
302         need_convert_mov_to_lea with need_convert_load.
303         (elf_i386_gc_sweep_hook): Handle R_386_GOT32X.
304         (elf_i386_size_dynamic_sections): Likewise.
305         (elf_i386_relocate_section): Likewise.
306         (elf_i386_convert_mov_to_lea): Renamed to ...
307         (elf_i386_convert_load): This.  Replace need_convert_mov_to_lea
308         with need_convert_load.  Support R_386_GOT32X transformations.
309         * reloc.c (BFD_RELOC_386_GOT32X): New.
310         * bfd-in2.h: Regenerated.
311         * libbfd.h: Likewise.
312
313 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
314
315         * elf32-s390.c (elf_s390_check_relocs): Set the non_got_ref marker
316         only when linking an executable.
317         (elf_s390_relocate_section): Redirect PC-relative relocs to a IPLT
318         slot.
319         * elf64-s390.c (elf_s390_check_relocs): Set the non_got_ref marker
320         only when linking an executable.
321         (elf_s390_relocate_section): Redirect PC-relative relocs to a IPLT
322         slot.
323
324 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
325
326         * elf32-s390.c (elf_s390_adjust_dynamic_symbol): Set the PLT
327         reference counters for local IFUNC calls.
328         * elf64-s390.c (elf_s390_adjust_dynamic_symbol): Likewise.
329
330 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
331
332         * elf32-s390.c (elf_s390_check_relocs): Fallthrough to the PLT
333         slot allocating code for GOTOFF relocs on ifunc symbols.
334         (elf_s390_gc_sweep_hook): Decrement plt refcount for GOTOFF relocs
335         on ifunc symbols.
336         (elf_s390_relocate_section): Redirect a GOTOFF reloc to an iplt
337         slot.
338
339 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
340
341         PR ld/18841
342         * elf32-s390.c (elf_s390_reloc_type_class): Return
343         reloc_class_ifunc for ifunc symbols.
344         * elf64-s390.c (elf_s390_reloc_type_class): Likewise.
345
346 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
347
348         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Call
349         elf_s390_finish_ifunc_symbol only for actually defined symbols.
350         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
351
352 2015-10-22  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
353
354         * elf-s390-common.c (s390_elf_allocate_ifunc_dyn_relocs): Remove
355         `head' parameter.
356         * elf32-s390.c (allocate_dynrelocs): Don't use last parameter.
357         * elf64-s390.c (allocate_dynrelocs): Don't use last parameter.
358
359 2015-10-20  Hans-Peter Nilsson  <hp@bitrange.com>
360
361         * mmo.c (mmo_write_symbols_and_terminator): Correct printed value
362         of Main in error message.
363
364 2015-10-18  Doug Evans  <xdje42@gmail.com>
365
366         * targets.c (bfd_flavour_name): "MMO" is spelled "mmo".
367
368 2015-10-17  Alan Modra  <amodra@gmail.com>
369
370         * elf64-ppc.c (ppc64_elf_size_stubs): Correct __glink_PLTresolve
371         eh_frame FDE for ELFv1.
372
373 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
374
375         * elf32-i386.c (elf_i386_convert_mov_to_lea): Check if symbol
376         is defined.
377         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
378
379 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
380
381         * elf32-i386.c (elf_i386_convert_mov_to_lea): Don't check
382         def_regular.
383         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
384
385 2015-10-15  H.J. Lu  <hongjiu.lu@intel.com>
386
387         * elflink.c (_bfd_elf_merge_symbol): Fix typos in comments
388
389 2015-10-15  Alan Modra  <amodra@gmail.com>
390
391         * elf32-v850.c (v850_elf_copy_private_bfd_data): Remove assertion
392         that input and output .note.renesas sections are same size.
393         Instead, only copy input to output if they are.
394
395 2015-10-15  Riku Voipio  <riku.voipio@iki.fi>
396
397         PR ld/19123
398         * elfcore.h (elf_core_file_p): Use the file_ptr type to hold the
399         offset for bfd_seek.
400         * elfcode.h (elf_object_p): Likewise.
401
402 2015-10-14  Rich Felker  <dalias@libc.org>
403
404         PR ld/19091
405         * elf32-sh.c (sh_elf_size_dynamic_sections): Always emit
406         DT_PLTGOT for FDPIC output.
407
408 2015-10-13  Alan Modra  <amodra@gmail.com>
409
410         * elf.c (_bfd_elf_map_sections_to_segments): Don't set
411         PT_GNU_RELRO p_flags.
412         (assign_file_positions_for_non_load_sections): Set PT_GNU_RELRO
413         flags to PF_R here.
414
415 2015-10-12  H.J. Lu  <hongjiu.lu@intel.com>
416
417         PR ld/19073
418         * elflink.c (_bfd_elf_add_default_symbol): Skip the unversioned
419         definition after the default version.
420
421 2015-10-12  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
422
423         PR ld/19083
424         * elf32-s390.c (elf_s390_gc_sweep_hook): Do not reduce got
425         refcount for relocs not really requiring a got slot.
426         * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
427
428 2015-10-11  John David Anglin  <danglin@gcc.gnu.org>
429
430         * elf-hppa.h (elf_hppa_action_discarded): Ignore relocations in
431         .data.rel.ro.local.
432
433 2015-10-07  Cupertino Miranda  <cmiranda@synopsys.com>
434
435         * archures.c: Remove support for older ARC. Added support for new
436         ARC cpus (ARC600, ARC601, ARC700, ARCV2).
437         * bfd-in2.h: Likewise.
438         * config.bfd: Likewise.
439         * cpu-arc.c: Likewise.
440         * elf32-arc.c: Totally changed file with a refactored
441         inplementation of the ARC port.
442         * libbfd.h: Added ARC specific relocation types.
443         * reloc.c: Likewise.
444
445 2015-10-06  H.J. Lu  <hongjiu.lu@intel.com>
446
447         * bfd.c (bfd_update_compression_header): Clear the ch_reserved
448         field in 64-bit output.
449         (bfd_convert_section_contents): Likewise.
450
451 2015-10-05  H.J. Lu  <hongjiu.lu@intel.com>
452
453         PR ld/18914
454         * elflink.c (elf_link_add_object_symbols): Don't re-export a
455         symbol if it isn't undefined.
456
457 2015-10-04  H.J. Lu  <hongjiu.lu@intel.com>
458
459         * config.bfd (targ_selvecs, targ64_selvecs): Add iamcu_elf32_vec,
460         i386_pei_vec and x86_64_pei_vec for Solaris2/x86.
461
462 2015-10-02  Renlin Li  <renlin.li@arm.com>
463
464         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Add
465         TLSIE_MOVW_GOTTPREL_G1.
466         (aarch64_tls_transition_without_check): Add
467         TLSIE_MOVW_GOTTPREL_G1 to TLSLE_MOVW_TPREL_G2
468         transition for local symbol.
469         (elfNN_aarch64_tls_relax): Add a argument to pass tp offset.
470         Add TLSIE_MOVW_GOTTPREL_G1 relaxation.
471         (elfNN_aarch64_relocate_section): Call elfNN_aarch64_tls_relax
472         with new argument.
473
474 2015-10-02  Renlin Li  <renlin.li@arm.com>
475
476         * elfnn-aarch64.c (aarch64_tls_transition_without_check):  Add
477         relax transitions for TLSDESC_ADD, TLSDESC_LDR, TLSDESC_OFF_G0_NC,
478         TLSDESC_OFF_G1.
479         (aarch64_tls_transition_without_check): Add relaxation support.
480         (aarch64_reloc_got_type): Add support.
481         (elfNN_aarch64_final_link_relocate): Likewise.
482         (elfNN_aarch64_tls_relax): Likewise.
483         (elfNN_aarch64_relocate_section): Likewise.
484         (elfNN_aarch64_gc_sweep_hook): Likewise.
485         (elfNN_aarch64_check_relocs): Likewise.
486         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
487         (_bfd_aarch64_elf_resolve_relocation): Likewise.
488
489 2015-10-02  Renlin Li  <renlin.li@arm.com>
490
491         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Check overflow for
492         BFD_RELOC_AARCH64_TLSDESC_OFF_G1.
493
494 2015-10-02  Renlin Li  <renlin.li@arm.com>
495
496         * elfnn-aarch64.c(IS_AARCH64_TLS_RELAX_RELOC):
497         Add relaxation support for TLSGD_MOVW_G0_NC and TLSGD_MOVW_G1.
498         (aarch64_tls_transition_without_check): Likewise
499         (elfNN_aarch64_tls_relax): Likwise.
500
501 2015-10-02  Renlin Li  <renlin.li@arm.com>
502
503         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Create GOT section
504         for TLSLE_MOVW_TPREL_G(1, 1_NC, 2) relocation.
505
506 2015-10-02  Renlin Li  <renlin.li@arm.com>
507
508         * reloc.c: Make AARCH64_TLSIE_MOVW_GOTTPREL_G1 and
509         AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC defined in alphabetical order.
510         * libbfd.h: Regenerate.
511         * bfd-in2.h: Likewise.
512         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Make
513         TLSIE_MOVW_GOTTPREL_G1 check overflow.
514         (aarch64_reloc_got_type): Add support for TLSIE_MOVW_GOTTPREL_G1
515         and TLSIE_MOVW_GOTTPREL_G0_NC.
516         (elfNN_aarch64_final_link_relocate): Likewise.
517         (elfNN_aarch64_relocate_section): Likewise.
518         (elfNN_aarch64_gc_sweep_hook): Likewise.
519         (elfNN_aarch64_check_relocs): Likewise.
520         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
521         (_bfd_aarch64_elf_resolve_relocation): Likewise.
522
523 2015-10-02  Renlin Li  <renlin.li@arm.com>
524
525         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
526         BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC support.
527         (elfNN_aarch64_final_link_relocate): Likewise.
528         (elfNN_aarch64_relocate_section): Likewise.
529         (elfNN_aarch64_gc_sweep_hook): Likewise.
530         (elfNN_aarch64_check_relocs): Likewise.
531         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
532         (_bfd_aarch64_elf_resolve_relocation): Likewise.
533
534 2015-10-02  Renlin Li  <renlin.li@arm.com>
535
536         * reloc.c (BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC): New entry.
537         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
538         BFD_RELOC_AARCH64_TLSGD_MOVW_G0_NC.
539         * libbfd.h: Regenerate.
540         * bfd-in2.h: Likewise
541
542 2015-10-02  Renlin Li  <renlin.li@arm.com>
543
544         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
545         BFD_RELOC_AARCH64_TLSGD_MOVW_G1 support.
546         (elfNN_aarch64_final_link_relocate): Likewise.
547         (elfNN_aarch64_relocate_section): Likewise.
548         (elfNN_aarch64_gc_sweep_hook): Likewise.
549         (elfNN_aarch64_check_relocs): Likewise.
550         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
551         (_bfd_aarch64_elf_resolve_relocation): Likewise.
552
553 2015-10-02  Renlin Li  <renlin.li@arm.com>
554
555         * reloc.c (BFD_RELOC_AARCH64_TLSGD_MOVW_G1): New entry.
556         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
557         BFD_RELOC_AARCH64_TLSGD_MOVW_G1.
558         * bfd-in2.h: Regenerate.
559         * libbfd.h: Likewise.
560
561 2015-10-02  Renlin Li  <renlin.li@arm.com>
562
563         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
564         BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC support.
565         (elfNN_aarch64_final_link_relocate): Likewise.
566         (elfNN_aarch64_gc_sweep_hook): Likewise.
567         (elfNN_aarch64_check_relocs): Likewise.
568         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
569         (_bfd_aarch64_elf_resolve_relocation): Likewise.
570
571 2015-10-02  Renlin Li  <renlin.li@arm.com>
572
573         * reloc.c (BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC): New.
574         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry
575         MOVW_GOTOFF_G0_NC.
576         * libbfd.h: Regnerate.
577         * bfd-in2.h: Regenerate.
578
579 2015-10-02  Renlin Li  <renlin.li@arm.com>
580
581         * elfnn-aarch64.c (aarch64_reloc_got_type): Add support
582         for BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
583         (elfNN_aarch64_gc_sweep_hook): Likewise.
584         (elfNN_aarch64_check_relocs): Likewise
585         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
586         (_bfd_aarch64_elf_resolve_relocation): Likewise
587         (elfNN_aarch64_final_link_relocate): Likewise
588
589 2015-010-02  Renlin Li  <renlin.li@arm.com>
590
591         * reloc.c (BFD_RELOC_AARCH64_MOVW_GOTOFF_G1): New.
592         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
593         MOVW_GOTOFF_G1.
594         * libbfd.h: Regenerate.
595         * bfd-in2.h: Regenerate.
596
597 2015-10-02  Renlin Li  <renlin.li@arm.com>
598
599         * elfnn-aarch64.c (aarch64_reloc_got_type): Add
600         BFD_RELOC_AARCH64_LD_64_GOTOFF_LO15 support.
601         (elfNN_aarch64_gc_sweep_hook): Likewise.
602         (elfNN_aarch64_check_relocs): Likewise
603         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
604         (_bfd_aarch64_elf_resolve_relocation): Likewise
605         (elfNN_aarch64_final_link_relocate): Calculate offset within GOT.
606
607 2015-10-02  Renlin Li  <renlin.li@arm.com>
608
609         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Change if to
610         switch statement.
611
612 2015-10-01  H.J. Lu  <hongjiu.lu@intel.com>
613
614         PR ld/19031
615         * elf64-x86-64.c (elf_x86_64_check_relocs): Set
616         pointer_equality_needed for R_X86_64_PC32 reloc in non-code
617         sections.
618
619 2015-10-01  Renlin Li  <renlin.li@arm.com>
620
621         * elfnn-aarch64.c (elfNN_aarch64_output_plt_map): Remove.
622         (elfNN_aarch64_output_arch_local_syms): Emit AARCH64_MAP_INSN once.
623
624 2015-10-01  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
625
626         * config.bfd (targ_selvecs): Remove sh_elf32_vec and
627         sh_elf32_le_vec from sh*-*-linux cases.
628
629 2015-10-01  Alan Modra  <amodra@gmail.com>
630
631         PR ld/19013
632         * elflink.c (_bfd_elf_merge_sections): Revert last change.
633
634 2015-09-30  H.J. Lu  <hongjiu.lu@intel.com>
635
636         PR ld/19031
637         * elf32-i386.c (elf_i386_check_relocs): Set
638         pointer_equality_needed for R_386_PC32 reloc in non-code
639         sections.
640
641 2015-09-30  H.J. Lu  <hongjiu.lu@intel.com>
642
643         PR ld/19013
644         * elflink.c (_bfd_elf_merge_sections): Only merge input bfds
645         that have the compatible ELF machine code with the output bfd.
646
647 2015-09-30  Alan Modra  <amodra@gmail.com>
648
649         PR ld/19013
650         * elflink.c (_bfd_elf_merge_sections): Only merge input bfds that
651         will be handled by elf_link_input_bfd.  Rename abfd param to obfd.
652
653 2015-09-30  Rich Felker  <dalias@libc.org>
654
655         * config.bfd (targ_selvecs): Add fdpic and misc targets
656         for sh*-*-linux*.
657
658 2015-09-29  Andrew Stubbs  <ams@codesourcery.com>
659             H.J. Lu  <hongjiu.lu@intel.com>
660
661         PR binutils/19020
662         * bfd.c (bfd_convert_section_contents): Add ptr_size parameter.
663         * bfd-in2.h: Regenerated.
664
665 2015-08-11  Peter Zotov  <whitequark@whitequark.org>
666
667         PR ld/18759
668         * elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE.
669         (R_OR1K_16_PCREL): Likewise.
670         (R_OR1K_8_PCREL): Likewise.
671
672 2015-09-23  Nick Clifton  <nickc@redhat.com>
673
674         * bout.c (b_out_slurp_reloc_table): Cast constant to unsigned in
675         order to avoid problems with left shifting negative values.
676         (abs32code): Likewise.
677         * mach-o.c (FILE_ALIGN): Likewise.
678         * coff-rs6000.c (xcoff_debug_sections): Delete unused static
679         array.
680         * elf32-visium.c (visium_reloc_map): Likewise.
681         * elf32-arm.c (elf32_arm_final_link_relocate): Remove useless
682         calls to abs function.
683         * elf32-frv.c (_frvfdpic_relax_tls_entries): Likewise.
684         * elf32-score.c (score_elf_final_link_relocate): Likewise.
685         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
686         * elf32-i860.c (i860_howto_pc26_reloc): Use multiplication instead
687         of shifting to create a negative mask.
688         * elf32-msp430.c (elf_backend_special_sections): Define.
689         * elfxx-mips.c (got_ofst_reloc_p): Delete unused function.
690         (got_hi16_reloc_p): Delete unused function.
691         * ppcboot.c (ppcboot_bfd_print_private_bfd_data): Fix test of
692         partition name.
693
694 2015-09-23  Nick Clifton  <nickc@redhat.com>
695
696         PR binutils/15835
697         * elf-bfd.h (struct elf_section_list): New structure.
698         (struct elf_obj_tdata): Replace symtab_shndx_hdr with
699         symtab_shndx_list.  Delete symtab_shndx_section.
700         (elf_symtab_shndx): Replace macro with elf_symtab_shndx_list.
701         * elf.c (bfd_elf_get_syms): If symtab index sections are present,
702         scan them for the section that matches the provided symbol table.
703         (bfd_section_from_shdr): Record all SHT_SYMTAB_SHNDX sections.
704         (assign_section_numbers): Use the first symtab index table in the
705         list.
706         (_bfd_elf_compute_section_file_positions): Replace use of
707         symtab_shndx_hdr with use of symtab_shndx_list.
708         (find_section_in_list): New function.
709         (assign_file_postions_except_relocs): Use new function.
710         (_bfd_elf_copy_private_symbol_data): Likewise.
711         (swap_out_syms): Handle multiple symbol table index sections.
712         * elf32-m32c.c (m32c_elf_relax_section): Replace use of
713         symtab_shndx_hdr with use of symtab_shndx_list.
714         * elf32-rl78.c (rl78_elf_relax_section): Likewise.
715         * elf32-rx.c (rx_relax_section): Likewise.
716         * elf32-v850.c (v850_elf_relax_delete_bytes): Likewise.
717         * elflink.c (bfd_elf_final_link): Likewise.
718
719 2015-09-21  H.J. Lu  <hongjiu.lu@intel.com>
720
721         * bfd.c (bfd_update_compression_header): Use bfd_put_32 on
722         ch_type.
723         (bfd_check_compression_header): Use bfd_get_32 on ch_type.
724         (bfd_convert_section_contents): Use bfd_get_32 and bfd_put_32
725         on ch_type.
726
727 2015-09-20  Rich Felker  <dalias@libc.org>
728
729         * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create
730         .interp when info->nointerp.
731         (bfd_elf_size_dynamic_sections): Adjust assert.
732         * elf32-arm.c (elf32_arm_size_dynamic_sections): Don't size .interp
733         when info->nointerp.
734         * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise.
735         * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
736         * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
737         * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise.
738         * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
739         * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
740         * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
741         * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
742         * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
743         * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
744         * elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
745         * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise.
746         * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
747         * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
748         * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
749         * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
750         * elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
751         * elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
752         * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
753         * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Likewise.
754         * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise.
755         * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
756         * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
757         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
758         * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
759         * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
760         * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
761         * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise.
762         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
763         * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
764         * elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise.
765         * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
766         * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
767         * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise.
768
769 2015-09-18  Doug Evans  <xdje42@gmail.com>
770
771         * targets.c (enum bfd_flavour): Add comment.
772         (bfd_flavour_name): New function.
773         * bfd-in2.h: Regenerate.
774
775 2015-09-18  Alan Modra  <amodra@gmail.com>
776
777         * elf64-ppc.h (struct ppc64_elf_params <tls_get_addr_opt>): Rename
778         from no_tls_get_addr_opt.
779         * elf64-ppc.c: Update for rename and inversion of tls_get_addr_opt.
780         (ppc64_elf_tls_setup): Set tls_get_addr_opt to 0 only when at
781         default of -1.
782
783 2015-09-17  Alan Modra  <amodra@gmail.com>
784
785         PR 18867
786         * elflink.c (elf_link_adjust_relocs): Correct start of insertion
787         sort main loop.
788
789 2015-09-16  Alan Modra  <amodra@gmail.com>
790
791         PR 18867
792         * elflink.c (elf_link_adjust_relocs): Modify insertion sort to
793         insert a run.  Return status in case of malloc failure.
794         Adjust callers.
795
796 2015-09-15  Max Filippov  <jcmvbkbc@gmail.com>
797
798         * elf32-xtensa.c (elf_xtensa_be_plt_entry)
799         (elf_xtensa_le_plt_entry): Emit 'entry' instruction only for
800         windowed ABI.
801         (elf_xtensa_create_plt_entry): Generate 'l32r' offsets and fix
802         up instructions according to ABI.
803
804 2015-09-14  Rich Felker  <dalias@libc.org>
805
806         * elf32-sh.c (sh_elf_relocate_section): Set EF_SH_PIC flag
807         instead of clearing it on cross-section relocations.
808         (sh_elf_merge_private_data): Clear EF_SH_PIC flag by default.
809
810 2015-09-12  Helge Deller  <deller@gmx.de>
811
812         PR ld/18514
813         * elf32-hppa.c (elf32_hppa_finish_dynamic_sections): Set .plt entry
814         size to 0.
815
816 2015-09-09  Jiong Wang  <jiong.wang@arm.com>
817
818         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Sort alphabetically.
819
820 2015-09-09  Jiong Wang  <jiong.wang@arm.com>
821
822         * elfnn-aarch64.c (aarch64_tls_transition_without_check): Support three
823         TLS local dynamic traditional relocations types.
824         (elfNN_aarch64_tls_relax): Support TLS local dynamic traditional to
825         local executable relaxation.
826
827 2015-09-03  H.J. Lu  <hongjiu.lu@intel.com>
828
829         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Remove
830         convert_mov_to_lea.
831
832 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
833
834         * elf32-i386.c (R_386_irelative): Renamed to ...
835         (R_386_ext2): This.
836         (R_386_vt_offset): Updated.
837         (elf_i386_rtype_to_howto): Likewise.
838         (elf_i386_relocate_section): Likewise.
839
840 2015-09-01  H.J. Lu  <hongjiu.lu@intel.com>
841
842         PR ld/18900
843         * elf32-i386.c (elf_i386_link_hash_entry): Add
844         func_pointer_refcount.
845         (elf_i386_link_hash_newfunc): Clear func_pointer_refcount.
846         (elf_i386_get_local_sym_hash): Likewise.
847         (elf_i386_copy_indirect_symbol): Also copy
848         func_pointer_refcount.
849         (elf_i386_check_relocs): Increment func_pointer_refcount.
850         (elf_i386_gc_sweep_hook): Decrement func_pointer_refcount.
851         (elf_i386_allocate_dynrelocs): Don't create the PLT entry if
852         there are only function pointer relocations which can be
853         resolved at run-time.  Keep dynanamic relocations for run-time
854         function pointer initialization.
855         (elf_i386_relocate_section): Copy dynamic function pointer
856         relocations.
857         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
858         func_pointer_refcount.
859         (elf_x86_64_link_hash_newfunc): Clear func_pointer_refcount.
860         (elf_x86_64_get_local_sym_hash): Likewise.
861         (elf_x86_64_copy_indirect_symbol): Also copy
862         func_pointer_refcount.
863         (elf_x86_64_check_relocs): Increment func_pointer_refcount.
864         (elf_x86_64_gc_sweep_hook): Decrement func_pointer_refcount.
865         (elf_x86_64_allocate_dynrelocs): Don't create the PLT entry if
866         there are only function pointer relocations which can be
867         resolved at run-time.  Keep dynanamic relocations for run-time
868         function pointer initialization.
869         (elf_x86_64_relocate_section): Copy dynamic function pointer
870         relocations.
871
872 2015-09-01  Alan Modra  <amodra@gmail.com>
873
874         * elf64-ppc.c (ppc64_elf_maybe_function_sym): Adjust symbol value
875         if .opd section has been edited.
876
877 2015-09-01  Alan Modra  <amodra@gmail.com>
878
879         PR 18878
880         * elf64-ppc.c (ARRAY_SIZE): Define.  Use throughout.
881         (enum ppc_stub_type): Add ppc_stub_save_res.
882         (struct map_stub): Add "next" and "needs_save_res".
883         (struct ppc_link_hash_entry): Add "save_res" flag.
884         (struct ppc_link_hash_table): Add "group".
885         (sfpr_define): Add stub_sec param.  Define symbol in stub_sec if
886         stub_sec is non-null.  Set "save_res".
887         (save_res_funcs): Make file scope, rename from funcs.  Adjust uses.
888         (ppc64_elf_adjust_dynamic_symbol): Prohibit plt call to save_res syms.
889         (ppc_build_one_stub): Handle ppc_stub_save_res.
890         (ppc_size_one_stub): Set stub type to ppc_size_one_stub on finding
891         stub for linker defined save_res sym.
892         (group_sections): Init new fields of struct map_stub.
893         (ppc64_elf_size_stubs): Reserve space for save/restore func copy.
894         (ppc64_elf_build_stubs): Copy save/restore funcs to groups.  Emit
895         alias syms too.
896         (ppc64_elf_relocate_section): Set destination for ppc_stub_save_res.
897
898 2015-08-31  Alan Modra  <amodra@gmail.com>
899
900         * elf64-ppc.c (get_r2off): Return -1 on error.
901         (ppc_build_one_stub): Adjust for get_r2off change.  Don't emit
902         addi r2,r2,0 on r2off stubs when the low 16-bit delta is zero.
903         (ppc_size_one_stub): Corresponding size changes for r2off stubs.
904         Add condition in test for -R objects.
905
906 2015-08-31  Alan Modra  <amodra@gmail.com>
907
908         * section.c (section_id): Make file scope.
909         (bfd_get_next_section_id): New function.
910         * elf64-ppc.c (struct map_stub): Remove toc_off field.  Move decl.
911         (struct ppc_stub_hash_entry): Delete stub_sec and id_sec.  Add
912         group.  Update all uses.
913         (struct ppc_link_hash_table): Delete top_id, top_index, and
914         input_list.  Add sec_info_arr_size.  Rename stub_group to
915         sec_info, and make group info indirect.  Update stub_group refs
916         throughout file.
917         (ppc_add_stub): Don't look for stub_sec on link_sec stub_group
918         entry.
919         (ppc_build_one_stub): Delete FIXME.
920         (ppc64_elf_setup_section_lists): Size htab->sec_info for all
921         sections, not just input sections.  Don't create htab->input_list.
922         (ppc64_elf_next_input_section): Update to use sec_info union as
923         list pointer.
924         (PREV_SEC): Delete.
925         (group_sections): Pass "info" param rather than "htab".  Iterate
926         over output sections rather than input_list.  Use sec_info union
927         as list pointers.  Alloc atruct map_stub, and return fail status.
928         * bfd-in2.h: Regenerate.
929
930 2015-08-31  Alan Modra  <amodra@gmail.com>
931
932         * elflink.c (elf_sort_symbol): Use correctly sized type for
933         calculating signed section->id difference.
934         (elf_link_add_object_symbols): Likewise.
935         * pef.c (bfd_pef_scan_start_address): Warning fix.
936         * vms-alpha.c (vms_new_section_hook): Likewise.
937
938 2015-08-31  Alan Modra  <amodra@gmail.com>
939
940         * elf32-nds32.c (nds32_convert_32_to_16_alu1): Warning fix.
941         (find_relocs_at_address_addr): Make "reloc_type" an enum.
942         (nds32_elf_relax_delete_blanks): Warning fix.
943         (nds32_elf_relax_loadstore): Correct loop bound.
944
945 2015-08-31  Alan Modra  <amodra@gmail.com>
946
947         * section.c (struct bfd_section): Make "id" and "index" unsigned.
948         * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust local var to suit.
949         * elf.c (elf_map_symbols): Likewise.
950         * elf64-ppc.c (sym_exists_at): Make "id" param unsigned.
951         (struct ppc_link_hash_table): Make "top_id" and "top_index" unsigned.
952         (ppc64_elf_setup_section_lists): Ditto for local vars.
953         * elf32-arm.c: Similarly to elf64-ppc.c.
954         * elf32-avr.c: Likewise.
955         * elf32-hppa.c: Likewise.
956         * elf32-m68hc1x.c: Likewise.
957         * elf32-metag.c: Likewise.
958         * elf32-nios2.c: Likewise.
959         * elfnn-aarch64.c: Likewise.
960         * simple.c (struct saved_offsets): Make "section_count" unsigned.
961         * bfd-in2.h: Regenerate.
962
963 2015-08-27  Alan Modra  <amodra@gmail.com>
964
965         PR 18867
966         * elf64-alpha.c (elf64_alpha_sort_relocs_p): New function.
967         (elf_backend_sort_relocs_p): Define.
968
969 2015-08-26  Alan Modra  <amodra@gmail.com>
970
971         PR 18867
972         * elflink.c (cmp_ext32l_r_offset, cmp_ext32b_r_offset): Delete.
973         (cmp_ext64l_r_offset, cmp_ext64b_r_offset): Delete.
974         (ext32l_r_offset, ext32b_r_offset, ext64l_r_offset, ext64b_r_offset):
975         New functions.
976         (elf_link_adjust_relocs): Use an insertion sort to sort relocs.
977
978 2015-08-26  Matthew Fortune  <matthew.fortune@imgtec.com>
979
980         PR ld/18401
981         * elfxx-mips.c (bfd_mips_isa_ext_mach): New function: Converts an
982         ISA value to a bfd machine number.
983         (bfd_mips_isa_ext): Update the ISA level and revision if
984         necessary.  Use mips_mach_extends_p to decide if the ISA extension
985         needs to be set.
986         (_bfd_mips_elf_merge_private_bfd_data): Allow the ISA extension to
987         be inferred from the ABI setting.  Set the ISA level from the
988         maximum of the incoming and outgoing ISA levels.
989
990 2015-08-25  Nick Clifton  <nickc@redhat.com>
991
992         PR binutils/18854
993         * elf.c (bfd_section_from_shdr): Replace assertions with warnings
994         about multiple symbol tables.
995
996 2015-08-25  Renlin Li  <renlin.li@arm.com>
997
998         * reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): Use LP64 instead of
999         ILP64.
1000         * bfd-in2.h: Regenerate.
1001
1002 2015-08-22  Alan Modra  <amodra@gmail.com>
1003
1004         * elf.c (_bfd_elf_slurp_version_tables): Always init vd_nodename.
1005         Don't copy fields not set by _bfd_elf_swap_verdef_in.
1006
1007 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
1008
1009         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
1010         types, including BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
1011         BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
1012         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12,
1013         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
1014         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12,
1015         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC,
1016         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12,
1017         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC.
1018         (elfNN_aarch64_final_link_relocate): Likewise.
1019         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1020         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1021
1022 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
1023
1024         * reloc.c (BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12,
1025         BFD_RELOC_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC,
1026         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12,
1027         BFD_RELOC_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC,
1028         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12,
1029         BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC.
1030         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12,
1031         BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC): New entries.
1032         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
1033         * bfd-in2.h: Regenerate.
1034         * libbfd.h: Regenerate.
1035
1036 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
1037
1038         PR ld/18276
1039         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize new relocation
1040         types, including BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12,
1041         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0,
1042         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC,
1043         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1,
1044         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC,
1045         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2.
1046         (elfNN_aarch64_final_link_relocate): Likewise.
1047         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1048         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1049
1050 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
1051
1052         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_HI12,
1053         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0,
1054         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G0_NC,
1055         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1,
1056         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G1_NC,
1057         BFD_RELOC_AARCH64_TLSLD_MOVW_DTPREL_G2): New entries.
1058         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
1059         * bfd-in2.h: Regenerate.
1060         * libbfd.h: Regenerate.
1061
1062 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
1063
1064         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
1065         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
1066         (aarch64_reloc_got_type): Likewise.
1067         (elfNN_aarch64_final_link_relocate): Likewise.
1068         (elfNN_aarch64_relocate_section): Likewise.
1069         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1070         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1071
1072 2015-08-19  Jiong Wang  <jiong.wang@arm.com>
1073
1074         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC): New entry.
1075         * bfd-in2.h: Regenerate.
1076         * libbfd.h: Regenerate.
1077         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1078         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
1079
1080 2015-08-19  Alan Modra  <amodra@gmail.com>
1081
1082         * elf-s390-common.c: Simplify expressions using
1083         bfd_linke_executable, bfd_link_pie and bfd_link_pic.
1084         * elf32-arm.c: Likewise.
1085         * elf32-bfin.c: Likewise.
1086         * elf32-frv.c: Likewise.
1087         * elf32-m68k.c: Likewise.
1088         * elf32-nios2.c: Likewise.
1089         * elf32-ppc.c: Likewise.
1090         * elf32-s390.c: Likewise.
1091         * elf32-sh.c: Likewise.
1092         * elf64-alpha.c: Likewise.
1093         * elf64-ppc.c: Likewise.
1094         * elf64-s390.c: Likewise.
1095         * elflink.c: Likewise.
1096
1097 2015-08-18  Jiong Wang  <jiong.wang@arm.com>
1098
1099         * elfnn-aarch64.c (aarch64_reloc_got_type): Delete useless check.
1100         (elfNN_aarch64_relocate_section): Likewise.
1101         (elfNN_aarch64_gc_sweep_hook): Likewise.
1102         (elfNN_aarch64_check_relocs): Likewise.
1103
1104 2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
1105
1106         PR ld/18841
1107         * elf-bfd.h (elf_link_hash_table): Add dynsym.
1108         * elf32-i386.c (elf_i386_reloc_type_class): Return
1109         reloc_class_ifunc for relocation against STT_GNU_IFUNC symbol.
1110         * elf64-x86-64.c (elf_x86_64_reloc_type_class): Likewise.
1111         * elflink.c (_bfd_elf_link_create_dynamic_sections): Set dynsym.
1112         (bfd_elf_size_dynsym_hash_dynstr): Use dynsym.
1113         (elf_final_link_info): Remove dynsym_sec.
1114         (elf_link_output_extsym): Replace dynsym_sec with dynsym.
1115         (bfd_elf_final_link): Remove reference to dynsym_sec.  Replace
1116         dynsym_sec with dynsym.
1117
1118 2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
1119
1120         * bfd/aoutx.h: Replace shared, executable, relocatable and pie
1121         fields with bfd_link_executable, bfd_link_dll,
1122         bfd_link_relocatable, bfd_link_pic and bfd_link_pie.
1123         * bfd/bout.c: Likewise.
1124         * bfd/coff-alpha.c: Likewise.
1125         * bfd/coff-arm.c: Likewise.
1126         * bfd/coff-i386.c: Likewise.
1127         * bfd/coff-i960.c: Likewise.
1128         * bfd/coff-m68k.c: Likewise.
1129         * bfd/coff-mcore.c: Likewise.
1130         * bfd/coff-mips.c: Likewise.
1131         * bfd/coff-ppc.c: Likewise.
1132         * bfd/coff-rs6000.c: Likewise.
1133         * bfd/coff-sh.c: Likewise.
1134         * bfd/coff-tic80.c: Likewise.
1135         * bfd/coff-x86_64.c: Likewise.
1136         * bfd/coff64-rs6000.c: Likewise.
1137         * bfd/coffgen.c: Likewise.
1138         * bfd/cofflink.c: Likewise.
1139         * bfd/ecoff.c: Likewise.
1140         * bfd/ecofflink.c: Likewise.
1141         * bfd/elf-bfd.h: Likewise.
1142         * bfd/elf-eh-frame.c: Likewise.
1143         * bfd/elf-ifunc.c: Likewise.
1144         * bfd/elf-m10200.c: Likewise.
1145         * bfd/elf-m10300.c: Likewise.
1146         * bfd/elf-s390-common.c: Likewise.
1147         * bfd/elf-vxworks.c: Likewise.
1148         * bfd/elf.c: Likewise.
1149         * bfd/elf32-arm.c: Likewise.
1150         * bfd/elf32-avr.c: Likewise.
1151         * bfd/elf32-bfin.c: Likewise.
1152         * bfd/elf32-cr16.c: Likewise.
1153         * bfd/elf32-cr16c.c: Likewise.
1154         * bfd/elf32-cris.c: Likewise.
1155         * bfd/elf32-crx.c: Likewise.
1156         * bfd/elf32-d10v.c: Likewise.
1157         * bfd/elf32-dlx.c: Likewise.
1158         * bfd/elf32-epiphany.c: Likewise.
1159         * bfd/elf32-fr30.c: Likewise.
1160         * bfd/elf32-frv.c: Likewise.
1161         * bfd/elf32-ft32.c: Likewise.
1162         * bfd/elf32-h8300.c: Likewise.
1163         * bfd/elf32-hppa.c: Likewise.
1164         * bfd/elf32-i370.c: Likewise.
1165         * bfd/elf32-i386.c: Likewise.
1166         * bfd/elf32-i860.c: Likewise.
1167         * bfd/elf32-ip2k.c: Likewise.
1168         * bfd/elf32-iq2000.c: Likewise.
1169         * bfd/elf32-lm32.c: Likewise.
1170         * bfd/elf32-m32c.c: Likewise.
1171         * bfd/elf32-m32r.c: Likewise.
1172         * bfd/elf32-m68hc11.c: Likewise.
1173         * bfd/elf32-m68hc1x.c: Likewise.
1174         * bfd/elf32-m68k.c: Likewise.
1175         * bfd/elf32-mcore.c: Likewise.
1176         * bfd/elf32-mep.c: Likewise.
1177         * bfd/elf32-metag.c: Likewise.
1178         * bfd/elf32-microblaze.c: Likewise.
1179         * bfd/elf32-moxie.c: Likewise.
1180         * bfd/elf32-msp430.c: Likewise.
1181         * bfd/elf32-mt.c: Likewise.
1182         * bfd/elf32-nds32.c: Likewise.
1183         * bfd/elf32-nios2.c: Likewise.
1184         * bfd/elf32-or1k.c: Likewise.
1185         * bfd/elf32-ppc.c: Likewise.
1186         * bfd/elf32-rl78.c: Likewise.
1187         * bfd/elf32-rx.c: Likewise.
1188         * bfd/elf32-s390.c: Likewise.
1189         * bfd/elf32-score.c: Likewise.
1190         * bfd/elf32-score7.c: Likewise.
1191         * bfd/elf32-sh-symbian.c: Likewise.
1192         * bfd/elf32-sh.c: Likewise.
1193         * bfd/elf32-sh64.c: Likewise.
1194         * bfd/elf32-spu.c: Likewise.
1195         * bfd/elf32-tic6x.c: Likewise.
1196         * bfd/elf32-tilepro.c: Likewise.
1197         * bfd/elf32-v850.c: Likewise.
1198         * bfd/elf32-vax.c: Likewise.
1199         * bfd/elf32-visium.c: Likewise.
1200         * bfd/elf32-xc16x.c: Likewise.
1201         * bfd/elf32-xstormy16.c: Likewise.
1202         * bfd/elf32-xtensa.c: Likewise.
1203         * bfd/elf64-alpha.c: Likewise.
1204         * bfd/elf64-hppa.c: Likewise.
1205         * bfd/elf64-ia64-vms.c: Likewise.
1206         * bfd/elf64-mmix.c: Likewise.
1207         * bfd/elf64-ppc.c: Likewise.
1208         * bfd/elf64-s390.c: Likewise.
1209         * bfd/elf64-sh64.c: Likewise.
1210         * bfd/elf64-x86-64.c: Likewise.
1211         * bfd/elflink.c: Likewise.
1212         * bfd/elfnn-aarch64.c: Likewise.
1213         * bfd/elfnn-ia64.c: Likewise.
1214         * bfd/elfxx-mips.c: Likewise.
1215         * bfd/elfxx-sparc.c: Likewise.
1216         * bfd/elfxx-tilegx.c: Likewise.
1217         * bfd/i386linux.c: Likewise.
1218         * bfd/linker.c: Likewise.
1219         * bfd/m68klinux.c: Likewise.
1220         * bfd/pdp11.c: Likewise.
1221         * bfd/pe-mips.c: Likewise.
1222         * bfd/peXXigen.c: Likewise.
1223         * bfd/reloc.c: Likewise.
1224         * bfd/reloc16.c: Likewise.
1225         * bfd/sparclinux.c: Likewise.
1226         * bfd/sunos.c: Likewise.
1227         * bfd/vms-alpha.c: Likewise.
1228         * bfd/xcofflink.c: Likewise.
1229
1230 2015-08-18  Alan Modra  <amodra@gmail.com>
1231
1232         PR 18667
1233         * Makefile.am: Use $(SED) in place of sed throughout.
1234         * Makefile.in: Regenerate.
1235
1236 2015-08-18  Alan Modra  <amodra@gmail.com>
1237
1238         * elf64-ppc.c (ppc64_elf_func_desc_adjust): Don't redefine .TOC.
1239         if already defined, and set linker_def.
1240         (ppc64_elf_set_toc): Use .TOC. value if defined other than by
1241         the backend.
1242
1243 2015-08-14  Alan Modra  <amodra@gmail.com>
1244
1245         PR ld/18759
1246         * elf32-or1k.c: Revert 2015-08-11 change.
1247
1248 2015-08-13  H.J. Lu  <hongjiu.lu@intel.com>
1249
1250         PR ld/18801
1251         * elf32-i386.c (elf_i386_size_dynamic_sections): Issue an error
1252         for read-only segment with dynamic IFUNC relocations.
1253         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise.
1254
1255 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
1256
1257         * elfxx-mips.c (STUB_MOVE): Change to use 'or' only.
1258         (mips_o32_exec_plt0_entry, mips_n32_exec_plt0_entry,
1259         mips_n64_exec_plt0_entry, micromips_insn32_o32_exec_plt0_entry):
1260         Update to use 'or' instead of 'addu/daddu'.
1261         (_bfd_mips_elf_finish_dynamic_symbol): Update usage of STUB_MOVE.
1262         (move_insns_32): Reorder table.
1263
1264 2015-08-11  H.J. Lu  <hongjiu.lu@intel.com>
1265
1266         * elf32-i386.c (elf_i386_relocate_section): Properly skip IFUNC
1267         relocations in debug sections.
1268         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
1269
1270 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1271
1272         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Improve warning
1273         message for R_AARCH64_LD64_GOTPAGE_LO15/R_AARCH64_LD32_GOTPAGE_LO14.
1274
1275 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1276
1277         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): New.
1278         (aarch64_can_relax_tls): Use the new IS_AARCH64_TLS_RELAX_RELOC.
1279
1280 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1281
1282         * bfd/elfnn-aarch64.c (aarch64_type_of_stub): New parameter "sym_sec".
1283         Loose the check for symbol from ABS section.
1284         (elfNN_aarch64_size_stubs): Pass sym_sec.
1285
1286 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1287
1288         PR ld/18668
1289         * elfnn-aarch64.c (aarch64_type_of_stub): Update destination for
1290         calls go through plt stub.
1291         (elfNN_aarch64_final_link_relocate): Adjust code logic for CALL26,
1292         JUMP26 relocation to support inserting veneer for call to plt stub.
1293
1294 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1295
1296         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
1297         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
1298         (aarch64_reloc_got_type): Likewise.
1299         (elfNN_aarch64_final_link_relocate): Likewise.
1300         (elfNN_aarch64_relocate_section): Likewise.
1301         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1302         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1303
1304 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1305
1306         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12): New entry.
1307         * bfd-in2.h: Regenerate.
1308         * libbfd.h: Regenerate.
1309         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1310         BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12.
1311
1312 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1313
1314         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
1315         BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
1316         (aarch64_reloc_got_type): Likewise.
1317         (elfNN_aarch64_final_link_relocate): Likewise.
1318         (elfNN_aarch64_relocate_section): Likewise.
1319         (elfNN_aarch64_gc_sweep_hook): Likewise.
1320         (elfNN_aarch64_check_relocs): Likewise.
1321         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1322         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1323
1324 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1325
1326         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC): New entry.
1327         * bfd-in2.h: Regenerate.
1328         * libbfd.h: Regenerate.
1329         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1330         BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC.
1331
1332 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1333
1334         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
1335         BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21.
1336         (aarch64_reloc_got_type): Likewise.
1337         (elfNN_aarch64_final_link_relocate): Likewise.
1338         (elfNN_aarch64_relocate_section): Likewise.
1339         (elfNN_aarch64_gc_sweep_hook): Likewise.
1340         (elfNN_aarch64_check_relocs): Likewise.
1341         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1342         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1343
1344 2015-08-11  Jiong Wang  <jiong.wang@arm.com>
1345
1346         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21): New entry.
1347         * bfd-in2.h: Regenerate.
1348         * libbfd.h: Regenerate.
1349         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1350         BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21.
1351
1352 2015-08-11  H.J. Lu  <hongjiu.lu@intel.com>
1353
1354         PR ld/18808
1355         * elf32-i386.c (elf_i386_relocate_section): Skip IFUNC
1356         relocations in debug sections.
1357         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
1358
1359 2015-08-11  Peter Zotov  <whitequark@whitequark.org>
1360
1361         PR ld/18759
1362         * elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE.
1363         (R_OR1K_16_PCREL): Likewise.
1364         (R_OR1K_8_PCREL): Likewise.
1365
1366 2015-08-11  Nick Clifton  <nickc@redhat.com>
1367
1368         PR binutils/18747
1369         * coff-sh.c (_bfd_sh_align_load_span): Fix typo when setting
1370         opcode count.
1371
1372         PR binutils/18758
1373         * elf.c (_bfd_elf_setup_sections): Add checks for corrupt section
1374         group information.
1375         * peicode.h (pe_ILF_make_a_section): Ensure alignment of the
1376         used_by_bfd pointer.
1377         (pe_ILF_build_a_bfd): Ensure alignment of vars.data pointer.
1378
1379 2015-08-11  H.J. Lu  <hongjiu.lu@intel.com>
1380
1381         * elf.c (_bfd_elf_copy_private_bfd_data): Fix a typo.
1382
1383 2015-08-10  H.J. Lu  <hongjiu.lu@intel.com>
1384
1385         * elf-bfd.h (elf_symbol_version): New enum.
1386         (elf_link_hash_entry): Replace hidden with versioned.
1387         * elflink.c (_bfd_elf_merge_symbol): Don't look for symbol
1388         version if the symbol is unversioned.  Initialize versioned.
1389         (_bfd_elf_add_default_symbol): Don't look for symbol version
1390         if the symbol is unversioned or hidden.  Initialize versioned.
1391         (elf_collect_hash_codes): Don't look for symbol version if the
1392         symbol is unversioned.
1393         (elf_collect_gnu_hash_codes): Likewise.
1394         (bfd_elf_gc_mark_dynamic_ref_symbol): Likewise.
1395         (_bfd_elf_link_hash_copy_indirect): Check versioned instead of
1396         hidden.
1397         (elf_link_output_extsym): Likewise.
1398
1399 2015-08-07  H.J. Lu  <hongjiu.lu@intel.com>
1400
1401         PR binutils/18785
1402         * elf.c (_bfd_elf_copy_private_bfd_data): When copying the
1403         sh_link and sh_info fields in stripped section headers, we also
1404         check if the sh_type, sh_flags, sh_addralign and sh_entsize
1405         fields of the output section match the output.  Since
1406         --only-keep-debug turns all non-debug sections into SHT_NOBITS
1407         sections, the output SHT_NOBITS type matches any input type.
1408
1409 2015-08-07  H.J. Lu  <hongjiu.lu@intel.com>
1410
1411         PR ld/18720
1412         * elflink.c (_bfd_elf_merge_symbol): Add a parameter to indicate
1413         if the new symbol matches the existing one.  The new hidden
1414         versioned symbol matches the existing symbol if they have the
1415         same symbol version. Update the existing symbol only if they
1416         match.
1417         (_bfd_elf_add_default_symbol): Update call to
1418         _bfd_elf_merge_symbol.
1419         (_bfd_elf_link_assign_sym_version): Don't set the hidden field
1420         here.
1421         (elf_link_add_object_symbols): Override a definition only if the
1422         new symbol matches the existing one.
1423         (_bfd_elf_link_hash_copy_indirect): Don't copy any references to
1424         the hidden versioned symbol.
1425         (elf_link_output_extsym): Bind a symbol locally when linking
1426         executable if it is locally defined, hidden versioned, not
1427         referenced by shared library and not exported.  Turn on
1428         VERSYM_HIDDEN only if the hidden versioned symbol is defined
1429         locally.
1430
1431 2015-08-05  Nick Clifton  <nickc@redhat.com>
1432
1433         * elf.c (_bfd_elf_copy_private_bfd_data): Copy the sh_link and
1434         sh_info fields of sections whose type has been changed to
1435         SHT_NOBITS.
1436
1437 2015-08-04  Yuriy M. Kaminskiy"  <yumkam@gmail.com>
1438             Tyler Hicks  <tyhicks@canonical.com>
1439
1440         PR binutils/18750
1441         * ihex.c (ihex_scan): Fixes incorrect escape sequence in error message
1442         and stack overflow when char is signed and \200-\376 was in place of hex
1443         digit; also fixes \377 was handled as EOF instead of "incorrect character".
1444         (ihex_read_section): Changed for consistency.
1445         (ihex_bad_byte): Prevent (now impossible to trigger) stack
1446         overflow and incorrect escape sequence handling.
1447         * srec.c (srec_bad_byte): Likewise.
1448
1449 2015-08-03  Hans-Peter Nilsson  <hp@axis.com>
1450
1451         * elf32-cris.c (cris_elf_relocate_section)
1452         (elf_cris_finish_dynamic_symbol, cris_elf_check_relocs)
1453         (elf_cris_discard_excess_dso_dynamics): Use SYMBOLIC_BIND, not
1454         just link_info->symbolic, to check if a symbol should be bound
1455         symbolically.
1456
1457 2015-07-30  H.J. Lu  <hongjiu.lu@intel.com>
1458
1459         PR ld/18735
1460         * elflink.c (_bfd_elf_add_default_symbol): Add the default
1461         symbol if not performing a relocatable link.
1462         (elf_link_add_object_symbols): Adjust the default symbol if
1463         not performing a relocatable link.
1464
1465 2015-07-29  H.J. Lu  <hongjiu.lu@intel.com>
1466
1467         * elflink.c (elf_link_add_object_symbols): Remove
1468         !info->relocatable check for info->executable.  Add
1469         !info->relocatable check for !info->executable.
1470         (elf_link_output_extsym): Remove
1471         !info->relocatable check for info->executable.
1472
1473 2015-07-29  Hans-Peter Nilsson  <hp@bitrange.com>
1474
1475         * mmo.c (mmo_write_symbols_and_terminator): Skip symbol-type
1476         assignment loop for bfd plugin objects.
1477
1478 2015-07-28  Alan Modra  <amodra@gmail.com>
1479
1480         * elf.c (_bfd_elf_map_sections_to_segments): Do not make a new
1481         segment for loaded sections after nonloaded sections if the
1482         sections are on the same page.
1483
1484 2015-07-28  Iain Buclaw  <ibuclaw@gdcproject.org>
1485
1486         * configure.in: Add asprintf and vasprintf to AC_CHECK_DECLS.
1487         * config.in, configure: Regenerate.
1488
1489 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
1490
1491         * configure: Regenerated.
1492
1493 2015-07-27  Nick Clifton  <nickc@redhat.com>
1494
1495         * elf32-msp430.c (uses_large_model): New function.
1496         (msp430_elf_eh_frame_address_size): New function.
1497         (elf_backend_eh_frame_address_size): Define.
1498
1499 2015-07-27  Szabolcs Nagy  <szabolcs.nagy@arm.com>
1500
1501         PR ld/18705
1502         * elfnn-aarch64.c (elf_backend_extern_protected_data): Define.
1503
1504 2015-07-27  Szabolcs Nagy  <szabolcs.nagy@arm.com>
1505
1506         PR ld/18705
1507         * elf32-arm.c (elf_backend_extern_protected_data): Define.
1508
1509 2015-07-25  H.J. Lu  <hongjiu.lu@intel.com>
1510
1511         PR ld/18718
1512         * elflink.c (elf_link_output_extsym): Check symbol version
1513         section check only if not linking executable, the symbol is
1514         referenced by shared library or not locally defined.
1515
1516 2015-07-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1517
1518         * elf32-arm.c (elf32_arm_final_link_relocate): Use SYMBOLIC_BIND to
1519         check if a symbol should be bound symbolically.
1520         * elf32-hppa.c (elf32_hppa_check_relocs,
1521         elf32_hppa_adjust_dynamic_symbol, elf32_hppa_relocate_section,
1522         elf32_hppa_finish_dynamic_symbol): Likewise.
1523         * elf32-m68k.c (elf_m68k_check_relocs,
1524         elf_m68k_relocate_section): Likewise.
1525         * elf32-nios2.c (nios2_elf32_relocate_section,
1526         nios2_elf32_check_relocs, allocate_dynrelocs): Likewise.
1527         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol,
1528         elf32_tic6x_relocate_section): Likewise.
1529
1530 2015-07-24  Alan Modra  <amodra@gmail.com>
1531
1532         * elf.c (_bfd_elf_assign_file_positions_for_non_load): Use .rela
1533         prefix for reloc section corresponding to rela section associated
1534         with renamed debug section.
1535
1536 2015-07-24  Alan Modra  <amodra@gmail.com>
1537
1538         * section.c (bfd_get_section_by_name_if): Iterate over entire hash
1539         chain.
1540
1541 2015-07-23  Joseph Myers  <joseph@codesourcery.com>
1542
1543         * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections)
1544         <DT_MIPS_RLD_MAP_REL>: Add target address to host address
1545         difference, not to host pointer.
1546
1547 2015-07-22  Alan Modra  <amodra@gmail.com>
1548
1549         * elf64-ppc.c (opd_entry_value): Remove assertion.  Instead,
1550         return -1 if symbol referenced is not defined.  Tidy.
1551
1552 2015-07-20  Alan Modra  <amodra@gmail.com>
1553
1554         * po/SRC-POTFILES.in: Regenerate.
1555
1556 2015-07-17  Jiong Wang  <jiong.wang@arm.com>
1557
1558         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Sort alphabetically.
1559         (IS_AARCH64_TLSDESC_RELOC): Sort alphabetically.
1560
1561 2015-07-16  Jiong Wang  <jiong.wang@arm.com>
1562
1563         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize
1564         BFD_RELOC_AARCH64_TLSLD_ADR_PREL21.
1565         (aarch64_reloc_got_type): Ditto.
1566         (elfNN_aarch64_final_link_relocate): Ditto.
1567         (elfNN_aarch64_relocate_section): Ditto.
1568         (elfNN_aarch64_gc_sweep_hook): Ditto.
1569         (elfNN_aarch64_check_relocs): Ditto.
1570         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1571         (_bfd_aarch64_elf_resolve_relocation): Ditto.
1572
1573 2015-07-16  Jiong Wang  <jiong.wang@arm.com>
1574
1575         * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADR_PREL21): New entry.
1576         * bfd-in2.h: Regenerate.
1577         * libbfd.h: Regenerate.
1578         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1579         BFD_RELOC_AARCH64_TLSLD_ADR_PREL21.
1580
1581 2015-07-10  H.J. Lu  <hongjiu.lu@intel.com>
1582
1583          PR binutils/18656
1584          * bfd.c (bfd_convert_section_size): New function.
1585          (bfd_convert_section_contents): Likewise.
1586          * bfd-in2.h: Regenerated.
1587
1588 2015-07-09  Catherine Moore  <clm@codesourcery.com>
1589
1590         * elflink.c (bfd_elf_size_dynamic_sections): Call to
1591         _bfd_elf_maybe_strip_eh_frame_hdr should be before
1592         bed->elf_backend_size_dynamic_sections.
1593
1594 2015-07-08  Pitchumani Sivanupandi <pitchumani.s@atmel.com>
1595
1596         * elf32-avr.c: Add 32 bit PC relative relocation for AVR target.
1597
1598 2015-07-05  Richard Sandiford  <richard.sandiford@arm.com>
1599
1600         * elf64-ppc.c (toc_adjusting_stub_needed): Use the symbol value
1601         plus addend rather than the original st_value when looking up
1602         entries in opd->adjust.
1603
1604 2015-07-03   Kai Tietz  <ktietz@redhat.com>
1605              Nick Clifton  <nickc@redhat.com>
1606
1607         PR ld/11539
1608         * coffcode.h (coff_bfd_gc_sections): Define default
1609         to bfd_coff_gc_sections function.
1610         (coff_gc_mark_hook_fn): New type.
1611         * coffgen.c (init_reloc_cookie): Copy and adjust coff
1612         related code about gc-sections from elflink.c to here.
1613         (fini_reloc_cookie): Likewise.
1614         (init_reloc_cookie_rels): Likewise.
1615         (fini_reloc_cookie_rels): Likewise.
1616         (init_reloc_cookie_for_section): Likewise.
1617         (fini_reloc_cookie_for_section): Likewise.
1618         (_bfd_coff_gc_mark_hook): Likewise.
1619         (_bfd_coff_gc_mark_rsec): Likewise.
1620         (_bfd_coff_gc_mark_reloc): Likewise.
1621         (_bfd_coff_gc_mark): Likewise.
1622         (_bfd_coff_gc_mark_extra_sections): Likewise.
1623         (coff_gc_sweep_symbol_info): Likewise.
1624         (coff_gc_sweep_symbol): Likewise.
1625         (gc_sweep_hook_fn): Likewise.
1626         (coff_gc_sweep): Likewise.
1627         (bfd_coff_gc_sections): Likewise.
1628         (_bfd_coff_gc_keep): Likewise.
1629         * libcoff-in.h (coff_reloc_cookie): New struct.
1630         (bfd_coff_gc_sections): New prototype.
1631         * libcoff.h: Regenerate.
1632
1633 2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
1634             Cesar Philippidis  <cesar@codesourcery.com>
1635
1636         * bfd-in2.h: Regenerated.
1637         * elf32-nios2.c (elf_nios2_howto_table_rel): Rename to...
1638         (elf_nios2_r1_howto_table_rel): This.
1639         (elf_nios2_r2_howto_table_rel): New.
1640         (BFD_IS_R2): New.
1641         (lookup_howto): Add ABFD parameter.  Adjust to look up in either
1642         the R1 or R2 relocation table, as determined by ABFD.
1643         (nios2_reloc_map): Add R2 relocations.
1644         (nios2_elf32_bfd_reloc_type_lookup): Do lookup using lookup_howto.
1645         Pass it the ABFD parameter.
1646         (nios2_elf32_bfd_reloc_name_lookup): Use ABFD to decide whether to
1647         return an R1 or R2 relocation.
1648         (nios2_elf32_info_to_howto): Do lookup using lookup_howto.
1649         Pass it the ABFD parameter.
1650         (nios2_elf32_do_call26_relocate): Check for alignment on a 4-byte
1651         boundary.
1652         (nios2_elf32_relocate_section): Adjust call to lookup_howto.
1653         * libbfd.h: Regenerated.
1654         * reloc.c (BFD_RELOC_NIOS2_R2_S12): New.
1655         (BFD_RELOC_NIOS2_R2_I10_1_PCREL): New.
1656         (BFD_RELOC_NIOS2_R2_T1I7_1_PCREL): New.
1657         (BFD_RELOC_NIOS2_R2_T1I7_2): New.
1658         (BFD_RELOC_NIOS2_R2_T2I4): New.
1659         (BFD_RELOC_NIOS2_R2_T2I4_1): New.
1660         (BFD_RELOC_NIOS2_R2_T2I4_2): New.
1661         (BFD_RELOC_NIOS2_R2_X1I7_2): New.
1662         (BFD_RELOC_NIOS2_R2_X2L5): New.
1663         (BFD_RELOC_NIOS2_R2_F1I5_2): New.
1664         (BFD_RELOC_NIOS2_R2_L5I4X1): New.
1665         (BFD_RELOC_NIOS2_R2_T1X1I6): New.
1666         (BFD_RELOC_NIOS2_R2_T1X1I6_2): New.
1667
1668 2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
1669             Cesar Philippidis  <cesar@codesourcery.com>
1670
1671         * archures.c (bfd_mach_nios2r1, bfd_mach_nios2r2): New.
1672         * bfd-in2.h: Regenerated.
1673         * cpu-nios2.c (nios2_compatible): New.
1674         (N): Use nios2_compatible instead of bfd_default_compatible.
1675         (NIOS2R1_NEXT, NIOS2R2_NEXT): Define.
1676         (arch_info_struct): New.
1677         (bfd_nios2_arch): Chain to NIOS2R1_NEXT.
1678         * elf32-nios2.c (is_nios2_elf): New.
1679         (nios2_elf32_merge_private_bfd_data): New.
1680         (nios2_elf32_object_p): New.
1681         (bfd_elf32_bfd_merge_private_bfd_data): Define.
1682         (elf_backend_object_p): Define.
1683
1684 2015-07-01  H.J. Lu  <hongjiu.lu@intel.com>
1685
1686         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Refactor.
1687
1688 2015-06-30  Nick Clifton  <nickc@redhat.com>
1689
1690         PR binutils/18570
1691         * elf-attrs.c (obj_attr_size): Use an unsigned int type for the tag.
1692         (write_obj_attribute): Likewise.
1693         (elf_new_obj_attr): Likewise.
1694         (bfd_elf_get_obj_attr_int): Likewise.
1695         (bfd_elf_add_obj_attr_int): Likewise.
1696         (bfd_elf_add_obj_attr_string): Likewise.
1697         (bfd_elf_add_obj_attr_int_string): Likewise.
1698         (gnu_obj_attrs_arg_type): Likewise.
1699         (_bfd_elf_obj_attrs_arg_type): Likewise.
1700         (_bfd_elf_parse_attributes): Likewise.
1701         (_bfd_elf_merge_unknown_attribute_list): Likewise.
1702         * elf-bfd.h (struct obj_attribute_list): Likewise.
1703         Update prototypes.
1704
1705 2015-06-28  H.J. Lu  <hongjiu.lu@intel.com>
1706
1707         * bfd-in.h (compressed_debug_section_type): Remove
1708         COMPRESS_DEBUG_ZLIB.
1709         * bfd-in2.h : Regenerated.
1710
1711 2015-06-26  Matthew Fortune  <matthew.fortune@imgtec.com>
1712
1713         * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable
1714         instead of !shared to indicate an application vs shared library.
1715         (_bfd_mips_elf_size_dynamic_sections): Likewise.
1716         (_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP_REL.
1717         (_bfd_mips_elf_get_target_dtag): Likewise.
1718
1719 2015-06-25  DJ Delorie  <dj@redhat.com>
1720
1721         * elf32-msp430.c (msp430_final_link_relocate): Fix comments.  Fix
1722         REL loads to match RELA stores.
1723
1724 2015-06-25  H.J. Lu  <hongjiu.lu@intel.com>
1725
1726         * elf.c (_bfd_elf_compute_section_file_positions): Don't
1727         initialize sh_size for .shstrtab here.
1728
1729 2015-06-25  H.J. Lu  <hongjiu.lu@intel.com>
1730
1731         PR gas/18451
1732         * elf-bfd.h (elf_sym_strtab): New.
1733         (elf_link_hash_table): Add strtabcount, strtabsize and
1734         strtab.
1735         (_bfd_elf_stringtab_init): Removed.
1736         * elf.c (_bfd_elf_stringtab_init): Removed.
1737         (_bfd_elf_compute_section_file_positions): Replace
1738         bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/
1739         _bfd_stringtab_size with
1740         elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/
1741         _bfd_elf_strtab_size.  Use _bfd_elf_strtab_add,
1742         _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get
1743         st_name.
1744         (swap_out_syms): Likewise.
1745         * elflink.c (elf_final_link_info): Replace bfd_strtab_hash
1746         with elf_strtab_hash.  Remove symbuf, symbuf_count,
1747         symbuf_size and shndxbuf_size.
1748         (elf_link_flush_output_syms): Removed.
1749         (elf_link_output_sym): Renamed to ...
1750         (elf_link_output_symstrtab): This.  Replace _bfd_stringtab_add
1751         with _bfd_elf_strtab_add.  Don't flush symbols to the file nor
1752         swap out symbols.
1753         (elf_link_swap_symbols_out): New.
1754         (elf_link_output_extsym): Replace elf_link_output_sym with
1755         elf_link_output_symstrtab.
1756         (elf_link_input_bfd): Likewise.
1757         (elf_final_link_free): Replace _bfd_stringtab_free with
1758         _bfd_elf_strtab_free.  Remove symbuf.
1759         (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with
1760         _bfd_elf_strtab_init.  Don't set symbuf, symbuf_count,
1761         symbuf_size nor shndxbuf_size.  Initialize strtabsize and
1762         strtab.  Initialize symshndxbuf to -1 when number of sections
1763         >= 64K.  Replace elf_link_output_sym/elf_link_output_sym with
1764         elf_link_output_symstrtab/elf_link_output_symstrtab. Don't
1765         call elf_link_flush_output_syms.  Call _bfd_elf_strtab_finalize
1766         and elf_link_swap_symbols_out.  Replace _bfd_stringtab_size
1767         and _bfd_stringtab_emit with _bfd_elf_strtab_size and
1768         _bfd_elf_strtab_emit.
1769
1770 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
1771
1772         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Silence older
1773         GCC warning.
1774
1775 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
1776
1777         * elf32-i386.c (elf_i386_allocate_dynrelocs): Always allocate
1778         space for the first .plt entry.
1779         (elf_i386_size_dynamic_sections): Always add DT_PLTGOT for .plt
1780         section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
1781         there are PLT relocations.
1782         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Always
1783         allocate space for the first .plt entry.
1784         (elf_x86_64_size_dynamic_sections): Always add DT_PLTGOT for
1785         .plt section.  Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if
1786         there are PLT relocations.
1787
1788 2015-06-24  H.J. Lu  <hongjiu.lu@intel.com>
1789
1790         PR ld/18591
1791         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Don't convert
1792         R_X86_64_GOTPCREL to R_X86_64_PC32 if it will cause relocation
1793         overflow.
1794
1795 2015-06-23  Jiong Wang  <jiong.wang@arm.com>
1796
1797         * elfnn-aarch64.c (aarch64_readonly_dynrelocs): New function.
1798         (elfNN_aarch64_size_dynamic_sections): Traverse hash table to check
1799         relocations against read-only sections.
1800
1801 2015-06-18  Nick Clifton  <nickc@redhat.com>
1802
1803         PR 18481
1804         * elf32-arm.c (R_ARM_TLS_LE32): Set the special function to NULL.
1805
1806 2015-06-15  Jon Turney  <jon.turney@dronecode.org.uk>
1807
1808         * bfd.c: Change struct bfd_build_id to use bfd_size_type.
1809         * bfd-in2.h : Regenerate.
1810
1811 2015-06-16  Alan Modra  <amodra@gmail.com>
1812
1813         * elf32-ppc.c (ppc_elf_relocate_section): Correct binary search of
1814         dynamic relocs.
1815
1816 2015-06-10  Jon Turney  <jon.turney@dronecode.org.uk>
1817
1818         * elf-bfd.h : Remove struct elf_build_id.
1819         * bfd.c : Add struct bfd_build_id.
1820         * bfd-in2.h: Regenerate.
1821         * elf.c (elfobj_grok_gnu_build_id): Update to use bfd_build_id.
1822         * libpei.h: Add protoype and macros for
1823         bfd_XXi_slurp_codeview_record.
1824         * peXXigen.c (_bfd_XXi_slurp_codeview_record): Make public
1825         * peicode.h (pe_bfd_read_buildid): Add.
1826         (pe_bfd_object_p): Use pe_bfd_read_buildid().
1827
1828 2015-06-15  Renlin Li  <renlin.li@arm.com>
1829
1830         * reloc.c (BFD_RELOC_AARCH64_LD64_GOTOFF_LO15): New entry.
1831         * bfd-in2.h: Regenerate.
1832         * libbfd.h: Regenerate.
1833         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1834         BFD_RELOC_AARCH64_LD64_GOTOFF_LO15.
1835
1836 2015-06-15  Alan Modra  <amodra@gmail.com>
1837
1838         * cofflink.c (_bfd_coff_generic_relocate_section): Revert
1839         2014-03-26 change.  Call _bfd_clear_contents for relocs against
1840         local and global symbols defined in discarded input sections.
1841
1842 2015-06-05  Nick Clifton  <nickc@redhat.com>
1843
1844         * elf32-msp430.c (rl78_sym_diff_handler): New function.
1845         (msp430_howto_table): Use the new function for the SYM_DIFF reloc.
1846         (msp430x_howto_table): Likewise.
1847
1848 2015-06-05  Alan Modra  <amodra@gmail.com>
1849
1850         * elf64-ppc.c (ppc_elf_relocate_section): Move dynamic text
1851         relocs with insns moved by --ppc476-workaround.  Correct
1852         output of REL16 relocs.
1853
1854 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1855
1856         * elfnn-aarch64.c (aarch64_reloc_got_type): Support
1857         BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
1858         (elfNN_aarch64_final_link_relocate): Ditto.
1859         (elfNN_aarch64_gc_swap_hook): Ditto.
1860         (elfNN_aarch64_check_relocs): Ditto.
1861         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1862
1863 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1864
1865         * reloc.c (BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14): New entry.
1866         * bfd-in2.h: Regenerate.
1867         * libbfd.h: Regenerate.
1868         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1869         BFD_RELOC_AARCH64_LD32_GOTPAGE_LO14.
1870
1871 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1872
1873         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Set overflow type to
1874         complain_overflow_unsigned for BFD_RELOC_AARCH64_TLSLE_ADD_LO12.
1875         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Don't use
1876         PGOFF for BFD_RELOC_AARCH64_TLSLE_ADD_LO12.
1877
1878 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1879
1880         * elfnn-aarch64.c (aarch64_reloc_got_type): Support
1881         BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15.
1882         (elfNN_aarch64_final_link_relocate): Ditto.
1883         (elfNN_aarch64_gc_swap_hook): Ditto.
1884         (elfNN_aarch64_check_relocs): Ditto.
1885         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1886
1887 2015-06-01  Jiong Wang  <jiong.wang@arm.com>
1888
1889         * reloc.c (BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15): New entry.
1890         * bfd-in2.h: Regenerate.
1891         * libbfd.h: Regenerate.
1892         * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for
1893         BFD_RELOC_AARCH64_LD64_GOTPAGE_LO15.
1894
1895 2015-05-28  Catherine Moore  <clm@codesourcery.com>
1896             Bernd Schmidt <bernds@codesourcery.com>
1897             Paul Brook <paul@codesourcery.com>
1898
1899         bfd/
1900         * bfd-in2.h: Regenerated.
1901         * elf-bfd.h (DWARF2_EH_HDR, COMPACT_EH_HDR): Define.
1902         (COMPACT_EH_CANT_UNWIND_OPCODE): Define.
1903         (dwarf_eh_frame_hdr_info): Move dwarf-specific fields from
1904         eh_frame_hdr_info.
1905         (compact_eh_frame_hdr_info): Declare.
1906         (eh_frame_hdr_info):  Redeclare with union for dwarf-specific
1907         fields and compact-eh fields.
1908         (elf_backend_data): Add cant_unwind_opcode and compact_eh_encoding.
1909         (bfd_elf_section_data): Add eh_frame_entry_field.
1910         (elf_section_eh_frame_entry): Define.
1911         (bfd_elf_parse_eh_frame_entries): Declare.
1912         (_bfd_elf_parse_eh_frame_entry): Declare.
1913         (_bfd_elf_end_eh_frame_parsing): Declare.
1914         (_bfd_elf_write_section_eh_frame_entry): Declare.
1915         (_bfd_elf_eh_frame_entry_present): Declare.
1916         (_bfd_elf_section_for_symbol): Declare.
1917         * elf-eh-frame.c (bfd_elf_discard_eh_frame_entry): New function.
1918         (bfd_elf_record_eh_frame_entry): New function.
1919         (_bfd_elf_parse_eh_frame_entry): New function.
1920         (_bfd_elf_parse_eh_frame): Update hdr_info field references.
1921         (cmp_eh_frame_hdr): New function.
1922         (add_eh_frame_hdr_terminator): New function.
1923         (_bfd_elf_end_eh_frame_parsing): New function.
1924         (find_merged_cie): Update hdr_info field references.
1925         (_bfd_elf_discard_section_eh_frame): Likewise.
1926         (_bfd_elf_discard_section_eh_frame_hdr): Add Compact EH support.
1927         (_bfd_elf_eh_frame_entry_present): New function.
1928         (_bfd_elf_maybe_strip_eh_frame_hdr): Add Compact EH support.
1929         (_bfd_elf_write_section_eh_frame_entry): New function.
1930         (_bfd_elf_write_section_eh_frame): Update hdr_info field references.
1931         (_bfd_elf_fixup_eh_frame_hdr): New function.
1932         (write_compact_eh_frame_hdr): New function.
1933         (write_dwarf_eh_frame_hdr): New function.
1934         (_bfd_elf_write_section_eh_frame_hdr): Add Compact EH support.
1935         * elflink.c (_bfd_elf_section_for_symbol): New function.
1936         (elf_section_ignore_discarded_relocs): Add Compact EH support.
1937         (elf_link_input_bfd): Likewise.
1938         (bfd_elf_final_link): Likewise.
1939         (_bfd_elf_gc_mark): Likewise.
1940         (bfd_elf_parse_eh_frame_entries): New function.
1941         (bfd_elf_gc_sections): Add Compact EH support.
1942         (bfd_elf_discard_info): Likewise.
1943         * elfxx-mips.c: Include dwarf2.h.
1944         (_bfd_mips_elf_compact_eh_encoding): New function.
1945         (_bfd_mips_elf_cant_unwind_opcode): New function.
1946         * elfxx-mips.h (_bfd_mips_elf_compact_eh_encoding): Declare.
1947         (_bfd_mips_elf_cant_unwind_opcode): Declare.
1948         (elf_backend_compact_eh_encoding): Define.
1949         (elf_backend_cant_unwind_opcode): Define.
1950         * elfxx-target.h (elf_backend_compact_eh_encoding): Provide default.
1951         (elf_backend_cant_unwind_opcode): Provide default.
1952         (elf_backend_data elfNN_bed): Add elf_backend_compact_eh_encoding and
1953         elf_backend_cant_unwind_opcode.
1954         * section.c (SEC_INFO_TYPE_EH_FRAME_ENTRY): Add definition.
1955
1956 2015-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1957
1958         PR binutils/18458
1959         * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
1960         for now binding only if pointer equality isn't needed.
1961         (elf_i386_allocate_dynrelocs): Use .plt.got section for now
1962         binding only if pointer equality isn't needed.
1963         * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
1964         section for now binding only if pointer equality isn't needed.
1965         (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
1966         binding only if pointer equality isn't needed.
1967
1968 2015-05-26  H.J. Lu  <hongjiu.lu@intel.com>
1969
1970         PR binutils/18437
1971         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip extra relocations
1972         in .rel.plt/.rela.plt.
1973         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
1974
1975 2015-05-19  Jiong Wang  <jiong.wang@arm.com>
1976
1977         * elfnn-aarch64.c (aarch64_tls_transition_without_check): Sort
1978         relocation case labels alphabetically.
1979         (elfNN_aarch64_final_link_relocate): Ditto.
1980         (elfNN_aarch64_tls_relax): Ditto.
1981         (elfNN_aarch64_relocate_section): Ditto.
1982         (elfNN_aarch64_gc_sweep_hook): Ditto.
1983         (elfNN_aarch64_check_relocs): Ditto.
1984         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Ditto.
1985         (_bfd_aarch64_elf_resolve_relocation): Ditto.
1986
1987 2015-05-18  Jiong Wang  <jiong.wang@arm.com>
1988
1989         * elfnn-aarch64.c (elfNN_aarch64_adjust_dynamic_symbol): Rewrite
1990         comments.
1991
1992 2015-05-16  H.J. Lu  <hongjiu.lu@intel.com>
1993
1994         * elf32-i386.c (elf_i386_check_relocs): Create .plt.got section
1995         for now binding.
1996         (elf_i386_allocate_dynrelocs): Use .plt.got section for now
1997         binding.
1998         * elf64-x86-64.c (elf_x86_64_check_relocs): Create .plt.got
1999         section for now binding.
2000         (elf_x86_64_allocate_dynrelocs): Use .plt.got section for now
2001         binding.
2002
2003 2015-05-14  H.J. Lu  <hongjiu.lu@intel.com>
2004
2005         * bfd.c (bfd_update_compression_header): Also write the zlib
2006         header if the SHF_COMPRESSED bit cleared..
2007         (bfd_check_compression_header): Return the uncompressed size.
2008         * compress.c (decompress_contents): Don't skip the zlib header.
2009         (bfd_compress_section_contents): Properly handle ELFCOMPRESS_ZLIB,
2010         which doesn't have the zlib header.
2011         (bfd_init_section_decompress_status): Likewise.
2012         (bfd_get_full_section_contents): Updated.
2013         (bfd_is_section_compressed): Likewise.
2014         (bfd_is_section_compressed_with_header): Return the uncompressed
2015         size.
2016         * elf.c (_bfd_elf_make_section_from_shdr): Updated.
2017         * bfd-in2.h: Regenerated.
2018
2019 2015-05-14  Jiong Wang  <jiong.wang@arm.com>
2020
2021         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Remove overflow
2022         check restrictions.
2023
2024 2015-05-14  Max Filippov  <jcmvbkbc@gmail.com>
2025
2026         * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Treat PLT reference
2027         as GOT reference when plt.refcount is not positive.
2028
2029 2015-05-12  H.J. Lu  <hongjiu.lu@intel.com>
2030
2031         * elf32-i386.c (elf_i386_allocate_dynrelocs): Allocate space
2032         for the first .plt entry only if needed.
2033         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
2034
2035 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
2036
2037         * Makefile.am (ALL_MACHINES): Add cpu-iamcu.lo.
2038         (ALL_MACHINES_CFILES): Likewise.
2039         * archures.c (bfd_mach_iamcu): New.
2040         (bfd_mach_i386_iamcu): Likewise.
2041         (bfd_mach_i386_iamcu_intel_syntax): Likewise.
2042         (bfd_iamcu_arch): Likewise.
2043         (bfd_archures_list): Add &bfd_iamcu_arch.
2044         * config.bfd (targ_selvecs): Add iamcu_elf32_vec to
2045         i386_elf32_vec.
2046         (targ_archs): Add bfd_iamcu_arch if needed.
2047         * configure.ac: Support iamcu_elf32_vec.
2048         * cpu-iamcu.c: New file.
2049         * elf32-i386.c (elf32_iamcu_elf_object_p): New function.
2050         Add support for iamcu_elf32_vec and elf32_iamcu_bed.
2051         * targets.c (iamcu_elf32_vec): New.
2052         (_bfd_target_vector): Add iamcu_elf32_vec.
2053         * Makefile.in: Regenerated.
2054         * bfd-in2.h: Likewise.
2055         * configure: Likewise.
2056
2057 2015-05-11  H.J. Lu  <hongjiu.lu@intel.com>
2058
2059         * elfcode.h (elf_object_p): Replace EM_486 with EM_IAMCU.
2060
2061 2015-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2062
2063         * elf32-i386.c (elf_i386_convert_mov_to_lea): Replace input_bfd
2064         and output_bfd with abfd.
2065         * elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Likewise.
2066
2067 2015-05-06  Toni Spets  <toni.spets@iki.fi>
2068
2069         PR ld/18372
2070         * peXXigen.c (rsrc_process_section): Skip discarded resource
2071         sections.
2072
2073 2015-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2074
2075         * config.bfd: Support i[3-7]86-*-elf*.
2076
2077 2015-04-30  H.J. Lu  <hongjiu.lu@intel.com>
2078
2079         * elf32-i386.c (elf_backend_post_process_headers): Undef for
2080         Solaris 2.
2081
2082 2015-04-30  Nick Clifton  <nickc@redhat.com>
2083
2084         PR 18317
2085         * elf32-mep.c (MEPREL): Use bfd_elf_generic_reloc instead of
2086         mep_reloc.
2087         (mep_reloc): Delete unused function.
2088
2089 2015-04-29  Nick Clifton  <nickc@redhat.com>
2090
2091         PR 17099
2092         * coff-i386.c (coff_i386_rtype_to_howto): Allow absolute PCRLONG
2093         relocs.
2094
2095 2015-04-27  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
2096
2097         * elf-s390-common.c (elf_s390_merge_obj_attributes): New function.
2098         * elf32-s390.c (elf32_s390_merge_private_bfd_data): Call
2099         elf_s390_merge_obj_attributes.
2100         * elf64-s390.c (elf64_s390_merge_private_bfd_data): New function.
2101
2102 2015-04-24  Jiong Wang  <jiong.wang@arm.com>
2103
2104         PR ld/18270
2105         * elfnn-aarch64.c (elfNN_aarch64_size_dynamic): Count local symbol for
2106         GOT_NORMAL for both sgot/srelgot section.
2107         (elfNN_aarch64_final_link_relocate): Relocate against GOT entry address
2108         and generate necessary runtime relocation for GOT entry.
2109
2110 2015-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2111
2112         PR binutils/18209
2113         * archive.c (_bfd_get_elt_at_filepos): Copy is_linker_input.
2114
2115 2015-04-24  Jiong Wang  <jiong.wang@arm.com>
2116
2117         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Reject
2118         PC-relative relocation for external symbol.
2119
2120 2015-04-24  Nick Clifton  <nickc@redhat.com>
2121
2122         PR 18313
2123         * compress.c (decompress_contents): Zero initialse the z_stream
2124         structure.
2125
2126 2015-04-24  Nick Clifton  <nickc@redhat.com>
2127
2128         * elf.c (_bfd_elf_is_local_label_name): Extend test for assembler
2129         local labels to include local labels with a numeric suffix and
2130         fake symbols.
2131
2132 2015-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2133
2134         PR binutils/18316
2135         * section.c (SEC_MEP_VLIW): New.
2136         * bfd-in2.h: Regenerated.
2137
2138 2015-04-23  H.J. Lu  <hongjiu.lu@intel.com>
2139
2140         PR ld/18277
2141         * compress.c (bfd_compress_section_contents): Remove the
2142         write_compress argument.
2143         (bfd_init_section_compress_status): Updated.
2144         (bfd_compress_section): Likewise.
2145         * elf.c (_bfd_elf_set_reloc_sh_name): New.
2146         (_bfd_elf_init_reloc_shdr): Add delay_st_name_p.  Set sh_name
2147         to (unsigned int) -1 if delay_st_name_p is TRUE.  Use
2148         _bfd_elf_set_reloc_sh_name.
2149         (elf_fake_sections): Don't rename DWARF debug section for
2150         linker output if it will be compressed.  Instead, set
2151         delay_st_name_p to TRUE and pass it to _bfd_elf_init_reloc_shdr.
2152         (assign_section_numbers): Call _bfd_elf_strtab_addref only if
2153         sh_name != (unsigned int) -1.  Don't finalize nor assign
2154         shstrtab section here.  Delay setting output section names to
2155         _bfd_elf_write_object_contents.
2156         (_bfd_elf_compute_section_file_positions): Update comments on
2157         sh_offset for shstrtab section.
2158         (assign_file_positions_for_non_load_sections): Set sh_offset to
2159         -1 for shstrtab section.
2160         (assign_file_positions_except_relocs): Likewise.
2161         (_bfd_elf_assign_file_positions_for_non_load): Set up sh_name
2162         when compressing DWARF debug sections.  Place shstrtab section
2163         after DWARF debug sections have been compressed.
2164         (_bfd_elf_write_object_contents): Setting sh_name for output
2165         sections.
2166
2167 2015-04-23  H.J. Lu  <hongjiu.lu@intel.com>
2168
2169         PR binutils/18209
2170         * bfd.c (bfd): Add is_linker_input.
2171         * elf.c (convert_debug_to_zdebug): New.
2172         (convert_zdebug_to_debug): Likewise.
2173         (_bfd_elf_make_section_from_shdr): Don't convert .debug_* to
2174         .zdebug_* here.  Use convert_zdebug_to_debug.  Set SEC_ELF_RENAME.
2175         (_bfd_elf_init_reloc_shdr): Pass a pointer to section name
2176         instead of a pointer to section.
2177         (elf_fake_sections): Rename the section name if SEC_ELF_RENAME
2178         is set.
2179         * section.c (SEC_ELF_RENAME): New.
2180         * bfd-in2.h: Regenerated.
2181
2182 2015-04-23  Alan Modra  <amodra@gmail.com>
2183
2184         * elf64-ppc.c (TOC_BASE_ALIGN): Define.
2185         (ppc64_elf_next_toc_section): Align multi-got toc base.
2186         (ppc64_elf_set_toc): Likewise initial toc base and .TOC. symbol.
2187
2188 2015-04-22  H.J. Lu  <hongjiu.lu@intel.com>
2189
2190         PR ld/18289
2191         * elf32-i386.c (elf_i386_link_hash_entry): Add gotoff_ref.
2192         (elf_i386_link_hash_newfunc): Initialize gotoff_ref to 0.
2193         (elf_i386_create_dynamic_sections): Always allow copy relocs for
2194         building executables.
2195         (elf_i386_copy_indirect_symbol): Also copy gotoff_ref.
2196         (elf_i386_check_relocs): Set gotoff_ref for R_386_GOTOFF.
2197         (elf_i386_adjust_dynamic_symbol): Also allocate copy relocs for
2198         PIE and R_386_GOTOFF.
2199         (elf_i386_relocate_section): Allow R_386_GOTOFF in executable.
2200
2201 2015-04-20  H.J. Lu  <hongjiu.lu@intel.com>
2202
2203         * elf.c (assign_section_numbers): Always set up sh_name.
2204
2205 2015-04-20  H.J. Lu  <hongjiu.lu@intel.com>
2206
2207         * elf.c (assign_file_positions_for_non_load_sections): Iterate
2208         sections by pointer.
2209         (_bfd_elf_assign_file_positions_for_non_load): Likewise.
2210
2211 2015-04-14  H.J. Lu  <hongjiu.lu@intel.com>
2212
2213         * bfd-in.h (compressed_debug_section_type): New.
2214         * compress.c (bfd_compress_section_contents): Add an argument
2215         for linker write compression and always generate .zdebug_*
2216         section when linking.
2217         (bfd_init_section_compress_status): Pass FALSE to
2218         bfd_compress_section_contents.
2219         (bfd_compress_section): New function.
2220         * elf.c (elf_fake_sections): For linking, set SEC_ELF_COMPRESS
2221         on DWARF debug sections if COMPRESS_DEBUG is set and rename
2222         section if COMPRESS_DEBUG_GABI_ZLIB isn't set.
2223         (assign_file_positions_for_non_load_sections): Set sh_offset
2224         to -1 if SEC_ELF_COMPRESS is set.
2225         (assign_file_positions_except_relocs): Likwise.
2226         (_bfd_elf_assign_file_positions_for_relocs): Renamed to ...
2227         (_bfd_elf_assign_file_positions_for_non_load): This.  Change
2228         return time to bfd_boolean.  Compress the section if
2229         SEC_ELF_COMPRESS is set.
2230         (_bfd_elf_write_object_contents): Updated.
2231         (_bfd_elf_set_section_contents): Write section contents to
2232         the buffer if SEC_ELF_COMPRESS is set.
2233         * merge.c: Include "elf-bfd.h".
2234         (sec_merge_emit): Add arguments for contents and offset.  Write
2235         to contents with offset if contents isn't NULL.
2236         (_bfd_write_merged_section): Write section contents to the
2237         buffer if SEC_ELF_COMPRESS is set.  Pass contents and
2238         output_offset to sec_merge_emit.
2239         * elflink.c (bfd_elf_final_link): Allocate the buffer for
2240         output section contents if SEC_ELF_COMPRESS is set.
2241         * section.c (SEC_ELF_COMPRESS): New.
2242         * bfd-in2.h: Regenerated.
2243
2244 2015-04-15  Alan Modra  <amodra@gmail.com>
2245
2246         * elf32-rl78.c (rl78_elf_relocate_section): Typo fix.
2247
2248 2015-04-14  Nick Clifton  <nickc@redhat.com>
2249
2250         * elf32-rl78.c (RL78_OP_REL): New macro.
2251         (rl78_elf_howto_table): Use it for complex relocs.
2252         (get_symbol_value): Handle the cases when the info or status
2253         arguments are NULL.
2254         (get_romstart): Cache the status returned by get_symbol_value.
2255         (get_ramstart): Likewise.
2256         (RL78_STACK_PUSH): Generate an error message if the stack
2257         overflows.
2258         (RL78_STACK_POP): Likewise for underflows.
2259         (rl78_compute_complex_reloc): New function.  Contains the basic
2260         processing code for all RL78 complex relocs.
2261         (rl78_special_reloc): New function.  Provides special reloc
2262         handling for complex relocs.
2263         (rl78_elf_relocate_section): Use rl78_compute_complex_reloc.
2264         (rl78_offset_for_reloc): Likewise.
2265
2266 2015-04-14  H.J. Lu  <hongjiu.lu@intel.com>
2267
2268         PR ld/pr17709
2269         * elflink.c (_bfd_elf_adjust_dynamic_copy): Check
2270         info->extern_protected_data when warning copy relocs against
2271         protected symbols.
2272         (_bfd_elf_symbol_refs_local_p): Check info->extern_protected_data
2273         when checking protected non-function symbols.
2274
2275 2015-04-13  John Baldwin  <jhb@FreeBSD.org>
2276
2277         * elf.c (elfcore_grok_note): Recognize NT_X86_XSTATE on
2278         FreeBSD.
2279         (elfcore_write_xstatereg): Use correct note name on FreeBSD.
2280
2281 2015-04-13  H.J. Lu  <hongjiu.lu@intel.com>
2282
2283         PR ld/18250
2284         * elflink.c (elf_link_is_defined_archive_symbol): Return FALSE
2285         if the object has been claimed by plugin.
2286
2287 2015-04-11  H.J. Lu  <hongjiu.lu@intel.com>
2288
2289         * elf32-i386.c (elf_i386_relocate_section): Replace SYMBOLIC_BIND
2290         with SYMBOL_REFERENCES_LOCAL when checking R_386_GOTOFF against
2291         protected data symbol when building shared library.
2292         * elf64-x86-64.c (elf_x86_64_relocate_section): Check
2293         R_X86_64_GOTOFF64 against undefined symbol and replace
2294         SYMBOLIC_BIND with SYMBOL_REFERENCES_LOCAL when checking
2295         R_X86_64_GOTOFF64 against protected data symbol when building
2296         shared library.
2297
2298 2015-04-10  H.J. Lu  <hongjiu.lu@intel.com>
2299
2300         PR ld/pr17709
2301         * elf32-i386.c (elf_i386_relocate_section): Also check R_386_GOTOFF
2302         against protected data symbol when building shared library.
2303         * elf64-x86-64.c (elf_x86_64_relocate_section): Also check
2304         R_X86_64_GOTOFF64 against protected data symbol when building
2305         shared library.
2306
2307 2015-04-10  H.J. Lu  <hongjiu.lu@intel.com>
2308
2309         PR ld/pr15228
2310         PR ld/pr17709
2311         * elf-bfd.h (elf_backend_data): Add extern_protected_data.
2312         * elf32-i386.c (elf_backend_extern_protected_data): New.
2313         Defined to 1.
2314         * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
2315         * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on
2316         copy relocs against protected symbols if extern_protected_data
2317         is true.
2318         (_bfd_elf_symbol_refs_local_p): Don't return true on protected
2319         non-function symbols if extern_protected_data is true.
2320         * elfxx-target.h (elf_backend_extern_protected_data): New.
2321         Default to 0.
2322         (elfNN_bed): Initialize extern_protected_data with
2323         elf_backend_extern_protected_data.
2324
2325 2015-04-10  H.J. Lu  <hongjiu.lu@intel.com>
2326
2327         * compress.c (bfd_compress_section_contents): Replace bfd_malloc
2328         and free with bfd_alloc and bfd_release on compressed buffer.
2329         Release buffer if compressed section isn't smaller.
2330
2331 2015-04-10  Alan Modra  <amodra@gmail.com>
2332
2333         PR ld/18222
2334         * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't report an error
2335         on adding a protected visibility variable to .dynbss.
2336
2337 2015-04-10  Alan Modra  <amodra@gmail.com>
2338
2339         Revert 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
2340         PR ld/pr15228
2341         PR ld/pr17709
2342         * elf-bfd.h (elf_backend_data): Delete extern_protected_data.
2343         * elf32-i386.c (elf_backend_extern_protected_data): Delete.
2344         * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
2345         * elflink.c (_bfd_elf_adjust_dynamic_copy): Remove
2346         extern_protected_data test.
2347         (_bfd_elf_symbol_refs_local_p): Likewise.
2348         * elfxx-target.h (elf_backend_extern_protected_data): Delete.
2349         (elfNN_bed): Delete elf_backend_extern_protected_data init.
2350
2351 2015-04-09  H.J. Lu  <hongjiu.lu@intel.com>
2352
2353         * compress.c (bfd_compress_section_contents): Update comments.
2354         (bfd_init_section_decompress_status): Likewise.
2355         (bfd_init_section_compress_status): Likewise.
2356
2357 2015-04-09  H.J. Lu  <hongjiu.lu@intel.com>
2358
2359         * elfxx-target.h (TARGET_BIG_SYM): Add BFD_COMPRESS_GABI to
2360         object_flags.
2361         (TARGET_LITTLE_SYM): Likewise.
2362
2363 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2364
2365         * elf32-xtensa.c (splay-tree.h): include header.
2366         (text_action_struct): drop next pointer.
2367         (text_action_list_struct): drop head pointer, add count and
2368         tree fields.
2369         (find_fill_action): instead of linear search in text_action_list
2370         search in the tree.
2371         (text_action_compare, action_first, action_next): new functions.
2372         (text_action_add, text_action_add_literal): instead of linear
2373         search and insertion insert new node into the tree.
2374         (removed_by_actions): pass additional parameter: action_list,
2375         use it to traverse the tree.
2376         (offset_with_removed_text): pass additional action_list parameter
2377         to removed_by_actions.
2378         (map_action_fn_context): new typedef.
2379         (map_action_fn_context_struct): new structure.
2380         (map_action_fn): new function.
2381         (map_removal_by_action): use splay_tree_foreach to build map.
2382         (find_insn_action): replace linear search in text_action_list
2383         with series of splay_tree_lookups.
2384         (print_action, print_action_list_fn): new functions.
2385         (print_action_list): use splay_tree_foreach.
2386         (init_xtensa_relax_info): drop action_list.head initialization.
2387         Initialize the tree.
2388         (compute_text_actions): use non-zero action_list_count instead of
2389         non-NULL action list.
2390         (xlate_map_context): new typedef.
2391         (xlate_map_context_struct): new structure.
2392         (xlate_map_fn): new function.
2393         (build_xlate_map): use splay_tree_foreach to build map.
2394         (action_remove_bytes_fn): new function.
2395         (relax_section): use zero action_list_count instead of NULL
2396         action list. Use splay_tree_foreach to count final section size.
2397         Drop unused variable 'removed'.
2398
2399 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2400
2401         * elf32-xtensa.c (removed_literal_map_entry): new typedef.
2402         (removed_literal_map_entry_struct): new structure.
2403         (removed_literal_list_struct): add new fields: n_map and map.
2404         (map_removed_literal, removed_literal_compare): new functions.
2405         (find_removed_literal): build index array for literals ordered
2406         by VMA, use binary search to find removed literal.
2407
2408 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2409
2410         * elf32-xtensa.c (removal_by_action_entry_struct,
2411         removal_by_action_map_struct): new structures.
2412         (removal_by_action_entry, removal_by_action_map): new typedefs.
2413         (text_action_list_struct): add new field: map.
2414         (map_removal_by_action, removed_by_actions_map,
2415         offset_with_removed_text_map): new functions.
2416         (relax_section): replace offset_with_removed_text with
2417         offset_with_removed_text_map.
2418         (translate_reloc, relax_property_section, relax_section_symbols):
2419         replace removed_by_actions with removed_by_actions_map.
2420
2421 2015-04-09  Max Filippov  <jcmvbkbc@gmail.com>
2422
2423         * elf32-xtensa.c (reloc_range_list, reloc_range_list_entry,
2424         reloc_range): new typedef.
2425         (reloc_range_list_struct, reloc_range_list_entry_struct,
2426         reloc_range_struct): new structures.
2427         (reloc_range_compare, build_reloc_ranges,
2428         reloc_range_list_append, reloc_range_list_remove,
2429         reloc_range_list_update_range, free_reloc_range_list): new
2430         functions.
2431         (compute_text_actions): precompute relocation opcodes before the
2432         loop. Add relevant_relocs variable, initialize it before the
2433         loop, pass it to the check_section_ebb_pcrels_fit.
2434         (check_section_ebb_pcrels_fit): add new parameter:
2435         relevant_relocs. Update address range in the relevant_relocs if
2436         it's non-NULL and iterate only over relevant relocations.
2437
2438 2015-04-09  Nick Clifton  <nickc@redhat.com>
2439
2440         * elf32-rx.c (describe_flags): Report the settings of the string
2441         insn using bits.
2442         (rx_elf_merge_private_bfd_data): Handle merging of the string insn
2443         using bits.
2444
2445 2015-04-08  H.J. Lu  <hongjiu.lu@intel.com>
2446
2447         * compress.c (bfd_compress_section_contents): Work around a GCC
2448         uninitialized warning bug fixed in GCC 4.7.
2449
2450 2015-04-08  H.J. Lu  <hongjiu.lu@intel.com>
2451
2452         * archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI
2453         bit.
2454         * bfd.c (bfd::flags): Increase size to 18 bits.
2455         (BFD_COMPRESS_GABI): New.
2456         (BFD_FLAGS_SAVED): Add BFD_COMPRESS_GABI.
2457         (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
2458         (bfd_update_compression_header): New fuction.
2459         (bfd_check_compression_header): Likewise.
2460         (bfd_get_compression_header_size): Likewise.
2461         (bfd_is_section_compressed_with_header): Likewise.
2462         * compress.c (MAX_COMPRESSION_HEADER_SIZE): New.
2463         (bfd_compress_section_contents): Return the uncompressed size if
2464         the full section contents is compressed successfully.  Support
2465         converting from/to .zdebug* sections.
2466         (bfd_get_full_section_contents): Call
2467         bfd_get_compression_header_size to get compression header size.
2468         (bfd_is_section_compressed): Renamed to ...
2469         (bfd_is_section_compressed_with_header): This.  Add a pointer
2470         argument to return compression header size.
2471         (bfd_is_section_compressed): Use it.
2472         (bfd_init_section_decompress_status): Call
2473         bfd_get_compression_header_size to get compression header size.
2474         Return FALSE if uncompressed section size is 0.
2475         * elf.c (_bfd_elf_make_section_from_shdr): Support converting
2476         from/to .zdebug* sections.
2477         * bfd-in2.h: Regenerated.
2478
2479 2015-04-07  Alan Modra  <amodra@gmail.com>
2480
2481         * elf.c (_bfd_elf_get_reloc_section): Allow for .got.plt being
2482         mapped to output .got section.
2483
2484 2015-04-07  Alan Modra  <amodra@gmail.com>
2485
2486         * elf32-ppc.c (struct ppc_elf_link_hash_entry): Add has_addr16_ha
2487         and has_addr16_lo.  Make has_sda_refs a bitfield.
2488         (ppc_elf_check_relocs): Set new flags.
2489         (ppc_elf_link_hash_table_create): Update default_params.
2490         (ppc_elf_adjust_dynamic_symbol): Clear protected_def in cases
2491         where we won't be making .dynbss entries or editing code.  Set
2492         params->pic_fixup when we'll edit code for protected var access.
2493         (allocate_dynrelocs): Allocate got entry for edited code and
2494         discard dyn_relocs.
2495         (struct ppc_elf_relax_info): Add picfixup_size.
2496         (ppc_elf_relax_section): Rename struct one_fixup to struct
2497         one_branch_fixup.  Rename fixups to branch_fixups.  Size space for
2498         pic fixups.
2499         (ppc_elf_relocate_section): Edit non-PIC accessing protected
2500         visibility variables to PIC.  Don't emit dyn_relocs for code
2501         we've edited.
2502         * elf32-ppc.h (struct ppc_elf_params): Add pic_fixup.
2503
2504 2015-04-07  Nick Clifton  <nickc@redhat.com>
2505
2506         * elf.c (_bfd_elf_is_local_label_name): Treat assembler generated
2507         local labels as local.
2508
2509 2015-04-06  H.J. Lu  <hongjiu.lu@intel.com>
2510
2511         * compress.c (get_uncompressed_size): Removed.
2512         (bfd_compress_section_contents): Use bfd_putb64 to write
2513         uncompressed section size.
2514         (bfd_init_section_decompress_status): Replace
2515         get_uncompressed_size with bfd_getb64.
2516
2517 2015-04-04  H.J. Lu  <hongjiu.lu@intel.com>
2518
2519         * elf.c (_bfd_elf_init_private_section_data): Also preserve the
2520         SHF_COMPRESSED bit if not decompress.
2521
2522 2015-04-04  H.J. Lu  <hongjiu.lu@intel.com>
2523
2524         * compress.c (get_uncompressed_size): New.  Extracted from ...
2525         (bfd_init_section_decompress_status): This.  Use it.
2526
2527 2015-04-02  Andrew Turner  <andrew@freebsd.org>
2528
2529         * config.bfd: Add aarch64-*-freebsd* target triple.
2530
2531 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
2532
2533         * configure: Regenerated.
2534
2535 2015-04-01  Tejas Belagod  <tejas.belagod@arm.com>
2536             Marcus Shawcroft  <marcus.shawcroft@arm.com>
2537             Jiong Wang  <jiong.wang@arm.com>
2538
2539         * bfd-in.h (bfd_elf64_aarch64_set_options)
2540         (bfd_elf32_aarch64_set_options): Add parameter.
2541         * bfd-in2.h: Regenerated.
2542         * elfnn-aarch64.c (aarch64_erratum_843419_stub)
2543         (_bfd_aarch64_adrp_p, _bfd_aarch64_erratum_843419_sequence_p)
2544         (_bfd_aarch64_erratum_843419_stub_name)
2545         (_bfd_aarch64_erratum_843419_fixup)
2546         (_bfd_aarch64_erratum_843419_scan)
2547         (_bfd_aarch64_erratum_843419_branch_to_stub)
2548         (_bfd_aarch64_erratum_843419_p): Define.
2549         (enum elf_aarch64_stub_type): Define
2550         aarch64_stub_erratum_843419_veneer.
2551         (struct elf_aarch64_stub_hash_entry): Define adrp_offset.
2552         (struct elf_aarch64_link_hash_table): Define fix_erratum_843419
2553         and fix_erratum_843419_adr.
2554         (stub_hash_newfunc): Initialize adrp_offset;
2555         (_bfd_aarch64_add_stub_entry_after): Define.
2556         (aarch64_map_one_stub, aarch64_build_one_stub)
2557         (aarch64_size_one_stub): Handle
2558         aarch64_stub_erratum_843419_veneer.
2559         (_bfd_aarch64_resize_stubs): Round stub section size.
2560         (elfNN_aarch64_size_stubs): Add scan for 843419.
2561         (bfd_elfNN_aarch64_set_options): Add parameter. Initialize
2562         fix_erratum_843419 and fix_erratum_843419_adr.
2563         (struct erratum_835769_branch_to_stub_data): Add info.
2564         (elfNN_aarch64_write_section): Initialise info.  Handle 843419.
2565         (elfNN_aarch64_size_dynamic_sections): Handle 843419.
2566         * elfxx-aarch64.c (_bfd_aarch64_decode_adrp_imm)
2567         (_bfd_aarch64_sign_extend): Define.
2568         (reencode_adr_imm): Remove static. Rename to:
2569         (_bfd_aarch64_reencode_adr_imm): Define.
2570         (_bfd_aarch64_elf_put_addend): Call _bfd_aarch64_reencode_adr_imm.
2571         * elfxx-aarch64.h (AARCH64_ADR_OP, AARCH64_ADRP_OP)
2572         (AARCH64_ADRP_OP_MASK, _bfd_aarch64_sign_extend)
2573         (_bfd_aarch64_decode_adrp_imm, _bfd_aarch64_reencode_adr_imm):
2574         Define.
2575
2576 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
2577
2578         * configure: Regenerated.
2579
2580 2015-03-31  Ed Schouten  <ed@nuxi.nl>
2581
2582         * config.bfd (targ_defvec): Set to x86_64_elf64_cloudabi_vec
2583         for x86_64-*-cloudabi*.
2584         * configure.ac: Handle x86_64_elf64_cloudabi_vec.
2585         * configure: Regenerated.
2586         * elf64-x86-64.c (TARGET_LITTLE_SYM): Support x86_64-*-cloudabi*.
2587         (TARGET_LITTLE_NAME): Likewise.
2588         (ELF_OSABI): Likewise.
2589         (elf64_bed): Likewise.
2590         * targets.c (x86_64_elf64_cloudabi_vec): New.
2591         (_bfd_target_vector): Add x86_64_elf64_cloudabi_vec.
2592
2593 2015-03-31  H.J. Lu  <hongjiu.lu@intel.com>
2594
2595         * configure.ac: Revert the AM_ZLIB change.
2596         * Makefile.in: Regenerated.
2597         * aclocal.m4: Likewise.
2598         * configure: Likewise.
2599         * doc/Makefile.in: Likewise.
2600
2601 2015-03-30  H.J. Lu  <hongjiu.lu@intel.com>
2602
2603         PR ld/18169
2604         * elf-bfd.h (elf_backend_data): Add get_reloc_section.
2605         (_bfd_elf_get_reloc_section): New.
2606         * elf.c (_bfd_elf_get_reloc_section): Likewise.
2607         (assign_section_numbers): Call get_reloc_section to look up the
2608         section the relocs apply.
2609         * elfxx-target.h (elf_backend_get_reloc_section): Likewise.
2610         (elfNN_bed): Initialize get_reloc_section with
2611         elf_backend_get_reloc_section.
2612
2613 2015-03-29  H.J. Lu  <hongjiu.lu@intel.com>
2614
2615         * Makefile.am (ZLIB): New.
2616         (ZLIBINC): Likewise.
2617         (AM_CFLAGS): Add $(ZLIBINC).
2618         (libbfd_la_LIBADD): Add $(ZLIB).
2619         * compress.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
2620         (decompress_contents): Don't check HAVE_ZLIB_H.
2621         (bfd_compress_section_contents): Likewise.
2622         (bfd_get_full_section_contents): Likewise.
2623         (bfd_init_section_decompress_status): Likewise.
2624         (bfd_init_section_compress_status): Likewise.
2625         * configure.ac (AM_ZLIB): Removed.
2626         (zlibdir): New.  AC_SUBST.
2627         (zlibinc): Likewise.
2628         Add --with-system-zlib.
2629         * Makefile.in: Regenerated.
2630         * acinclude.m4: Likewise.
2631         * config.in: Likewise.
2632         * configure: Likewise.
2633         * doc/Makefile.in: Likewise.
2634
2635 2015-03-27  Alan Modra  <amodra@gmail.com>
2636
2637         PR ld/15228
2638         PR ld/18167
2639         * elflink.c (elf_merge_st_other): Add "sec" parameter.  Don't set
2640         protected_def when symbol section is read-only.  Adjust all calls.
2641         * elf-bfd.h (struct elf_link_hash_entry): Update protected_def comment.
2642
2643 2015-03-26  Tejas Belagod  <tejas.belagod@arm.com>
2644
2645         * elfnn-aarch64.c (aarch64_build_one_stub): Replace the call to generic
2646         _bfd_final_link_relocate with aarch64_relocate.
2647
2648 2015-03-26  H.J. Lu  <hongjiu.lu@intel.com>
2649
2650         PR ld/18160
2651         * elflink.c (elf_gc_sweep): Skip if relocation is incompatible.
2652         (bfd_elf_gc_sections): Likewise.
2653
2654 2015-03-25  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2655
2656         * elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Adjust stub section
2657         size for initial branch.
2658         (elfNN_aarch64_build_stubs): Write initial branch.
2659         _bfd_aarch64_decode_(elfNN_aarch64_output_arch_local_syms): Write
2660         mapping symbol on initial branch.
2661
2662 2015-03-25  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2663
2664         * elfnn-aarch64.c (_bfd_aarch64_erratum_835769_scan):
2665         Update erratum count.
2666
2667 2015-03-25  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
2668
2669         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't break on
2670         first matching debug section.
2671
2672 2015-03-24  H.J. Lu  <hongjiu.lu@intel.com>
2673
2674         PR gas/18087
2675         * compress.c (bfd_compress_section_contents): Don't write the
2676         zlib header and set contents as well as compress_status if
2677         compression didn't make the section smaller.
2678         (bfd_init_section_compress_status): Don't check compression
2679         size here.
2680
2681 2015-03-24  Nick Clifton  <nickc@redhat.com>
2682
2683         PR binutils/17512
2684         * coffgen.c (coff_get_normalized_symtab): Fix test for out of
2685         range auxillary sections.
2686
2687 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2688
2689         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Factor
2690         code into:
2691         (_bfd_aarch64_get_stub_for_link_section): Define.
2692
2693 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2694
2695         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Adjust
2696         update of section_group[].stub_sec.
2697
2698 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2699
2700         * elfnn-aarch64.c (struct aarch64_erratum_835769_fix) Remove.
2701         (erratum_835769_scan) Drop fix_table_size_p and fixes_p arguments.
2702         Delete fixes, fix_table_size and associated code.  Call
2703         _bfd_aarch64_add_stub_entry_in_group. Rename to...
2704         (bfd_aarch64_erratum_835769_scan): Define.
2705         (elfNN_aarch64_size_stubs): Delete erratum_835769_fixes,
2706         erratum_835769_fix_table_size, i and associated code.  Relocate
2707         call to _bfd_aarch64_erratum_835769_scan.  Delete adhoc stub size
2708         correction.  Delete construction of stub entry from
2709         erratum_835769_fixes array.
2710
2711 2015-03-24  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2712
2713         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Use
2714         _bfd_aarch64_add_stub_entry_in_group.
2715
2716 2015-03-24  Alan Modra  <amodra@gmail.com>
2717
2718         * elf64-ppc.c (ppc64_elf_relocate_section): Report overflow to
2719         stubs, even those for undefined weak symbols.  Otherwise, don't
2720         report relocation overflow on branches to undefined strong
2721         symbols.  Fix memory leak.
2722         * elf32-ppc.c (ppc_elf_relocate_section): Don't report relocation
2723         overflow on branches to undefined strong symbols.
2724
2725 2015-03-23  Keith Seitz  <keiths@redhat.com>
2726
2727         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Add
2728         missing ';'.
2729
2730 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2731
2732         * elfnn-aarch64.c (erratum_835769_scan): Factor stub name
2733         construction into...
2734         (_bfd_aarch64_erratum_835769_stub_name): Define.
2735
2736 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2737
2738         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Factor out
2739         stub resize code into...
2740         (bfd_aarch64_resize_stubs): Define.
2741
2742 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2743
2744         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Factor stub
2745         creation code into...
2746         (bfd_aarch64_create_stub_section): Define.
2747
2748 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2749
2750         * elfnn-aarch64.c (_bfd_aarch64_create_or_find_stub_sec): Rename
2751         from elf_aarch64_create_or_find_stub_sec.
2752         (_bfd_aarch64_add_stub_entry_in_group): Rename from
2753         elfNN_aarch64_add_stub.  Call
2754         _bfd_aarch64_create_or_find_stub_sec.
2755         (elfNN_aarch64_size_stubs, elfNN_aarch64_size_stubs): Call
2756         _bfd_aarch64_add_stub_entry_in_group.
2757
2758 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2759
2760         * elfnn-aarch64.c (erratum_835769_scan) Add comment.  Reverse
2761         sense of boolean return.
2762         (elfNN_aarch64_size_stubs): Adjust for above.
2763
2764 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2765
2766         * elfnn-aarch64.c (elf_aarch64_create_or_find_stub_sec):
2767         Remove unused parameter.
2768         (elfNN_aarch64_size_stubs): Adjust for above.
2769
2770 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2771
2772         * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Remove bfd_indx.
2773
2774 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2775
2776         * elfnn-aarch64.c (aarch64_erratum_835769_fixes)
2777         (num_aarch64_erratum_835769_fixes): Remove.
2778         (elfNN_aarch64_size_stubs): Remove assignments to above.
2779
2780 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2781
2782         * elfnn-aarch64.c (aarch64_mem_op_p): Update comment. Rename rtn
2783         to rt2.
2784         (aarch64_erratum_seqeunce): Rename rtn to rt2.
2785
2786 2015-03-23  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2787
2788         * elfnn-aarch64.c (elfNN_aarch64_write_section): Adjust layout.
2789
2790 2015-03-19  Nick Clifton  <nickc@redhat.com>
2791
2792         * elf32-rl78.c (rl78_cpu_name): New function.  Prints the name of
2793         the RL78 core based upon the flags.
2794         (rl78_elf_merge_private_bfd_data): Handle merging of G13 and G14
2795         flags.
2796         (rl78_elf_print_private_bfd_data): Use rl78_cpu_name.
2797         (elf32_rl78_machine): Always return bfd_mach_rl78.
2798
2799 2015-03-19  Nick Clifton  <nickc@redhat.com>
2800
2801         PR 18078
2802         * compress.c (bfd_compress_section_contents): Do not define this
2803         function if it is not used.
2804
2805 2015-03-18  H.J. Lu  <hongjiu.lu@intel.com>
2806
2807         * compress.c (bfd_compress_section_contents): Make it static.
2808         * bfd/bfd-in2.h: Regenerated.
2809
2810 2015-03-18  Eric Youngdale  <eyoungdale@ptc.com>
2811
2812         PR ld/16598
2813         * peicode.h (pe_ILF_build_a_bfd): Add support for creating relocs
2814         suitable for the AMD64.
2815
2816 2015-03-18  Jon Turney  <jon.turney@dronecode.org.uk>
2817             Nick Clifton  <nickc@redhat.com>
2818
2819         PR binutils/18087
2820         * coffgen.c (make_a_section_from_file): Only prepend a z to a
2821         debug section's name if the section was actually compressed.
2822         * elf.c (_bfd_elf_make_section_from_shdr): Likewise.
2823         * compress.c (bfd_init_section_compress_status): Do not compress
2824         the section if doing so would make it bigger.  In such cases leave
2825         the section alone and return COMPRESS_SECTION_NONE.
2826
2827 2015-03-17  Alan Modra  <amodra@gmail.com>
2828
2829         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Return count of 0
2830         on nothing to do, before malloc of returned symbol array.
2831
2832 2015-03-16  Nick Clifton  <nickc@redhat.com>
2833
2834         * elf32-rx.c (elf32_rx_relax_delete_bytes): If the relocs are not
2835         stored in the elf_section_data structure then load them as
2836         necessary.
2837
2838 2015-03-14  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
2839
2840         * elf-s390-common.c (elf_s390_elf_sort_relocs_p): Don't sort
2841         relocs against code sections.
2842         * elf32-s390.c: Define elf_backend_sort_relocs_p.
2843         * elf64-s390.c: Likewise.
2844
2845 2015-03-11  Alan Modra  <amodra@gmail.com>
2846
2847         * elf32-ppc.c (ppc_elf_get_synthetic_symtab): Examine stubs in
2848         reverse order.  Account for larger size of __tls_get_addr_opt stub.
2849
2850 2015-03-10  Yuri Gribov  <y.gribov@samsung.arm>
2851
2852         PR ld/16572
2853         * elf32-arm.c (elf32_arm_final_link_relocate): Remove support for
2854         ELF_ARM_HASENTRY.
2855         (elf32_arm_print_private_bfd_data): Likewise.
2856
2857 2015-03-06  Nick Clifton  <nickc@redhat.com>
2858
2859         PR binutils/17765
2860         * elflink.c (put_value): Like previous delta, but for the 32-bit
2861         case.
2862
2863 2015-03-05  Nick Clifton  <nickc@redhat.com>
2864
2865         PR binutils/17765
2866         * elflink.c (put_value): Avoid using an undefined shift
2867         operation.
2868
2869 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
2870
2871         PR ld/pr15228
2872         PR ld/pr17709
2873         * elf-bfd.h (elf_backend_data): Add extern_protected_data.
2874         * elf32-i386.c (elf_backend_extern_protected_data): New.
2875         Defined to 1.
2876         * elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
2877         * elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on
2878         copy relocs against protected symbols if extern_protected_data
2879         is true.
2880         (_bfd_elf_symbol_refs_local_p): Don't return true on protected
2881         non-function symbols if extern_protected_data is true.
2882         * elfxx-target.h (elf_backend_extern_protected_data): New.
2883         Default to 0.
2884         (elfNN_bed): Initialize extern_protected_data with
2885         elf_backend_extern_protected_data.
2886
2887 2015-03-05  Nick Clifton  <nickc@redhat.com>
2888
2889         PR binutils/18025
2890         * coffgen.c (coff_find_nearest_line_with_names): If the dwarf2
2891         lookup fails, check for an address bias in the dwarf info, and if
2892         one exists, retry the lookup with the biased value.
2893         * dwarf2.c (_bfd_dwarf2_find_symbol_bias): New function.
2894         Determines if a bias exists bewteen the addresses of functions
2895         based on DWARF information vs symbol table information.
2896         * libbfd-in.h (_bfd_dwarf2_find_symbol_bias): Prototype.
2897         * libbfd.h: Regenerate.
2898
2899 2015-03-04  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2900
2901         * elfxx-aarch64.c (decode_add_imm, decode_movw_imm)
2902         (decode_tst_branch_ofs_14, decode_ld_lit_ofs_19)
2903         (decode_cond_branch_ofs_19, decode_branch_ofs_26): Remove.
2904
2905 2015-03-04  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2906
2907         * elfnn-aarch64.c (aarch64_build_one_stub): Call abort.
2908         (aarch64_size_one_stub): Likewise.
2909         (aarch64_map_one_stub): Likewise.
2910
2911 2015-03-04  Andreas Arnez  <arnez@linux.vnet.ibm.com>
2912
2913         * cpu-s390.c (N): New macro.
2914         (bfd_s390_31_arch): New.  Define only if default target word size
2915         is 64 bits.  Otherwise define...
2916         (bfd_390_64_arch): ...this.  Make static.
2917         (bfd_s390_arch): Define according to the default target word size.
2918         Let the 'next' field point to the alternate arch.
2919
2920 2015-03-04  Richard Sandiford  <richard.sandiford@arm.com>
2921
2922         PR gas/17843
2923         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Expect
2924         R_AARCH64_TLSLE_MOVW_TPREL_G0_NC and R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
2925         to be used with MOVK rather than MOVZ.
2926
2927 2015-03-03  DJ Delorie  <dj@redhat.com>
2928
2929         * elf32-rl78.c (rl78_elf_relax_section): Only relax ADDR16's if
2930         there's a symbol.
2931
2932 2015-02-28  Alan Modra  <amodra@gmail.com>
2933
2934         * elf32-ppc.c (ppc_elf_tls_setup): Set no_tls_get_addr_opt if
2935         not PLT_NEW.
2936
2937 2015-02-27  H.J. Lu  <hongjiu.lu@intel.com>
2938
2939         * elf32-i386.c (need_convert_mov_to_lea): New.
2940         (elf_i386_check_relocs): Set need_convert_mov_to_lea if needed.
2941         (elf_i386_convert_mov_to_lea): Return TRUE if
2942         need_convert_mov_to_lea is unset.
2943         * elf64-x86-64.c (need_convert_mov_to_lea): New.
2944         (elf_x86_64_check_relocs): Set need_convert_mov_to_lea if needed.
2945         (elf_x86_64_convert_mov_to_lea): Return TRUE if
2946         need_convert_mov_to_lea is unset.
2947
2948 2015-02-27  Nick Clifton  <nickc@redhat.com>
2949
2950         PR binutils/17910
2951         * coffgen.c (_bfd_coff_internal_syment_name): Only check for
2952         string length overflow when the string table length is actually
2953         set.
2954
2955 2015-02-27  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2956
2957         * bfd/bfd-in2.h: Regenerate.
2958         * bfd/libbfd.h: Regenerate.
2959
2960 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2961
2962         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Fix
2963         TLSDESC_LD_PREL19 field width and masks.
2964         (aarch64_tls_transition_without_check)
2965         (aarch64_reloc_got_type, elfNN_aarch64_final_link_relocate)
2966         (elfNN_aarch64_tls_relax, elfNN_aarch64_relocate_section)
2967         (elfNN_aarch64_gc_sweep_hook, elfNN_aarch64_check_relocs): Handle
2968         BFD_RELOC_AARCH64_TLSDESC_LD_PREL19.
2969         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
2970         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2971
2972 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2973
2974         * elfnn-aarch64.c (IS_AARCH64_TLSDESC_RELOC): Reorder R_TYPE
2975         tests.
2976         (aarch64_tls_transition_without_check)
2977         (aarch64_reloc_got_type, elfNN_aarch64_final_link_relocate)
2978         (elfNN_aarch64_tls_relax, elfNN_aarch64_relocate_section)
2979         (elfNN_aarch64_gc_sweep_hook, elfNN_aarch64_check_relocs): Handle
2980         BFD_RELOC_AARCH64_TLSDESC_ADR_PREL21.
2981         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
2982         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2983         * reloc.c (BFD_RELOC_AARCH64_TLSGD_ADR_PREL21): Define.
2984
2985 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2986
2987         * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC)
2988         (elfNN_aarch64_howto_table, aarch64_tls_transition_without_check)
2989         (aarch64_reloc_got_type, elfNN_aarch64_final_link_relocate)
2990         (elfNN_aarch64_tls_relax, elfNN_aarch64_relocate_section)
2991         (elfNN_aarch64_gc_sweep_hook, elfNN_aarch64_check_relocs): Handle
2992         BFD_RELOC_AARCH64_TLSGD_ADR_PREL21.
2993         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
2994         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2995         * reloc.c (BFD_RELOC_AARCH64_TLSGD_ADR_PREL21): Define.
2996
2997 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
2998
2999         * elfnn-aarch64.c: (TLSIE_LD_GOTTREL_PREL19): Fix HOWTO bit field width.
3000         (aarch64_tls_transition_without_check, aarch64_reloc_got_type)
3001         (elfNN_aarch64_final_link_relocate, elfNN_aarch64_tls_relax)
3002         (elfNN_aarch64_relocate_section, elfNN_aarch64_gc_sweep_hook)
3003         (elfNN_aarch64_check_relocs): Handle
3004         BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19.
3005
3006         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend)
3007         (_bfd_aarch64_elf_resolve_relocation): Likewise.
3008
3009 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
3010
3011         * elfnn-aarch64.c: (TLSDESC_CALL): Fix HOWTO bit field width.
3012
3013 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
3014
3015         * elfnn-aarch64.c (TLSLE_MOVW_TPREL_G2)
3016         (TLSLE_MOVW_TPREL_G1, TLSLE_MOVW_TPREL_G1_NC)
3017         (TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC): Fix bit field
3018         width.
3019
3020 2015-02-26  Marcus Shawcroft  <marcus.shawcroft@arm.com>
3021
3022         * elfnn-aarch64.c: (TLSIE_MOVW_GOTTPREL_G0_NC): Fix HOWTO bit
3023         field width.
3024
3025 2015-02-26  Nick Clifton  <nickc@redhat.com>
3026
3027         PR binutils/17512
3028         * coffcode.h (coff_compute_section_file_positions): Report
3029         negative page sizes.
3030         * elf.c (elf_fake_sections): Handle excessive alignmment powers.
3031         (assign_file_positions_for_non_load_sections): Replace assertion
3032         with an error message.
3033         (rewrite_elf_program_header): Handle excessive segment
3034         alignments.
3035         * mach-o.c (bfd_mach_o_read_section_32): Likewise.
3036         (bfd_mach_o_read_section_64): Likewise.
3037         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Use %B to
3038         print a bfd name, not %A.
3039
3040 2015-02-26  Alan Modra  <amodra@gmail.com>
3041
3042         * elf64-ppc.c (plt_stub_size, build_plt_stub): Don't build
3043         thread-safe stubs for iplt.
3044         (build_tls_get_addr_stub): Restore r2 immediately after call.
3045
3046 2015-02-26  Terry Guo  <terry.guo@arm.com>
3047
3048         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Update how we
3049         merge Tag_ABI_HardFP_use.
3050
3051 2015-02-26  Alan Modra  <amodra@gmail.com>
3052
3053         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc.
3054         Use text relocs rather than giving an error on trying to use
3055         .dynbss for protected shared lib vars.
3056         * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
3057
3058 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
3059
3060         * elf32-avr.c (struct elf_avr_section_data): New structure.
3061         (struct avr_relax_info): New structure.
3062         (elf_avr_new_section_hook): New function.
3063         (struct elf_avr_section_data): Add relax_info.
3064         (get_avr_relax_info): New function.
3065         (init_avr_relax_info): New function.
3066         (elf32_avr_relax_delete_bytes): Find next property record before
3067         deleting bytes.  When deleting don't move bytes beyond the next
3068         property record.
3069         (avr_elf32_assign_records_to_section): New function.
3070         (avr_property_record_compare): New function.
3071         (avr_load_all_property_sections): New function.
3072         (elf32_avr_relax_section): Load property data.  After relaxing the
3073         section, move any .align directives that have enough deleted bytes
3074         before them.
3075         (bfd_elf32_new_section_hook): Define.
3076
3077 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
3078
3079         * elf32-avr.h (struct avr_property_header): New strucure.
3080         (avr_elf32_load_property_records): Declare.
3081         (avr_elf32_property_record_name): Declare.
3082         * elf32-avr.c: Add bfd_stdint.h include.
3083         (retrieve_local_syms): New function.
3084         (get_elf_r_symndx_section): New function.
3085         (get_elf_r_symndx_offset): New function.
3086         (internal_reloc_compare): New function.
3087         (struct avr_find_section_data): New structure.
3088         (avr_is_section_for_address): New function.
3089         (avr_find_section_for_address): New function.
3090         (avr_elf32_load_records_from_section): New function.
3091         (avr_elf32_load_property_records): New function.
3092         (avr_elf32_property_record_name): New function.
3093
3094 2015-02-25  Andrew Burgess  <andrew.burgess@embecosm.com>
3095
3096         * elf32-avr.h (AVR_PROPERTY_RECORD_SECTION_NAME): Define.
3097         (AVR_PROPERTY_RECORDS_VERSION): Define.
3098         (AVR_PROPERTY_SECTION_HEADER_SIZE): Define.
3099         (struct avr_property_record): New structure.
3100
3101 2015-02-24  Nick Clifton  <nickc@redhat.com>
3102
3103         * elf32-v850.c (v850_set_note): New function.  Creates a Renesas
3104         style note entry.
3105         (v850_elf_make_note_section): New function.  Creates a note
3106         section.
3107         (v850_elf_create_sections): New function.  Create a note section
3108         if one is not already present.
3109         (v850_elf_set_note): New function.  Adds a note to a bfd.
3110         (v850_elf_copy_private_bfd_data): New function.  Copies V850
3111         notes.
3112         (v850_elf_merge_notes): New function.  Merges V850 notes.
3113         (print_v850_note): New function.  Displays a V850 note.
3114         (v850_elf_print_notes): New function. Displays all notes attached
3115         to a bfd.
3116         (v850_elf_merge_private_bfd_data): Call v850_elf_merge_notes.
3117         (v850_elf_print_private_bfd_data): Call v850_elf_print_notes.
3118         (v850_elf_fake_sections): Set the type of the V850 note section.
3119         * bfd-in.h (v850_elf_create_sections): Add prototype.
3120         (v850_elf_set_note): Add prototype.
3121         * bfd-in2.h: Regenerate.
3122
3123 2015-02-24  Nick Clifton  <nickc@redhat.com>
3124
3125         * configure.ac (AC_CHECK_HEADERS): Add wctype.h.
3126         * configure: Regenerate.
3127         * config.in: Regenerate.
3128         * peXXigen.c: Include wctype.h if HAVE_WCTYPE_H is defined.
3129         (u16_mbtowc): Use wint_t types if HAVE_WCTYPE_H is defined.
3130         (rsrc_cmp): Use towlower instead of wcsncasecmp if HAVE_WCTYPE_H
3131         is defined.
3132
3133 2015-02-24  Nick Clifton  <nickc@redhat.com>
3134
3135         * pdp11.c (set_section_contents): Pad the .text and .data sections
3136         to their aligned sizes.
3137
3138 2015-02-23  Yoshinori Sato <ysato@users.sourceforge.jp>
3139
3140         * config.bfd: Add h8300-*-linux.
3141         * configure.ac: Add h8300_elf32_linux_vec.
3142         * configure: Regenerate.
3143         * elf32-h8300.c: Likewise.
3144         * targets.c(_bfd_target_vector): Likewise.
3145
3146 2015-02-23  Nick Clifton  <nickc@redhat.com>
3147
3148         PR 17914
3149         * cpu-w65.c: Correct typos in license notice.
3150
3151         PR 17940
3152         * elf32-msp430.c (msp430_elf_relax_delete_bytes): Adjust debug
3153         symbols at end of sections.  Adjust function sizes.
3154
3155 2015-02-20  Andreas Arnez  <arnez@linux.vnet.ibm.com>
3156
3157         * elf-bfd.h (elfcore_write_s390_vxrs_low): Add prototype.
3158         (elfcore_write_s390_vxrs_high): Likewise.
3159         * elf.c (elfcore_grok_s390_vxrs_low): New function.
3160         (elfcore_grok_s390_vxrs_high): New function.
3161         (elfcore_grok_note): Call them.
3162         (elfcore_write_s390_vxrs_low): New function.
3163         (elfcore_write_s390_vxrs_high): New function.
3164         (elfcore_write_register_note): Call them.
3165
3166 2015-02-19  Branko Drevensek  <branko.drevensek@gmail.com>
3167
3168         PR 17995
3169         * verilog.c (verilog_write_record): Correct buffer size.
3170
3171 2015-02-19  Alan Modra  <amodra@gmail.com>
3172
3173         * elflink.c (_bfd_elf_define_linkage_sym): Set 'bed' earlier.
3174
3175 2015-02-19  Alan Modra  <amodra@gmail.com>
3176
3177         PR ld/4317
3178         * elflink.c (elf_link_input_bfd): Drop undefined local syms.
3179         (elf_link_output_extsym): Drop local and global undefined syms.
3180         Tidy.  Expand comment.
3181
3182 2015-02-17  Alan Modra  <amodra@gmail.com>
3183
3184         PR ld/17975
3185         * elflink.c (struct elf_outext_info): Remove need_second_pass
3186         and second_pass.
3187         (elf_link_output_extsym): Delete code handling second forced
3188         local pass.  Move code emitting NULL STT_FILE symbol later, so
3189         that it can be omitted if forced local is stripped.  Don't
3190         emit the NULL STT_FILE if no file symbols have been output.
3191         (bfd_elf_final_link): Remove second forced local pass.
3192         * elf32-ppc.c (add_stub_sym): Set linker_def on linker syms.
3193         (ppc_elf_size_dynamic_sections): Likewise.
3194         * elf64-ppc.c (ppc_build_one_stub): Likewise.
3195         (build_global_entry_stubs): Likewise.
3196         (ppc64_elf_build_stubs): Likewise.
3197
3198 2015-02-16  H.J. Lu  <hongjiu.lu@intel.com>
3199
3200         PR ld/17975
3201         * elflink.c (elf_link_output_extsym): Only check filesym_count
3202         when outputting a NULL FILE symbol.  Set second_pass_sym to
3203         h->forced_local && !h->root.linker_def.
3204
3205 2015-02-15  H.J. Lu  <hongjiu.lu@intel.com>
3206
3207         * elf32-i386.c (elf_i386_always_size_sections): Set root.linker_def
3208         on _TLS_MODULE_BASE_.
3209         * elf64-x86-64.c (elf_x86_64_always_size_sections): Likewise.
3210
3211 2015-02-15  Alan Modra  <amodra@gmail.com>
3212
3213         * dwarf2.c (read_rangelist): Correct buffer overflow check
3214         Whitespace throughout file.
3215
3216 2015-02-14  Alan Modra  <amodra@gmail.com>
3217
3218         PR ld/17973
3219         * bfd.c (struct bfd): Add lto_output.
3220         * linker.c (_bfd_handle_already_linked): Explicitly test for
3221         objects added by the lto plugin.
3222         * opncls.c (_bfd_new_bfd_contained_in): Copy lto_output and
3223         no_export flags from archive.
3224         * archive.c (open_nested_file): New function, setting lto_output
3225         and no_export, extracted from..
3226         (find_nested_archive): ..here.  Flip params.  Rename from
3227         _bfd_find_nested_archive.
3228         (_bfd_get_elt_at_filepos): Correct var typo.  Use open_nested_file.
3229         (_bfd_look_for_bfd_in_cache): Copy no_export.
3230         * elflink.c (elf_link_add_object_symbols): Remove now unnecessary
3231         my_archive->no_export test.
3232         (elf_link_input_bfd): Drop existing lto_output STT_FILE syms.
3233         Don't use the file name when adding lto_output STT_FILE sym.
3234         * bfd-in2.h: Regenerate.
3235
3236 2015-02-13  Alan Modra  <amodra@gmail.com>
3237
3238         PR binutils/17512
3239         * elf64-ppc.c (opd_entry_value): Tighten offset check.  Remove
3240         now redundant assert.
3241
3242 2015-02-12  Nick Clifton  <nickc@redhat.com>
3243
3244         PR binutils/17512
3245         * dwarf.c (read_1_byte, read_1_signed_byte, read_2_bytes)
3246         (read_4_bytes, read_8_bytes, read_n_bytes, read_string)
3247         (read_indirect_string, read_alt_indirect_string)
3248         (read_alt_indirect_ref, read_address, read_abbrevs)
3249         (read_attribute_value, read_attribute, decode_line_info)
3250         (find_abstract_instance_name, read_rangelist)
3251         (scan_unit_for_symbols, parse_comp_unit)
3252         (_bfd_dwarf2_find_nearest_line): Harden DWARF reading code.  Pass
3253         end pointers to reading functions and check for offsets taking
3254         pointers out of range.  Replace calls to read_*_leb128 with calls
3255         to safe_read_leb128.
3256
3257         (* elf64-ppc.c (opd_entry_value): Add a check for an overlarge
3258         offset.
3259         * syms.c (_bfd_stab_section_find_nearest_line): Add checks for
3260         computed file_name address being before the start of the string
3261         table.
3262
3263 2015-02-11  H.J. Lu  <hongjiu.lu@intel.com>
3264
3265         PR ld/17878
3266         * bfd.c (bfd_plugin_format): New.
3267         (bfd): Add plugin_format and plugin_dummy_bfd.
3268         * plugin.c (try_load_plugin): Take a pointer to bfd_boolean
3269         argument to return TRUE if any plugin is found.  Set plugin_format.
3270         (has_plugin): New.
3271         (bfd_plugin_target_p): New.
3272         (bfd_plugin_specified_p): Likewise.
3273         (bfd_plugin_target_p): Likewise.
3274         (register_ld_plugin_object_p): Likewise.
3275         (bfd_plugin_set_plugin): Set has_plugin.
3276         (load_plugin): Cache try_load_plugin result.
3277         (bfd_plugin_object_p): Try ld_plugin_object_p first.  Check
3278         plugin_format.
3279         * plugin.h (bfd_plugin_target_p): New.
3280         (bfd_plugin_specified_p): Likewise.
3281         (register_ld_plugin_object_p): Likewise.
3282         * bfd-in2.h: Regenerated.
3283
3284 2015-02-11  Pedro Alves  <palves@redhat.com>
3285
3286         * libbfd-in.h [__cplusplus]: Open extern "C" scope.
3287         * libcoff-in.h [__cplusplus]: Open extern "C" scope.
3288         * libbfd.h: Regenerate.
3289         * libcoff.h: Regenerate.
3290
3291         * elf-bfd.h [__cplusplus]: Wrap in extern "C".
3292         * mach-o.h [__cplusplus]: Wrap in extern "C".
3293         * som.h [__cplusplus]: Wrap in extern "C".
3294
3295 2015-02-10  Nick Clifton  <nickc@redhat.com>
3296
3297         PR binutils/17512
3298         * coffcode.h (styp_to_sec_flags): Use an unsigned long type to
3299         hold the flag bits.
3300         * peXXigen.c (pe_print_reloc): Use unsigned types to hold the
3301         size and number of relocs.
3302         (pe_print_debugdata): Use a 32-bit aligned buffer to store the
3303         codeview record.
3304         * versados.c (process_otr): Check the esdid value before using it
3305         to access the EDATA.
3306
3307 2015-02-09  Ed Maste  <emaste@freebsd.org>
3308
3309         * elf32-i386.c (elf_i386_get_plt_sym_val): Avoid incrementing
3310         uninitialized and unused variable.
3311         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
3312
3313 2015-02-09  Alan Modra  <amodra@gmail.com>
3314
3315         * elf32-ppc.c (ppc_elf_relocate_section): Don't segfault on NULL
3316         tls_sec.
3317         * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
3318         * elflink.c (elf_link_output_extsym): Don't assert on NULL tls_sec.
3319
3320 2015-02-09  Alan Modra  <amodra@gmail.com>
3321
3322         * elflink.c: Whitespace, formatting fixes.
3323         (elf_link_input_bfd): Clarify comment.
3324         (elf_link_output_extsym): Exclude symbols in linker created
3325         sections when testing for plugin symbols.
3326
3327 2015-02-07  H.J. Lu  <hongjiu.lu@intel.com>
3328
3329         PR ld/17935
3330         * elf32-i386.c (elf_i386_readonly_dynrelocs): Also issue a
3331         warning for relocation in readonly section for -z text.
3332         (elf_i386_size_dynamic_sections): Likewise.
3333         * elf64-x86-64.c (elf_x86_64_readonly_dynrelocs): Likewise.
3334         (elf_x86_64_size_dynamic_sections): Likewise.
3335
3336 2015-02-06  H.J. Lu  <hongjiu.lu@intel.com>
3337
3338         PR ld/12365
3339         PR ld/14272
3340         * elflink.c (_bfd_elf_fix_symbol_flags): Revert the last change.
3341         (elf_link_input_bfd): Mark the plugin symbol undefined if it is
3342         referenced from a non-IR file.
3343
3344 2015-02-06  Nick Clifton  <nickc@redhat.com>
3345
3346         PR binutils/17512
3347         * peXXigen.c (rsrc_print_resource_entries): Add range check for
3348         addresses that wrap around the address space.
3349         (rsrc_parse_entry): Likewise.
3350
3351 2015-02-03  H.J. Lu  <hongjiu.lu@intel.com>
3352
3353         PR ld/12365
3354         PR ld/14272
3355         * elflink.c (_bfd_elf_fix_symbol_flags): Mark the plugin symbol
3356         undefined if it is referenced from a non-IR file.
3357
3358 2015-02-03  Nick Clifton  <nickc@redhat.com>
3359
3360         PR binutils/17512
3361         * ecoff.c: Use bfd_alloc2 to allocate space for structure arrays.
3362         (_bfd_ecoff_slurp_symbol_table): Check for a negative symbol
3363         index or an out of range fdr index.
3364         * elf-m10300.c (mn10300_info_to_howto): Fix typo in error message.
3365         * elf32-arc.c (arc_info_to_howto_rel): Likewise.
3366         * elf32-avr.c (avr_info_to_howto_rela): Likewise.
3367         * elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
3368         * elf32-cr16c.c (elf_cr16c_info_to_howto_rel): Likewise.
3369         * elf32-cris.c (cris_info_to_howto_rela): Likewise.
3370         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
3371         * elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
3372         * elf32-d30v.c (d30v_info_to_howto_rel): Likewise.
3373         * elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
3374         * elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
3375         * elf32-frv.c (frv_info_to_howto_rela): Likewise.
3376         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
3377         * elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
3378         * elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
3379         * elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
3380         * elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
3381         * elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
3382         * elf32-m32r.c (m32r_info_to_howto_rel): Likewise.
3383         * elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
3384         * elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
3385         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
3386         * elf32-mep.c (mep_info_to_howto_rela): Likewise.
3387         * elf32-metag.c (metag_info_to_howto_rela): Likewise.
3388         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
3389         * elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
3390         * elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
3391         * elf32-mt.c (mt_info_to_howto_rela): Likewise.
3392         * elf32-nds32.c (nds32_info_to_howto_rel): Likewise.
3393         * elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
3394         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
3395         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
3396         * elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
3397         * elf32-rx.c (rx_info_to_howto_rela): Likewise.
3398         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
3399         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
3400         * elf32-v850.c (v850_elf_perform_relocation): Likewise.
3401         * elf32-vax.c (rtype_to_howto): Likewise.
3402         * elf32-visium.c (visium_info_to_howto_rela): Likewise.
3403         * elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
3404         * elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
3405         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
3406         * elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
3407         * mach-o.c: Use bfd_alloc2 to allocate space for structure arrays.
3408         (bfd_mach_o_canonicalize_one_reloc): Fix check on out
3409         of range symbol indicies.
3410         (bfd_mach_o_canonicalize_relocs): Check for out of range alloc.
3411         (bfd_mach_o_canonicalize_dynamic_reloc): Likewise.
3412         (bfd_mach_o_build_dysymtab): Likewise.
3413         (bfd_mach_o_write_symtab_content): Set the string table size to
3414         zero upon error.
3415         (bfd_mach_o_read_symtab_symbols): Reset the nsyms value if the
3416         read fails.
3417         * peXXigen.c (pe_print_edata):  Check for numeric overflow in edt
3418         fields.
3419         * tekhex.c (first_phase): Check for src pointer reaching end of
3420         buffer.
3421
3422 2015-02-03  Will Newton  <will.newton@linaro.org>
3423
3424         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol):
3425         Set st_value to zero for undefined symbols if the reference
3426         is weak or pointer_equality_needed is FALSE.
3427
3428         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Improve
3429           comment discussing why we clear st_value for some symbols.
3430
3431 2015-02-02  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3432
3433         * elf32-nds32.c (nds32_get_section_contents): Add one more argument.
3434         (nds32_elf_relocate_section): Do not relocate R_NDS32_LONGJUMP7.
3435
3436 2015-01-29  Alan Modra  <amodra@gmail.com>
3437
3438         * elf64-ppc.c (ppc64_elf_relocate_section): Correct GOT_TLSLD
3439         optimization.  Tidy mask for GOT_TLSGD optimization.
3440         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.  Correct
3441         location of nop zapping high insn too.
3442
3443 2015-01-28  Alan Modra  <amodra@gmail.com>
3444
3445         * elf64-ppc.h (struct ppc64_elf_params): Add "object_in_toc".
3446         * elf64-ppc.c (ppc64_elf_add_symbol_hook): Assume that global symbols
3447         in .toc indicate xlc compiled code that might require a rw .toc.
3448
3449 2015-01-28  James Bowman  <james.bowman@ftdichip.com>
3450
3451         * Makefile.am: Add FT32 files.
3452         * archures.c (enum bfd_architecture): Add bfd_arch_ft32.
3453         (bfd_mach_ft32): Define.
3454         (bfd_ft32_arch): Declare.
3455         (bfd_archures_list): Add bfd_ft32_arch.
3456         * config.bfd: Handle FT32.
3457         * configure.ac: Likewise.
3458         * cpu-ft32.c: New file.
3459         * elf32-ft32.c: New file.
3460         * reloc.c (BFD_RELOC_FT32_10, BFD_RELOC_FT32_20, BFD_RELOC_FT32_17,
3461         BFD_RELOC_FT32_18): Define.
3462         * targets.c (_bfd_target_vector): Add ft32_elf32_vec.
3463         * bfd-in2.h: Regenerate.
3464         * libbfd.h: Regenerate.
3465         * Makefile.in: Regenerate.
3466         * configure: Regenerate.
3467         * po/SRC-POTFILES.in: Regenerate.
3468
3469 2015-01-27  Nick Clifton  <nickc@redhat.com>
3470
3471         PR binutils/17512
3472         * pdp11.c (aout_get_external_symbols): Return false if there are
3473         no symbols.
3474
3475         * dwarf2.c (concat_filename): Check for an empty directory table.
3476         (scan_unit_for_symbols): Check for reading off the end of the
3477         unit.
3478         (parse_comp_unit): Check for a DW_AT_comp_dir attribute with a
3479         non-string form.
3480         * elf64-ppc.c (opd_entry_value): Fail if there are no relocs
3481         available.
3482
3483 2015-01-26  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3484
3485         * elf32-nds32.c (nds32_elf_pick_relax): Fix again setting.
3486
3487 2015-01-22  DJ Delorie  <dj@redhat.com>
3488
3489         * elf32-m32c.c (m32c_apply_reloc_24): New.
3490         (m32c_elf_howto_table): Use it for R_M32C_24.
3491         (m32c_elf_relocate_section): Handle R_M32C_24 specially.
3492
3493 2015-01-22  Nick Clifton  <nickc@redhat.com>
3494
3495         PR binutils/17512
3496         * coffcode.h (handle_COMDAT): When searching for the section
3497         symbol, make sure that there is space left in the symbol table.
3498         * vms-alpha.c (_bfd_vms_slurp_ehdr): Add range checks.
3499
3500 2015-01-21  Nick Clifton  <nickc@redhat.com>
3501
3502         PR binutils/17512
3503         * coffcode.h (coff_set_arch_mach_hook): Check return value from
3504         bfd_malloc.
3505         (coff_slurp_line_table): Return FALSE if the line number
3506         information was corrupt.
3507         (coff_slurp_symbol_table): Return FALSE if the symbol information
3508         was corrupt.
3509         * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Always
3510         initialise the fields of the dyld_info structure.
3511         (bfd_mach_o_build_exec_seg_command): Replace assertion with an
3512         error message and a return value.
3513         (bfd_mach_o_layout_commands): Change the function to boolean.
3514         Return FALSE if the function fails.
3515         (bfd_mach_o_build_commands): Fail if bfd_mach_o_layout_commands
3516         fails.
3517         (bfd_mach_o_read_command): Fail if an unrecognised command is
3518         encountered.
3519         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Set bfd_error if the
3520         read fails.
3521         (slurp_symtab): Check the return from bfd_malloc.
3522         (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the copy
3523         encountered an error.
3524         (_bfd_XXi_final_link_postscript): Fail if a section could not be
3525         copied.
3526         * peicode.h (pe_bfd_object_p): Fail if the header could not be
3527         swapped in.
3528         * tekhex.c (first_phase): Fail if the section is too big.
3529         * versados.c (struct esdid): Add content_size field.
3530         (process_otr): Use and check the new field.
3531         (versados_get_section_contents): Check that the section exists and
3532         that the requested data is available.
3533
3534 2015-01-20  Chung-Lin Tang  <cltang@codesourcery.com>
3535
3536         * elf32-nios2.c (elf_backend_default_execstack): Define as 0.
3537
3538 2015-01-20  Alan Modra  <amodra@gmail.com>
3539
3540         PR ld/17615
3541         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Don't drop
3542         ELF_COMMON_DEF syms.
3543
3544 2015-01-19  Alan Modra  <amodra@gmail.com>
3545
3546         PR ld/17615
3547         * elf-bfd.h (ELF_COMMON_DEF_P): Note that this might be true for
3548         linker script assignments too.
3549         * elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
3550         (bfd_elf_gc_mark_dynamic_ref_symbol): Similarly.
3551
3552 2015-01-19  Alan Modra  <amodra@gmail.com>
3553
3554         * elf32-bfin.c (bfin_bfd_reloc_type_lookup): Correct loop iteration
3555         to allow return of first howto.
3556         * elf32-fr30.c (fr30_reloc_type_lookup): Likewise.
3557         * elf32-m32c.c (m32c_reloc_type_lookup): Likewise.
3558         * elf32-moxie.c (moxie_reloc_type_lookup): Likewise.
3559         * elf32-or1k.c (or1k_reloc_type_lookup): Likewise.
3560         * elf32-rl78.c (rl78_reloc_type_lookup): Likewise.
3561         * elf32-rx.c (rx_reloc_type_lookup): Likewise.
3562         * elf32-tilepro.c (tilepro_reloc_type_lookup): Likewise.
3563         * elf32-xstormy16.c (xstormy16_reloc_type_lookup): Likewise.
3564         * elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
3565         * elf32-nios2.c (nios2_reloc_map): Add mapping for R_NIOS2_NONE.
3566         * elf32-spu.c (spu_elf_bfd_to_reloc_type): Allow return of R_SPU_NONE.
3567         (spu_elf_reloc_type_lookup): Adjust to suit.
3568
3569 2015-01-19  Alan Modra  <amodra@gmail.com>
3570
3571         * bfd-in.h (bfd_get_section_limit_octets): New define, extracted from..
3572         (bfd_get_section_limit): ..here.
3573         * reloc.c (bfd_perform_relocation): Correct bfd_reloc_outofrange check.
3574         (bfd_install_relocation, _bfd_final_link_relocate): Add same check here.
3575         * elf32-sh.c (sh_elf_reloc): Correct bfd_reloc_outofrange check.
3576         * elf32-ppc.c (ppc_elf_addr16_ha_reloc): Remove duplicated
3577         bfd_reloc_outofrange check.
3578         * bfd-in2.h: Regenerate.
3579
3580         * cpu-ns32k.c (_bfd_do_ns32k_reloc_contents): Return bfd_reloc_ok
3581         on zero size relocs.
3582         * ecoff.c (ecoff_reloc_link_order): Likewise.
3583         * elf32-nds32.c (nds32_relocate_contents): Likewise.
3584         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
3585
3586         * reloc.c (_bfd_relocate_contents): Don't bomb on zero size relocs.
3587         (_bfd_clear_contents): Likewise.
3588         * elfxx-mips.c (mips_elf_obtain_contents): Likewise.
3589         (mips_elf_perform_relocation): Likewise.
3590
3591         * aoutx.h (aout_link_reloc_link_order): Allow for NULL return
3592         from malloc on zero size alloc.
3593         * cofflink.c (_bfd_coff_reloc_link_order): Likewise.
3594         * elflink.c (elf_reloc_link_order): Likewise.
3595         * linker.c (_bfd_generic_reloc_link_order): Likewise.
3596         * pdp11.c (aout_link_reloc_link_order): Likewise.
3597         * xcofflink.c (xcoff_reloc_link_order): Likewise.
3598
3599         * aoutx.h (howto_table_ext): Ensure NONE relocs have size 3,
3600         bitsize 0, and complain_overflow_dont.
3601         * coff-sparc.c (coff_sparc_howto_table): Likewise.
3602         * elf-hppa.h (elf_hppa_howto_table): Likewise.
3603         * elf-m10200.c (elf_mn10200_howto_table): Likewise.
3604         * elf-m10300.c (elf_mn10300_howto_table): Likewise.
3605         * elf32-arc.c (elf_arc_howto_table): Likewise.
3606         * elf32-arm.c (elf32_arm_howto_table_1): Likewise.
3607         * elf32-avr.c (elf_avr_howto_table): Likewise.
3608         * elf32-bfin.c (bfin_howto_table): Likewise.
3609         * elf32-cr16.c (cr16_elf_howto_table): Likewise.
3610         * elf32-cris.c (cris_elf_howto_table): Likewise.
3611         * elf32-crx.c (crx_elf_howto_table): Likewise.
3612         * elf32-d10v.c (elf_d10v_howto_table): Likewise.
3613         * elf32-d30v.c (elf_d30v_howto_table): Likewise.
3614         * elf32-dlx.c (dlx_elf_howto_table): Likewise.
3615         * elf32-epiphany.c (epiphany_elf_howto_table): Likewise.
3616         * elf32-fr30.c (fr30_elf_howto_table): Likewise.
3617         * elf32-frv.c (elf32_frv_howto_table): Likewise.
3618         * elf32-h8300.c (h8_elf_howto_table): Likewise.
3619         * elf32-i370.c (i370_elf_howto_raw): Likewise.
3620         * elf32-i386.c (elf_howto_table): Likewise.
3621         * elf32-i860.c (elf32_i860_howto_table): Likewise.
3622         * elf32-i960.c (elf32_i960_relocate): Likewise.
3623         * elf32-ip2k.c (ip2k_elf_howto_table): Likewise.
3624         * elf32-iq2000.c (iq2000_elf_howto_table): Likewise.
3625         * elf32-lm32.c (lm32_elf_howto_table): Likewise.
3626         * elf32-m32c.c (m32c_elf_howto_table): Likewise.
3627         * elf32-m32r.c (m32r_elf_howto_table): Likewise.
3628         * elf32-m68hc11.c (elf_m68hc11_howto_table): Likewise.
3629         * elf32-m68hc12.c (elf_m68hc11_howto_table): Likewise.
3630         * elf32-m68k.c (howto_table): Likewise.
3631         * elf32-mcore.c (mcore_elf_howto_raw): Likewise.
3632         * elf32-mep.c (mep_elf_howto_table): Likewise.
3633         * elf32-metag.c (elf_metag_howto_table): Likewise.
3634         * elf32-microblaze.c (microblaze_elf_howto_raw): Likewise.
3635         * elf32-mips.c (elf_mips_howto_table_rel): Likewise.
3636         * elf32-moxie.c (moxie_elf_howto_table): Likewise.
3637         * elf32-msp430.c (elf_msp430_howto_table): Likewise.
3638         * elf32-mt.c (mt_elf_howto_table): Likewise.
3639         * elf32-nds32.c (nds32_elf_howto_table): Likewise.
3640         * elf32-nios2.c (elf_nios2_howto_table_rel): Likewise.
3641         * elf32-or1k.c (or1k_elf_howto_table): Likewise.
3642         * elf32-pj.c (pj_elf_howto_table): Likewise.
3643         * elf32-ppc.c (ppc_elf_howto_raw): Likewise.
3644         * elf32-rl78.c (rl78_elf_howto_table): Likewise.
3645         * elf32-rx.c (rx_elf_howto_table): Likewise.
3646         * elf32-s390.c (elf_howto_table): Likewise.
3647         * elf32-score.c (elf32_score_howto_table): Likewise.
3648         * elf32-score7.c (elf32_score_howto_table): Likewise.
3649         * elf32-sh-relocs.h (R_SH_NONE): Likewise.
3650         * elf32-spu.c (elf_howto_table): Likewise.
3651         * elf32-tic6x.c (elf32_tic6x_howto_table): Likewise.
3652         * elf32-tilepro.c (tilepro_elf_howto_table): Likewise.
3653         * elf32-v850.c (v850_elf_howto_table): Likewise.
3654         * elf32-vax.c (howto_table): Likewise.
3655         * elf32-visium.c (visium_elf_howto_table): Likewise.
3656         * elf32-xc16x.c (xc16x_elf_howto_table): Likewise.
3657         * elf32-xgate.c (elf_xgate_howto_table): Likewise.
3658         * elf32-xstormy16.c (xstormy16_elf_howto_table): Likewise.
3659         * elf32-xtensa.c (elf_howto_table): Likewise.
3660         * elf64-alpha.c (elf64_alpha_howto_table): Likewise.
3661         * elf64-mips.c (mips_elf64_howto_table_rel): Likewise.
3662         * elf64-mmix.c (elf_mmix_howto_table): Likewise.
3663         * elf64-ppc.c (ppc64_elf_howto_raw): Likewise.
3664         * elf64-s390.c (elf_howto_table): Likewise.
3665         * elf64-sh64.c (sh_elf64_howto_table): Likewise.
3666         * elf64-x86-64.c (x86_64_elf_howto_table): Likewise.
3667         * elfn32-mips.c (elf_mips_howto_table_rel): Likewise.
3668         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Likewise.
3669         (elfNN_aarch64_howto_none): Likewise.
3670         * elfxx-ia64.c (ia64_howto_table): Likewise.
3671         * elfxx-sparc.c (_bfd_sparc_elf_howto_table): Likewise.
3672         * elfxx-tilegx.c (tilegx_elf_howto_table): Likewise.
3673         * nlm32-sparc.c (nlm32_sparc_howto_table): Likewise.
3674
3675 2015-01-15  H.J. Lu  <hongjiu.lu@intel.com>
3676
3677         PR ld/17847
3678         * elf64-x86-64.c (elf_x86_64_relocate_section): Don't complain
3679         about -fPIC if the symbol is undefined when building executable.
3680
3681 2015-01-15  Nick Clifton  <nickc@redhat.com>
3682
3683         PR binutils/17512
3684         * elf-m10300.c (mn10300_info_to_howto): Replace assertion with an
3685         error message.  Never return an invalid howto pointer.
3686         * elf32-cr16.c (cr16_info_to_howto): Likewise.
3687         * elf32-crx.c (elf_crx_info_to_howto): Likewise.
3688         * elf32-i370.c (i370_elf_info_to_howto): Likewise.
3689         * elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
3690         * elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
3691         * elf32-mips.c (mips_elf32_rtype_to_howto): Likewise.
3692         * elf32-pj.c (pj_elf_info_to_howto): Likewise.
3693         * elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
3694         * elf32-spu.c (spu_elf_info_to_howto): Likewise.
3695         * elf32-v850.c (v850_elf_info_to_howto_rela): Likewise.
3696         * elf32-vax.c (rtype_to_howto): Likewise.
3697         * elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
3698         * elf64-mips.c (mips_elf64_rtype_to_howto): Likewise.
3699         * elfn32-mips.c (sh_elf_info_to_howto): Likewise.
3700         * elf32-sh.c (sh_elf_info_to_howto): Likewise.
3701         (sh_elf_reloc): Check that the reloc is in range.
3702         * reloc.c (bfd_perform_relocation): Check that the section is big
3703         enough for the entire reloc.
3704         (bfd_generic_get_relocated_section_contents): Report unexpected
3705         return values from perform_reloc.
3706
3707 2015-01-15  Nick Clifton  <nickc@redhat.com>
3708
3709         * elf32-msp430.c (msp430_elf_relax_section): Skip unhandled
3710         relocs.  Include PC-relative adjustment for R_MSP430X_ABS16
3711         relaxation.
3712
3713 2015-01-15  Alan Modra  <amodra@gmail.com>
3714
3715         * elflink.c (_bfd_elf_link_omit_section_dynsym): Return true for
3716         any output section matching a linker created dynobj section.
3717
3718 2015-01-15  Alan Modra  <amodra@gmail.com>
3719
3720         PR 17842
3721         * elflink.c (elf_link_output_sym): Assert elf_onesymtab set.
3722         (bfd_elf_final_link): Always create a symbol table when emit_relocs.
3723         Don't assign symtab file position unless symbols will be output.
3724         Merge blocks with condition in common.  Don't call
3725         elf_backend_output_arch_local_syms or elf_backend_output_arch_syms
3726         unless other symbols are output.  Move assignment of symtab_shndx
3727         file position.  Localize variable.
3728
3729 2015-01-14  Jiong Wang  <jiong.wang@arm.com>
3730
3731         * elf32-arm.c (elf32_arm_final_link_relocate): Reject R_ARM_32/_NOI when
3732         trying to defer them to runtime.
3733
3734 2015-01-13  Thomas Preud'homme <thomas.preudhomme@arm.com>
3735
3736         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use SYMBOLIC_BIND
3737         to check if a symbol should be bound symbolically.
3738
3739 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
3740
3741         * elfnn-aarch64.c: (elfNN_aarch64_howto_table): Enable overflow check
3742         for TLSLE_MOVW_TPREL_G2.
3743
3744 2015-01-13  Jiong Wang  <jiong.wang@arm.com>
3745
3746         PR ld/17415
3747         * elfnn-aarch64.c (elfNN_aarch64_howto_table): Mark
3748         R_AARCH64_TLSLE_ADD_TPREL_HI12 as complain_overflow_unsigned.
3749         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Correct the
3750         bit mask.
3751
3752 2015-01-12  Terry Guo  <terry.guo@arm.com>
3753
3754         * elflink.c (_bfd_elf_gc_mark_debug_special_section_group): New
3755         function.
3756         (_bfd_elf_gc_mark_extra_sections): Use it.
3757
3758 2015-01-11  H.J. Lu  <hongjiu.lu@intel.com>
3759
3760         PR ld/17827
3761         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): For PIE,
3762         only discard space for pc-relative relocs symbols which turn
3763         out to need copy relocs.
3764
3765 2015-01-09  Nick Clifton  <nickc@redhat.com>
3766
3767         * tekhex.c (getvalue): Fix thinko in test for correct extraction
3768         of value.
3769         (getsym): Return false if there was not enough data to extract the
3770         symbol.
3771
3772 2015-01-09  Anthony Green  <green@moxielogic.com>
3773
3774         * elf32-moxie.c (ELF_MACHINE_ALT1): Define.
3775
3776 2015-01-08  Nick Clifton  <nickc@redhat.com>
3777
3778         * elf32-msp430.c (msp430_elf_relax_section): Add relaxation of
3779         16-bit absolute BR instructions to 10-bit pc-relative JMP
3780         instructions.
3781
3782 2015-01-08  Nick Clifton  <nickc@redhat.com>
3783
3784         PR binutils/17512
3785         * coffcode.h (coff_slurp_symbol_table): Return false if we failed
3786         to load the line table.
3787         * elf.c (_bfd_elf_map_sections_to_segments): Enforce a minimum
3788         maxpagesize of 1.
3789         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if
3790         the Data Directory Size is too large.
3791
3792 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
3793
3794         PR binutils/17512
3795         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocation.
3796         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
3797
3798 2015-01-06  Nick Clifton  <nickc@redhat.com>
3799
3800         PR binutils/17512
3801         * mach-o.c (bfd_mach_o_read_symtab_strtab): Zero terminate the
3802         string table.
3803
3804         * reloc.c (bfd_get_reloc_size): Handle a reloc size of -1.
3805         (bfd_perform_relocation): Include the size of the reloc in the
3806         test for an out of range relocation.
3807         (bfd_generic_get_relocated_section_contents): Remove reloc range
3808         test.
3809
3810         * coff-i860.c (CALC_ADDEND): Always set an addend value.
3811         * tekhex.c (getvalue): Add an end pointer parameter.  Use it to
3812         avoid reading off the end of the buffer.
3813         (getsym): Likewise.
3814         (first_phase): Likewise.
3815         (pass_over): Pass an end pointer to the invoked function.
3816
3817 2015-01-05  H.J. Lu  <hongjiu.lu@intel.com>
3818
3819         PR binutils/17512
3820         * elf32-i386.c (elf_i386_get_plt_sym_val): Return NULL on corrupt
3821         input.
3822         * elf64-x86-64.c (elf_x86_64_get_plt_sym_val): Likewise.
3823
3824 2015-01-05  Nick Clifton  <nickc@redhat.com>
3825
3826         PR binutils/17512
3827         * archive.c (do_slurp_bsd_armap): Make sure that the parsed sized
3828         is at least big enough for the header to be read.
3829         * elf32-i386.c (elf_i386_get_plt_sym_val): Skip unknown relocs.
3830         * mach-o.c (bfd_mach_o_get_synthetic_symtab): Add range checks.
3831         (bfd_mach_o_read_command): Prevetn duplicate error messages about
3832         unrecognized commands.
3833         * syms.c (_bfd_stab_section_find_nearest_line): Add range checks
3834         when indexing into the string table.
3835
3836 2015-01-01  Alan Modra  <amodra@gmail.com>
3837
3838         Update year range in copyright notice of all files.
3839
3840 For older changes see ChangeLog-2014
3841 \f
3842 Copyright (C) 2015 Free Software Foundation, Inc.
3843
3844 Copying and distribution of this file, with or without modification,
3845 are permitted in any medium without royalty provided the copyright
3846 notice and this notice are preserved.
3847
3848 Local Variables:
3849 mode: change-log
3850 left-margin: 8
3851 fill-column: 74
3852 version-control: never
3853 End: