__tls_get_addr_opt GOT entries
[external/binutils.git] / bfd / ChangeLog
1 2017-07-16  Alan Modra  <amodra@gmail.com>
2
3         * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
4         __tls_index GOT entries when using __tls_get_addr_opt stub.
5         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
6
7 2017-07-12  Alan Modra  <amodra@gmail.com>
8
9         * po/es.po: Update from translationproject.org/latest/bfd/.
10         * po/fi.po: Likewise.
11         * po/fr.po: Likewise.
12         * po/id.po: Likewise.
13         * po/ja.po: Likewise.
14         * po/ro.po: Likewise.
15         * po/ru.po: Likewise.
16         * po/sr.po: Likewise.
17         * po/sv.po: Likewise.
18         * po/tr.po: Likewise.
19         * po/uk.po: Likewise.
20         * po/vi.po: Likewise.
21         * po/zh_CN.po: Likewise.
22         * po/hr.po: New file from translationproject.org.
23         * configure.ac (ALL_LINGUAS): Add hr.  Sort.
24         * configure: Regenerate.
25
26 2017-07-12  Nick Clifton  <nickc@redhat.com>
27
28         Fix compile time warnings using gcc 7.1.1.
29         * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
30         plt_name buffer.
31         (elf_xtensa_get_gotplt_section): Increase length of got_name
32         buffer.
33         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
34         default return of FALSE.
35         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
36         default return of FALSE.
37
38 2017-07-12  Alan Modra  <amodra@gmail.com>
39
40         * binary.c (binary_set_section_contents): Don't print filepos in
41         error message.
42         (coff_write_object_contents): Cast size_t for error message.
43         (coff_slurp_line_table): Don't use bfd_vma symndx.
44         (coff_slurp_reloc_table): Remove unneeded cast.
45         * dwarf2.c (read_section): Cast bfd_int64_t to long long for
46         error message.
47         (find_abstract_instance_name): Likewise.
48         * elf32-arm.c (arm_type_of_stub): Correct error arg order.
49         (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
50         (elf32_arm_check_relocs): Make r_symndx an int.
51         * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
52         format string.
53         * elf32-metag.c (elf_metag_relocate_section): Delete extra error
54         message arg.
55         * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
56         error message.
57         * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
58         * elf32-s390.c (elf_s390_check_relocs): Likewise.
59         * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
60         * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
61         * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
62         * elf64-s390.c (elf_s390_check_relocs): Likewise.
63         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
64         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
65         * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
66         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
67         * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
68         * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
69         and use %lu for error message.
70         * elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
71         * mmo.c (mmo_scan): Make stab_loc a file_ptr.  Cast expression for
72         error message.
73
74         * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
75         in error message.
76         (elf32_arm_final_link_relocate): Likewise.
77         * coff-arm.c (bfd_arm_process_before_allocation): Likewise.
78         * coffcode.h (styp_to_sec_flags): Likewise.
79         * cofflink.c (_bfd_coff_write_global_sym): Likewise.
80         * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
81         * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
82         * elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
83         (elf32_bfin_merge_private_bfd_data): Likewise.
84         * elf32-cris.c (cris_elf_relocate_section): Likewise.
85         * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
86         * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
87         (i370_elf_relocate_section): Likewise.
88         * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
89         * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
90         * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
91         * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
92         * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
93         * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
94         * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
95         * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
96         (_bfd_mips_elf_merge_private_bfd_data): Likewise.
97         * ieee.c (ieee_write_id, read_id): Likewise.
98         * mach-o.c (bfd_mach_o_write_contents): Likewise.
99         (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
100         (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
101         (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
102         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
103         * stabs.c (_bfd_link_section_stabs): Likewise.
104
105         * coff-arm.c (coff_arm_relocate_section): Use L modifier in error
106         format.
107         * coff-mcore.c (coff_mcore_relocate_section): Likewise.
108         * coff-ppc.c (coff_ppc_relocate_section): Likewise.
109         * coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
110         * coff-sh.c (sh_relax_section): Likewise.
111         (sh_relax_delete_bytes, sh_swap_insns): Likewise.
112         * coff-tic80.c (coff_tic80_relocate_section): Likewise.
113         * coffcode.h (coff_slurp_reloc_table): Likewise.
114         * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
115         (_bfd_coff_read_string_table): Likewise.
116         * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
117         * compress.c (bfd_get_full_section_contents): Likewise.
118         * dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
119         * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
120         * elf.c (bfd_elf_string_from_elf_section): Likewise.
121         * elf32-arc.c (arc_special_overflow_checks): Likewise.
122         * elf32-arm.c (elf32_arm_tls_relax): Likewise.
123         (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
124         (elf32_arm_write_section): Likewise.
125         * elf32-bfin.c (bfin_relocate_section): Likewise.
126         (bfinfdpic_relocate_section): Likewise.
127         * elf32-hppa.c (hppa_build_one_stub): Likewise.
128         (final_link_relocate, elf32_hppa_relocate_section): Likewise.
129         * elf32-i386.c (elf_i386_tls_transition): Likewise.
130         (elf_i386_relocate_section): Likewise.
131         * elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
132         * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
133         * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
134         * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
135         * elf32-metag.c (elf_metag_relocate_section): Likewise.
136         * elf32-nds32.c (unrecognized_reloc_msg): Likewise.
137         (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
138         (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
139         (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
140         (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
141         (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
142         (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
143         (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
144         (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
145         * elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
146         * elf32-rx.c (UNSAFE_FOR_PID): Likewise.
147         * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
148         * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
149         * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
150         * elf32-sh.c (sh_elf_relax_section): Likewise.
151         (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
152         (sh_elf_relocate_section): Likewise.
153         * elf32-sh64.c (shmedia_prepare_reloc): Likewise.
154         * elf32-spu.c (spu_elf_relocate_section): Likewise.
155         * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
156         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
157         * elf32-v850.c (v850_elf_relax_section): Likewise.
158         * elf32-vax.c (elf_vax_check_relocs): Likewise.
159         (elf_vax_relocate_section): Likewise.
160         * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
161         (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
162         (compute_text_actions, compute_ebb_proposed_actions): Likewise.
163         (do_fix_for_relocatable_link): Likewise.
164         * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
165         (elf64_alpha_relax_with_lituse): Likewise.
166         * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
167         (elf_hppa_final_link_relocate): Likewise.
168         * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
169         (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
170         (elf64_vms_link_add_object_symbols): Likewise.
171         * elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
172         (mmix_final_link_relocate): Likewise.
173         * elf64-s390.c (invalid_tls_insn): Likewise.
174         (elf_s390_relocate_section): Likewise.
175         * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
176         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
177         (elf_x86_64_relocate_section): Likewise.
178         * elfcode.h (elf_slurp_symbol_table): Likewise.
179         * elfcore.h (elf_core_file_p): Likewise.
180         * elflink.c (elf_link_read_relocs_from_section): Likewise.
181         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
182         (elfNN_aarch64_relocate_section): Likewise.
183         * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
184         (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
185         * elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
186         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
187         (_bfd_mips_elf_relocate_section): Likewise.
188         (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
189         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
190         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
191         * ieee.c (ieee_slurp_external_symbols): Likewise.
192         * ihex.c (ihex_write_object_content): Likewise.
193         * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
194         * merge.c (_bfd_merged_section_offset): Likewise.
195         * mmo.c (mmo_write_loc_chunk): Likewise.
196         (mmo_write_object_contents): Likewise.
197         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
198         * stabs.c (_bfd_link_section_stabs): Likewise.
199         * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
200
201 2017-07-11  Alan Modra  <amodra@gmail.com>
202
203         * elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
204
205 2017-07-11  Alan Modra  <amodra@gmail.com>
206
207         * elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
208         instruction" error using _bfd_error_handler, not einfo.
209
210 2017-07-10  Nick Clifton  <nickc@redhat.com>
211
212         * coffcode.h (coff_slurp_symbol_table): Do not include an entry
213         for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
214
215 2017-07-07  John Baldwin  <jhb@FreeBSD.org>
216
217         * elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
218
219 2017-07-07  Alan Modra  <amodra@gmail.com>
220
221         * coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.
222
223 2017-07-07  Alan Modra  <amodra@gmail.com>
224
225         * bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
226         as long long.  Move code replacing "ll" with "I64", and simplify.
227
228 2017-07-06  H.J. Lu  <hongjiu.lu@intel.com>
229
230         * bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
231         to 1.
232
233 2017-07-05  H.J. Lu  <hongjiu.lu@intel.com>
234
235         * dwarf2.c (line_info_add_include_dir_stub): Replace time with
236         xtime.
237         (line_info_add_file_name): Likewise.
238         (decode_line_info): Likewise.
239
240 2017-07-04  Tristan Gingold  <gingold@adacore.com>
241
242         * version.m4: Bump version to 2.29.51
243         * configure: Regenerate.
244
245 2017-07-04  Jiong Wang  <jiong.wang@arm.com>
246
247         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
248         sanity check at the head of this function.
249
250 2017-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
251
252         * dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
253         dwarf_line_str_size.
254         (struct attr_abbrev): Add field implicit_const.
255         (dwarf_debug_sections): Add .debug_line_str.
256         (enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
257         (dwarf_debug_section_assert): Add static assertion.
258         (read_indirect_line_string): New.
259         (read_abbrevs): Support DW_FORM_implicit_const.
260         (is_str_attr): Support DW_FORM_line_strp.
261         (read_attribute_value): Support DW_FORM_line_strp and
262         DW_FORM_implicit_const.
263         (read_attribute): Support DW_FORM_implicit_const.
264         (line_info_add_include_dir, line_info_add_include_dir_stub):
265         (line_info_add_file_name, read_formatted_entries): New.
266         (decode_line_info, parse_comp_unit): Support DWARF 5.
267         (_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.
268
269 2017-07-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
270
271         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
272         abort statement that was put for symbols that are not dynamic.
273
274 2017-07-03  Tristan Gingold  <gingold@adacore.com>
275
276         * po/bfd.pot: Regenerate
277
278 2017-07-03  Alan Modra  <amodra@gmail.com>
279
280         * bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
281         __MSVCRT__.  Support "L" modifier for bfd_vma.  Formatting.
282         * elf.c (setup_group): Use "Lx" to print sh_size.
283         (_bfd_elf_setup_sections): Remove unnecessary cast and print
284         unknown section type in hex.
285         (copy_special_section_fields): Style fix.
286         (bfd_section_from_shdr): Correct format for sh_link.  Use a
287         common error message for all the variants of unrecognized
288         section types.
289         (assign_file_positions_for_load_sections): Use "Lx" for lma
290         adjust error message.
291         (assign_file_positions_for_non_load_sections): Formatting.
292         (rewrite_elf_program_header): Formatting.  Use "Lx" for
293         bfd_vma values in error messages.
294         * elfcode.h (elf_slurp_reloc_table_from_section): Cast
295         ELF_R_SYM value to type expected by format.
296         * elflink.c (elf_link_read_relocs_from_section): Use "Lx"
297         in error messages.
298         (elf_link_add_object_symbols): Use "Lu" for symbol sizes.
299         (elf_link_input_bfd): Use "Lx" for r_info.
300         (bfd_elf_gc_record_vtinherit): Use "Lx" for offset.
301
302 2017-07-03  Alan Modra  <amodra@gmail.com>
303
304         * bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
305         * coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
306         Microsoft C library variant of long long format specifier.
307         (PRINT20): Cast value to bfd_uint64_t not long long.
308         * coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
309         * coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
310         long long.  Don't cast to bfd_vma.
311         * elf32-score.c (score3_bfd_getl48): Likewise.
312         * vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.
313
314 2017-07-03  Alan Modra  <amodra@gmail.com>
315
316         * elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
317         print d_tag.
318         (bfd_elf_print_symbol): Don't cast symbol->flags.
319         (_bfd_elf_symbol_from_bfd_symbol): Likewise.
320         * elf32-ppc.c (ppc_elf_begin_write_processing): Correct
321         _bfd_error_handler argument order.
322         (ppc_elf_merge_private_bfd_data): Don't cast flags.
323
324 2017-07-03  Alan Modra  <amodra@gmail.com>
325
326         * configure.ac: Invoke AC_CHECK_TYPES for long long.  Invoke
327         AC_TYPE_LONG_DOUBLE.
328         * configure: Regenerate.
329         * config.in: Regenerate.
330
331 2017-06-29  Andrew Waterman  <andrew@sifive.com>
332
333         * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
334         relocs.
335
336 2017-06-29  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
337
338         * elfxx-sparc.c (allocate_dynrelocs): Don't make a symbol dynamic
339         unless it is undefined weak.
340         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Set the flag
341         relative_reloc to direct non-dynamic symbols to R_SPARC_RELATIVE
342         relocation.
343         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): If symbol
344         is not dynamic in PIC, abort.
345
346 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
347
348         PR ld/21402
349         * elfnn-aarch64.c (elfNN_aarch64_allocate_dynrelocs): Only make
350         undefined weak symbols into dynamic.
351         (elfNN_aarch64_final_link_relocate): Generate runtime RELATIVE
352         relocation for non-dynamic symbols.
353         (elfNN_aarch64_finish_dynamic_symbol): Add sanity check.
354
355 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
356
357         * elfnn-aarch64.c (aarch64_relocation_aginst_gp_p): New function.
358         (elfNN_aarch64_final_link_relocate): Delete duplicated code for
359         BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
360         BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
361         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Optimize the
362         support for them.
363
364 2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
365
366         * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
367         (elfcore_write_s390_gs_bc): Likewise.
368         * elf.c (elfcore_grok_s390_gs_cb): New function.
369         (elfcore_grok_s390_gs_bc): New function.
370         (elfcore_grok_note): Call them.
371         (elfcore_write_s390_gs_cb): New function.
372         (elfcore_write_s390_gs_bc): New function.
373         (elfcore_write_register_note): Call them.
374
375 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
376
377         * libbfd.c (_bfd_generic_get_section_contents): Don't call
378         bfd_get_file_size.  Check archive element size.
379         (_bfd_generic_get_section_contents_in_window): Likewise.
380
381 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
382
383         * bfd-in2.h: Regenerated.
384         * bfdio.c (bfd_get_size): Change return type to ufile_ptr.
385         (bfd_get_file_size): Likewise.
386
387 2017-06-28  Maciej W. Rozycki  <macro@imgtec.com>
388             Matthew Fortune  <matthew.fortune@imgtec.com>
389
390         * archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
391         * cpu-mips.c (I_interaptiv_mr2): New enum value.
392         (arch_info_struct): Add "mips:interaptiv-mr2" entry.
393         * elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
394         case.
395         (mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
396         (bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
397         (print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
398         (mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
399         `bfd_mach_mips_interaptiv_mr2' entries.
400         * bfd-in2.h: Regenerate.
401
402 2017-06-27  Nick Clifton  <nickc@redhat.com>
403
404         * tekhex.c (pass_over): Revert accidental conversion of a local
405         array to a static array.
406
407 2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
408
409         PR ld/13402
410         * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
411         reloc addend if necessary. Adjust diff only if
412         shrinked_insn_address < end_address.
413
414 2017-06-27  Alan Modra  <amodra@gmail.com>
415
416         PR binutils/21665
417         * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
418         (_bfd_generic_get_section_contents_in_window): Likewise.
419
420 2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>
421
422         * elfnn-riscv.c (perform_relocation): Support the new
423         R_RISCV_32_PCREL relocation.
424         (riscv_elf_relocate_section): Likewise.
425         * elfxx-riscv.c (howto_table): Likewise.
426         (riscv_reloc_map): Likewise.
427         * bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
428         * libbfd.h: Regenerate.
429
430 2017-06-27  Alan Modra  <amodra@gmail.com>
431
432         PR binutils/21665
433         * libbfd.c (_bfd_generic_get_section_contents): Delete abort.
434         Use unsigned file pointer type, and remove cast.
435         * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
436         Add "count", not "sz".
437
438 2017-06-26  Pedro Alves  <palves@redhat.com>
439
440         PR binutils/21665
441         * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
442         "sz".
443
444 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
445
446         PR binutils/21665
447         * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
448         a missing line.
449
450 2017-06-26  Maciej W. Rozycki  <macro@imgtec.com>
451
452         * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
453         * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
454         E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
455         (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
456         `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
457
458 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
459
460         PR binutils/21665
461         * compress.c (bfd_get_full_section_contents): Don't check the
462         file size here.
463         * libbfd.c (_bfd_generic_get_section_contents): Check for and
464         reject a section whose size + offset is greater than the size
465         of the entire file.
466         (_bfd_generic_get_section_contents_in_window): Likewise.
467
468 2017-06-26  Nick Clifton  <nickc@redhat.com>
469
470         PR binutils/21670
471         * tekhex.c (getvalue): Check for the source pointer exceeding the
472         end pointer before the first byte is read.
473
474 2017-06-26  Nick Clifton  <nickc@redhat.com>
475
476         PR binutils/21665
477         * opncls.c (get_build_id): Check that the section is big enough
478         to contain the whole note.
479         * compress.c (bfd_get_full_section_contents): Check for and reject
480         a section whose size is greater than the size of the entire file.
481         * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
482         contain a notes section.
483
484 2017-06-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
485
486         * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
487         pointer checks.
488         (elf_s390_modify_segment_map): Likewise.
489         (bfd_elf_s390_set_options): Lisewise.
490
491 2017-06-26  Alan Modra  <amodra@gmail.com>
492
493         * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
494         a --just-syms bfd.
495         (_bfd_elf_size_group_sections): Skip --just-syms bfds.
496         (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
497         .preinit_array on --just-syms bfds.
498         (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
499         (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
500         (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
501
502 2017-06-25  Sergei Trofimovich  <slyfox@gentoo.org>
503
504         * elf.c (find_link): Bounds check "hint".
505
506 2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>
507
508         * elf32-arm.c (using_thumb_only): Update list of architectures in
509         BFD_ASSERT for which the logic is valid.
510         (using_thumb2_bl): Likewise.
511         (using_thumb2): Likewise and return true for ARMv8-R.
512         (arch_has_arm_nop): Likewise.
513         (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
514         merging logic.  Update commentis for value 15 of v8m_baseline,
515         v8m_mainline and v4t_plus_v6_m arrays.  Use v8r array to decide
516         merging of value 15 of Tag_CPU_arch.
517
518 2017-06-23  Jiong Wang  <jiong.wang@arm.com>
519
520         * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
521         BFD_RELOC_AARCH64_ADR_GOT_PAGE
522         * bfd-in2.h: Regenerate.
523
524 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
525
526         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
527         the error_alignment label forward.  Properly align program
528         property note section.
529
530 2017-06-22  Eric Christopher  <echristo@gmail.com>
531
532         * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
533         abs to fix a truncation warning.
534
535 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
536
537         * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
538         local undefined weak symbol to 0.
539         * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
540
541 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
542
543         * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
544         is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
545         (elf_i386_link_setup_gnu_properties): If info->shstk is set,
546         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
547         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
548         info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
549         (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
550         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
551
552 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
553
554         * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
555         (elf_i386_lazy_ibt_plt_entry): Likewise.
556         (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
557         (elf_i386_non_lazy_ibt_plt_entry): Likewise.
558         (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
559         (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
560         (elf_i386_lazy_plt_layout): Likewise.
561         (elf_i386_non_lazy_plt_layout): Likewise.
562         (elf_i386_link_hash_entry): Add plt_second.
563         (elf_i386_link_hash_table): Add plt_second and
564         plt_second_eh_frame.
565         (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
566         (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
567         the second PLT.  Check the second PLT.
568         (elf_i386_relocate_section): Use the second PLT to resolve
569         PLT reference if needed.
570         (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
571         needed.
572         (elf_i386_finish_dynamic_sections): Set sh_entsize on the
573         second PLT.  Generate unwind info for the second PLT.
574         (elf_i386_plt_type): Add plt_second.
575         (elf_i386_get_synthetic_symtab): Support the second PLT.
576         (elf_i386_parse_gnu_properties): Support
577         GNU_PROPERTY_X86_FEATURE_1_AND.
578         (elf_i386_merge_gnu_properties): Support
579         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
580         on GNU_PROPERTY_X86_FEATURE_1_IBT
581         (elf_i386_link_setup_gnu_properties): If info->ibt is set,
582         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
583         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
584         is set on all relocatable inputs.
585         * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
586         (elf_x32_lazy_ibt_plt_entry): Likewise.
587         (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
588         (elf_x32_non_lazy_ibt_plt_entry): Likewise.
589         (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
590         (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
591         (elf_x86_64_lazy_ibt_plt): Likewise.
592         (elf_x32_lazy_ibt_plt): Likewise.
593         (elf_x86_64_non_lazy_ibt_plt): Likewise.
594         (elf_x32_non_lazy_ibt_plt): Likewise.
595         (elf_x86_64_get_synthetic_symtab): Support the second PLT.
596         (elf_x86_64_parse_gnu_properties): Support
597         GNU_PROPERTY_X86_FEATURE_1_AND.
598         (elf_x86_64_merge_gnu_properties): Support
599         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
600         on GNU_PROPERTY_X86_FEATURE_1_IBT
601         (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
602         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
603         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
604         is set on all relocatable inputs.
605
606 2017-06-22  Nick Clifton  <nickc@redhat.com>
607
608         PR binutils/21649
609         * som.c (setup_sections): NUL terminate the space_strings buffer.
610         Check that the space.name field does not index beyond the end of
611         the space_strings buffer.
612
613 2017-06-21  Nick Clifton  <nickc@redhat.com>
614
615         PR binutils/21646
616         * coff-sh.c (sh_reloc): Check for an out of range reloc.
617
618 2017-06-21  Nick Clifton  <nickc@redhat.com>
619
620         PR binutils/21639
621         * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
622         type of the size parameter.
623         (_bfd_vms_save_counted_string): Add second parameter - the maximum
624         length of the counted string.
625         * vms.h (_bfd_vms_save_sized_string): Update prototype.
626         (_bfd_vms_save_counted_string): Likewise.
627         * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
628         _bfd_vms_save_counted_string.
629         (_bfd_vms_slurp_ehdr): Likewise.
630         (_bfd_vms_slurp_egsd): Likewise.
631         (Parse_module): Likewise.
632
633 2017-06-21  Alan Modra  <amodra@gmail.com>
634
635         * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
636         calls before tocsave calls.
637         (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
638         following nop.
639
640 2017-06-21  Nick Clifton  <nickc@redhat.com>
641
642         PR binutils/21645
643         * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
644         bfd_get_full_section_contents returns no contents.
645
646 2017-06-21  Nick Clifton  <nickc@redhat.com>
647
648         PR binutils/21638
649         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
650         record.
651
652 2017-06-21  Nick Clifton  <nickc@redhat.com>
653
654         PR binutils/21637
655         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
656         list.
657         (image_set_ptr): Likewise.
658         (alpha_vms_fix_sec_rel): Likewise.
659         (alpha_vms_slurp_relocs): Likewise.
660
661 2017-06-21  Nick Clifton  <nickc@redhat.com>
662
663         PR binutils/21633
664         * ieee.c (ieee_slurp_sections): Check for a NULL return from
665         read_id.
666         (ieee_archive_p): Likewise.
667         (ieee_object_p): Likewise.
668
669 2017-06-21  Nick Clifton  <nickc@redhat.com>
670
671         PR binutils/21640
672         * elf.c (setup_group): Zero the group section pointer list after
673         allocation so that loops can be caught.  Check for NULL pointers
674         when processing a group list.
675
676 2017-06-20  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
677
678         * elf-s390.h: New file.
679         * elf64-s390.c (struct elf_s390_link_hash_table): Add params
680         field.
681         (elf_s390_additional_program_headers): New function.
682         (elf_s390_modify_segment_map): New function.
683         (bfd_elf_s390_set_options): New function.
684         (elf_backend_additional_program_headers)
685         (elf_backend_modify_segment_map): Add macro definitions.
686
687 2017-06-19  H.J. Lu  <hongjiu.lu@intel.com>
688
689         PR ld/21626
690         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
691         the DYNAMIC bit instead of bfd_count_sections.
692
693 2017-06-19  Nick Clifton  <nickc@redhat.com>
694
695         PR binutils/21618
696         * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
697         length.
698         (evax_bfd_print_eeom): Likewise.
699         (evax_bfd_print_egsd): Check for an overlarge record length.
700         (evax_bfd_print_etir): Likewise.
701
702 2017-06-19  Nick Clifton  <nickc@redhat.com>
703
704         PR binutils/21612
705         * libieee.h (struct common_header_type): Add end_p field.
706         * ieee.c (this_byte_and_next): Do not advance input_p beyond
707         end_p.
708         (read_id): Check for a length that exceeds the remaining bytes in
709         the input buffer.
710         (ieee_seek): Initialise end_p.
711         (ieee_archive_p): Likewise.
712         (ieee_object_p): Likewise.
713
714 2017-06-19  Nick Clifton  <nickc@redhat.com>
715
716         PR binutils/21611
717         * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
718         before reading the EIHS structure entries.
719
720 2017-06-19  Nick Clifton  <nickc@redhat.com>
721
722         PR binutils/21615
723         * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
724         gsd_size.  Check that there are enough bytes remaining to read the
725         type and size of the next egsd.  Check that the size of the egsd
726         does not exceed the size of the record.
727
728 2017-06-19  Alan Modra  <amodra@gmail.com>
729
730         * config.bfd: Correct targ_underscore for cris.
731
732 2017-06-18  Alan Modra  <amodra@gmail.com>
733
734         * config.bfd: Correct targ_underscore for epiphany, ip2k,
735         m32c, mn10200, pru, rl78, rx, crisv32 and v850.
736
737 2017-06-16  Nick Clifton  <nickc@redhat.com>
738
739         * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
740         bucketlist is empty because there are no symbols to add to the
741         list.
742
743 2017-06-16  Alan Modra  <amodra@gmail.com>
744
745         PR ld/20022
746         PR ld/21557
747         PR ld/21562
748         PR ld/21571
749         * targets.c (struct bfd_target): Add _bfd_define_start_stop.
750         (BFD_JUMP_TABLE_LINK): Likewise.
751         * elf-bfd.h (bfd_elf_define_start_stop): Declare.
752         * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
753         (bfd_elf_define_start_stop): New function.
754         * linker.c (bfd_generic_define_start_stop): New function.
755         * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
756         new field.
757         * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
758         * aout-target.h (MY_bfd_define_start_stop): Define.
759         * aout-tic30.c (MY_bfd_define_start_stop): Define.
760         * binary.c (binary_bfd_define_start_stop): Define.
761         * bout.c (b_out_bfd_define_start_stop): Define.
762         * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
763         * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
764         * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
765         * coffcode.h (coff_bfd_define_start_stop): Define.
766         * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
767         * i386msdos.c (msdos_bfd_define_start_stop): Define.
768         * i386os9k.c (os9k_bfd_define_start_stop): Define.
769         * ieee.c (ieee_bfd_define_start_stop): Define.
770         * ihex.c (ihex_bfd_define_start_stop): Define.
771         * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
772         * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
773         * mmo.c (mmo_bfd_define_start_stop): Define.
774         * nlm-target.h (nlm_bfd_define_start_stop): Define.
775         * oasys.c (oasys_bfd_define_start_stop): Define.
776         * pef.c (bfd_pef_bfd_define_start_stop): Define.
777         * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
778         * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
779         * som.c (som_bfd_define_start_stop): Define.
780         * srec.c (srec_bfd_define_start_stop): Define.
781         * tekhex.c (tekhex_bfd_define_start_stop): Define.
782         * versados.c (versados_bfd_define_start_stop): Define.
783         * vms-alpha.c (vms_bfd_define_start_stop): Define.
784         (alpha_vms_bfd_define_start_stop): Define.
785         * xsym.c (bfd_sym_bfd_define_start_stop): Define.
786         * bfd-in2.h: Regenerate.
787         * libbfd.h: Regenerate.
788
789 2017-06-16  Jiong Wang  <jiong.wang@arm.com>
790
791         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
792         SYMBOL_REFERENCES_LOCAL.
793
794 2017-06-15  Jiong Wang  <jiong.wang@arm.com>
795
796         PR ld/21532
797         * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
798         (elfNN_aarch64_final_link_relocate): Also propagate relocations to
799         runtime for if there needs copy relocation elimination.
800         (need_copy_relocation_p): New function.  Return true for symbol with
801         pc-relative references and if it's against read-only sections.
802         (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
803         (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
804         that are related with accessing external objects.
805         (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
806         in elfNN_aarch64_check_relocs.
807
808 2017-06-15  Nick Clifton  <nickc@redhat.com>
809
810         PR binutils/21582
811         * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
812         bugs.
813         PR binutils/21581
814         (ieee_archive_p): Likewise.
815
816 2017-06-15  Nick Clifton  <nickc@redhat.com>
817
818         PR binutils/21579
819         * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
820
821 2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
822
823         * elf32-xtensa.c (elf_xtensa_be_plt_entry,
824         elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
825         keep both windowed and call0 ABI PLT definitions.
826         (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
827         elf_xtensa_*_plt_entry endex.
828         (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
829
830 2017-06-14  Nick Clifton  <nickc@redhat.com>
831
832         PR binutils/21578
833         * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
834         flag value.
835
836 2017-06-14  Nick Clifton  <nickc@redhat.com>
837
838         PR binutils/21589
839         * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
840         maximum value for the ascic pointer.  Check that name processing
841         does not read beyond this value.
842         (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
843         end of etir record.
844
845 2017-06-14  Nick Clifton  <nickc@redhat.com>
846
847         PR binutils/21591
848         * versados.c (versados_mkobject): Zero the allocated tdata structure.
849         (process_otr): Check for an invalid offset in the otr structure.
850
851 2017-06-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
852
853         * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
854
855 2017-06-13  H.J. Lu  <hongjiu.lu@intel.com>
856
857         PR ld/20022
858         PR ld/21557
859         PR ld/21562
860         PR ld/21571
861         * elf-bfd.h (elf_link_hash_entry): Add start_stop.  Change the
862         vtable field to a union.
863         (_bfd_elf_is_start_stop): Removed.
864         * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
865         __start_SECNAME and __stop_SECNAME symbols.
866         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
867         * elflink.c (_bfd_elf_is_start_stop): Removed.
868         (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
869         _bfd_elf_is_start_stop.
870         (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
871         __stop_SECNAME symbols.  Updated.
872         (elf_gc_smash_unused_vtentry_relocs): Likewise.
873         (bfd_elf_gc_record_vtinherit): Likewise.
874         (bfd_elf_gc_record_vtentry): Likewise.
875
876 2017-06-13  Nick Clifton  <nickc@redhat.com>
877
878         PR ld/21524
879         * elflink.c (elf_link_adjust_relocs): Generate an error when
880         encountering a reloc against a symbol removed by garbage
881         collection.
882
883 2017-06-12  H.J. Lu  <hongjiu.lu@intel.com>
884
885         * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
886         to merge_gnu_properties.
887         * elf-properties.c (elf_merge_gnu_properties): Add struct
888         bfd_link_info * and pass it to merge_gnu_properties.
889         (elf_merge_gnu_property_list): Add struct bfd_link_info *
890         and pass it to elf_merge_gnu_properties.
891         (_bfd_elf_link_setup_gnu_properties): Pass info to
892         elf_merge_gnu_property_list.
893         * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
894         bfd_link_info *.
895         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
896
897 2017-06-11  Joe Zbiciak  <joe.zbiciak@leftturnonly.info>
898
899         PR 21564
900         * binary.c (binary_set_section_contents): Scale lma by octets
901         per byte to set filepos.
902
903 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
904
905         * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
906         dynamic sections.
907
908 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
909
910         * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
911         require TEXTREL.
912
913 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
914
915         * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
916         patched section contents for TLS IE reloc.
917         * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
918
919 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
920
921         * elf32-arc.c (elf_arc_relocate_section): Added "call" to
922         RELOC_FOR_GLOBAL_SYMBOL macro.
923
924 2018-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
925
926         * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
927         changes.
928
929 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
930
931         * config/tc-arc.c (md_undefined_symbol): Changed.
932         * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
933
934 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
935
936         * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
937         symbols.
938
939 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
940
941         * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
942         warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
943
944 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
945
946         * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
947         object is created.
948
949 2017-06-08  Richard Earnshaw  <rearnsha@arm.com>
950
951         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
952         that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
953         is non-zero.  Add clarifying comments.
954
955 2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
956
957         * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
958         name.  Use local IFUNC symbol name string to report unsupported
959         non-PIC call to IFUNC function.
960         (elf_i386_relocate_section): Dump local IFUNC name with minfo
961         when generating R_386_IRELATIVE relocation.
962         (elf_i386_finish_dynamic_symbol): Likewise.
963         * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
964         IFUNC symbol name.
965         (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
966         when generating R_X86_64_IRELATIVE relocation.
967         (elf_x86_64_finish_dynamic_symbol): Likewise.
968
969 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
970
971         * elf.c (setup_group): Make sure BFD sections are created for all
972         group sections in the input file when processing SHF_GROUP
973         sections.
974         (bfd_section_from_shdr): Avoid duplicating logic already
975         implemented in `setup_group'.
976
977 2017-06-06  Daniel Bonniot de Ruisselet  <bonniot@gmail.com>
978
979         PR binutils/21546
980         * peXXigen.c (pe_print_idata): Use the address of the first thunk
981         if the hint address is zero.
982
983 2017-06-06  James Clarke  <jrtc27@jrtc27.com>
984
985         PR ld/19579
986         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
987         ELF_COMMON_DEF_P for common symbols.
988
989 2017-06-06  Andrew Burgess  <andrew.burgess@embecosm.com>
990
991         * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
992         SEC_GROUP sections as SEC_EXCLUDE.
993         (bfd_elf_set_group_contents): Replace use of abort with an assert.
994         (assign_section_numbers): Use resolve_section_groups flag instead
995         of relocatable link type.
996         (_bfd_elf_init_private_section_data): Use resolve_section_groups
997         flag instead of checking the final_link flag for part of the
998         checks in here.  Fix white space as a result.
999         * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
1000         instead of relocatable link type.
1001         (bfd_elf_final_link): Likewise.
1002
1003 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1004
1005         * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
1006         variable `bed'.
1007         * elf32-score.c (score_elf_final_link_relocate): Likewise.
1008         (s3_bfd_score_elf_check_relocs): Likewise.
1009         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
1010         (score_elf_final_link_relocate): Likewise.
1011         (s7_bfd_score_elf_check_relocs): Likewise.
1012
1013 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1014
1015         * elflink.c (init_reloc_cookie_rels): Remove unused variable
1016         `bed'.
1017
1018 2017-06-06  Maciej W. Rozycki  <macro@imgtec.com>
1019
1020         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
1021         from `reloc_count' rather than decrementing it.
1022         * elf.c (bfd_section_from_shdr): Multiply the adjustment to
1023         `reloc_count' by `int_rels_per_ext_rel'.
1024         * elf32-score.c (score_elf_final_link_relocate): Do not multiply
1025         `reloc_count' by `int_rels_per_ext_rel' for last relocation
1026         entry determination.
1027         (s3_bfd_score_elf_check_relocs): Likewise.
1028         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
1029         (s7_bfd_score_elf_relocate_section): Likewise.
1030         (s7_bfd_score_elf_check_relocs): Likewise.
1031         * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
1032         prototype and function.
1033         (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
1034         (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
1035         triple rather than once the sum of REL and RELA relocation entry
1036         counts.
1037         (bfd_elf64_get_reloc_upper_bound): Remove macro.
1038         * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
1039         `reloc_count' by `int_rels_per_ext_rel' for internal relocation
1040         storage allocation size determination.
1041         (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
1042         size by `int_rels_per_ext_rel'.  Do not multiply `reloc_count'
1043         by `int_rels_per_ext_rel' for last relocation entry
1044         determination.
1045         (bfd_elf_final_link): Do not multiply `reloc_count' by
1046         `int_rels_per_ext_rel' for internal relocation storage
1047         allocation size determination.
1048         (init_reloc_cookie_rels): Do not multiply `reloc_count' by
1049         `int_rels_per_ext_rel' for last relocation entry determination.
1050         (elf_gc_smash_unused_vtentry_relocs): Likewise.
1051         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
1052         (_bfd_mips_elf_relocate_section): Likewise.
1053
1054 2017-06-05  Alan Modra  <amodra@gmail.com>
1055
1056         PR 21529
1057         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
1058
1059 2017-06-01  John Baldwin  <jhb@FreeBSD.org>
1060
1061         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
1062         determine structure sizes.
1063         (elfcore_grok_freebsd_prstatus): Likewise.
1064
1065 2017-06-01  Alan Modra  <amodra@gmail.com>
1066
1067         * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
1068         (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
1069         dynamic objects.
1070         (is_elfv2_localentry0): New function.
1071         (ppc64_elf_tls_setup): Default params->plt_localentry0.
1072         (plt_stub_size): Adjust size for tls_get_addr_opt stub.
1073         (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
1074         (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
1075         optimized localentry:0 stubs.
1076         (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
1077         (ppc64_elf_relocate_section): Leave nop unchanged for optimized
1078         localentry:0 stubs.
1079         (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
1080         DT_PPC64_OPT.
1081         * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
1082
1083 2017-05-30  Casey Smith  <clegg89@gmail.com>
1084
1085         PR ld/21523
1086         * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
1087         value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
1088
1089 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
1090
1091         * cpu-arc.c (arc_compatible): New function.
1092
1093 2017-05-30  Anton Kolesov  <anton.kolesov@synopsys.com>
1094
1095         * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
1096
1097 2017-05-30  H.J. Lu  <hongjiu.lu@intel.com>
1098
1099         PR binutils/21519
1100         * bfdio.c (bfd_get_file_size): New function.
1101         * bfd-in2.h: Regenerated.
1102
1103 2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>
1104
1105         * elf32-arc.c (arc_elf_merge_attributes): Add fall through
1106         comments.
1107
1108 2017-05-22  H.J. Lu  <hongjiu.lu@intel.com>
1109
1110         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
1111         dynobj instead of htab->elf.dynobj.
1112
1113 2017-05-19  Maciej W. Rozycki  <macro@imgtec.com>
1114
1115         * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
1116         and function.
1117         (mips_elf64_canonicalize_dynamic_reloc): Likewise.
1118         (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
1119         actual number of internal relocations retrieved.  Adjust
1120         function description.
1121         (bfd_elf64_canonicalize_reloc): Remove macro.
1122         (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
1123
1124 2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
1125
1126         * archures.c (bfd_mach_sparc_v9m8): Define.
1127         (bfd_mach_sparc_v8plusm8): Likewise.
1128         (bfd_mach_sparc_v9_p): Adjust to M8.
1129         (bfd_mach_sparc_64bit_p): Likewise.
1130         * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
1131         bfd_mach_sparc_v8plusm8.
1132         * bfd-in2.h: Regenerated.
1133         * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
1134         sparc:v8plusm8.
1135         * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
1136         bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
1137         capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
1138         SHA3.
1139         * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
1140         bfd_mach_sparc_v8plusm8.
1141
1142 2017-05-19  Alan Modra  <amodra@gmail.com>
1143
1144         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
1145         debug and special sections when no non-note alloc sections in an
1146         object are kept.
1147
1148 2017-05-18  Alan Modra  <amodra@gmail.com>
1149
1150         * arc-got.h: Don't compare boolean values against TRUE or FALSE.
1151         * elf-m10300.c: Likewise.
1152         * elf.c: Likewise.
1153         * elf32-arc.c: Likewise.
1154         * elf32-bfin.c: Likewise.
1155         * elf32-m68k.c: Likewise.
1156         * elf32-nds32.c: Likewise.
1157         * elf32-tilepro.c: Likewise.
1158         * elflink.c: Likewise.
1159         * elfnn-aarch64.c: Likewise.
1160         * elfnn-riscv.c: Likewise.
1161         * elfxx-tilegx.c: Likewise.
1162         * mach-o.c: Likewise.
1163         * peXXigen.c: Likewise.
1164         * vms-alpha.c: Likewise.
1165         * vms-lib.c: Likewise.
1166
1167 2017-05-17  H.J. Lu  <hongjiu.lu@intel.com>
1168
1169         PR ld/20882
1170         * elflink.c (elf_gc_mark_debug_section): New function.
1171         (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
1172         referenced by kept debug sections.
1173
1174 2017-05-16  Alan Modra  <amodra@gmail.com>
1175
1176         * elf-m10300.c: Rename occurrences of non_ir_ref.
1177         * elf32-arm.c: Likewise.
1178         * elf32-bfin.c: Likewise.
1179         * elf32-cr16.c: Likewise.
1180         * elf32-cris.c: Likewise.
1181         * elf32-d10v.c: Likewise.
1182         * elf32-dlx.c: Likewise.
1183         * elf32-fr30.c: Likewise.
1184         * elf32-frv.c: Likewise.
1185         * elf32-hppa.c: Likewise.
1186         * elf32-i370.c: Likewise.
1187         * elf32-i386.c: Likewise.
1188         * elf32-iq2000.c: Likewise.
1189         * elf32-lm32.c: Likewise.
1190         * elf32-m32c.c: Likewise.
1191         * elf32-m32r.c: Likewise.
1192         * elf32-m68hc1x.c: Likewise.
1193         * elf32-m68k.c: Likewise.
1194         * elf32-mcore.c: Likewise.
1195         * elf32-metag.c: Likewise.
1196         * elf32-microblaze.c: Likewise.
1197         * elf32-moxie.c: Likewise.
1198         * elf32-msp430.c: Likewise.
1199         * elf32-mt.c: Likewise.
1200         * elf32-nios2.c: Likewise.
1201         * elf32-or1k.c: Likewise.
1202         * elf32-ppc.c: Likewise.
1203         * elf32-rl78.c: Likewise.
1204         * elf32-s390.c: Likewise.
1205         * elf32-score.c: Likewise.
1206         * elf32-score7.c: Likewise.
1207         * elf32-sh.c: Likewise.
1208         * elf32-tic6x.c: Likewise.
1209         * elf32-tilepro.c: Likewise.
1210         * elf32-v850.c: Likewise.
1211         * elf32-vax.c: Likewise.
1212         * elf32-xstormy16.c: Likewise.
1213         * elf32-xtensa.c: Likewise.
1214         * elf64-alpha.c: Likewise.
1215         * elf64-hppa.c: Likewise.
1216         * elf64-ia64-vms.c: Likewise.
1217         * elf64-mmix.c: Likewise.
1218         * elf64-ppc.c: Likewise.
1219         * elf64-s390.c: Likewise.
1220         * elf64-sh64.c: Likewise.
1221         * elf64-x86-64.c: Likewise.
1222         * elflink.c: Likewise.
1223         * elfnn-aarch64.c: Likewise.
1224         * elfnn-ia64.c: Likewise.
1225         * elfnn-riscv.c: Likewise.
1226         * elfxx-mips.c: Likewise.
1227         * elfxx-sparc.c: Likewise.
1228         * elfxx-tilegx.c: Likewise.
1229         * linker.c: Likewise.
1230
1231 2017-05-16  Alan Modra  <amodra@gmail.com>
1232
1233         * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
1234         * elflink.c (elf_link_add_object_symbols): Update to use
1235         non_ir_ref_dynamic.
1236         (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
1237         non_ir_ref.
1238         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
1239
1240 2017-05-15  Maciej W. Rozycki  <macro@imgtec.com>
1241
1242         * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
1243
1244 2017-05-12  H.J. Lu  <hongjiu.lu@intel.com>
1245
1246         * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
1247         GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
1248         properties.
1249         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
1250
1251 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
1252
1253         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
1254         to plt_second.
1255         (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
1256         to plt_second/plt_second_eh_frame.
1257         (elf_x86_64_link_hash_newfunc): Updated.
1258         (elf_x86_64_allocate_dynrelocs): Likewise.
1259         (elf_x86_64_size_dynamic_sections): Likewise.
1260         (elf_x86_64_relocate_section): Likewise.
1261         (elf_x86_64_finish_dynamic_symbol): Likewise.
1262         (elf_x86_64_finish_dynamic_sections): Likewise.
1263         (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
1264         (elf_x86_64_get_synthetic_symtab): Updated.  Also scan the
1265         .plt.sec section.
1266         (elf_backend_setup_gnu_properties): Updated.  Create the
1267         .plt.sec section instead of the .plt.sec section.
1268
1269 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
1270
1271         * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
1272         commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
1273         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
1274
1275 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
1276
1277         * elf64-sparc.c (elf64_sparc_set_reloc): New function.
1278         (bfd_elf64_set_reloc): Define.
1279         (elf64_sparc_write_relocs): Use `canon_reloc_count'.
1280
1281 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
1282
1283         * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
1284         (struct bfd_target): New field _bfd_set_reloc.
1285         * bfd.c (bfd_set_reloc): Call backend _set_bfd.
1286         * reloc.c (_bfd_generic_set_reloc): New function.
1287         * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
1288         * nlm-target.h (nlm_set_reloc): Likewise.
1289         * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
1290         * aout-tic30.c (MY_set_reloc): Likewise.
1291         * aout-target.h (MY_set_reloc): Likewise.
1292         * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
1293         * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
1294         * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
1295         * vms-alpha.c (alpha_vms_set_reloc): Likewise.
1296         * aout-adobe.c (aout_32_set_reloc): Likewise.
1297         * bout.c (b_out_set_reloc): Likewise.
1298         * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
1299         * i386os9k.c (aout_32_set_reloc): Likewise.
1300         * ieee.c (ieee_set_reloc): Likewise.
1301         * oasys.c (oasys_set_reloc): Likewise.
1302         * som.c (som_set_reloc): Likewise.
1303         * versados.c (versados_set_reloc): Likewise.
1304         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
1305         _bfd_generic_set_reloc.
1306         (rs6000_xcoff64_aix_vec): LIkewise.
1307         * libbfd.c (_bfd_norelocs_set_reloc): New function.
1308         * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
1309         * i386msdos.c (msdos_set_reloc): Define to
1310         _bfd_norelocs_set_reloc.
1311         * elfcode.h (elf_set_reloc): Define.
1312         * bfd-in2.h: Regenerated.
1313
1314 2017-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1315
1316         PR ld/21481
1317         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
1318         for IFUNC function address.
1319
1320 2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>
1321
1322         * elf32-arc.c (FEATURE_LIST_NAME): Define.
1323         (CONFLICT_LIST): Likewise.
1324         (opcode/arc-attrs.h): Include.
1325         (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
1326         (arc_extract_features): New file.
1327         (arc_stralloc): Likewise.
1328         (arc_elf_merge_attributes): Likewise.
1329         (arc_elf_merge_private_bfd_data): Use object attributes.
1330         (bfd_arc_get_mach_from_attributes): New function.
1331         (arc_elf_object_p): Use object attributes.
1332         (arc_elf_final_write_processing): Likewise.
1333         (elf32_arc_obj_attrs_arg_type): New function.
1334         (elf32_arc_obj_attrs_handle_unknown): Likewise.
1335         (elf32_arc_section_from_shdr): Likewise.
1336         (elf_backend_obj_attrs_vendor): Define.
1337         (elf_backend_obj_attrs_section): Likewise.
1338         (elf_backend_obj_attrs_arg_type): Likewise.
1339         (elf_backend_obj_attrs_section_type): Likewise.
1340         (elf_backend_obj_attrs_handle_unknown): Likewise.
1341         (elf_backend_section_from_shdr): Likewise.
1342
1343 2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
1344
1345         PR ld/21458
1346         * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
1347         of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
1348         and the destination is a Thumb symbol.
1349
1350 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
1351
1352         * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
1353         initializer to silence GCC 4.2.
1354         * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
1355
1356 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
1357
1358         * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
1359         (LAZY_PLT_ENTRY_SIZE): This.
1360         (NON_LAZY_PLT_ENTRY_SIZE): New.
1361         (elf_x86_64_plt0_entry): Renamed to ...
1362         (elf_x86_64_lazy_plt0_entry): This.
1363         (elf_x86_64_plt_entry): Renamed to ...
1364         (elf_x86_64_lazy_plt_entry): This.
1365         (elf_x86_64_bnd_plt0_entry): Renamed to ...
1366         (elf_x86_64_lazy_bnd_plt0_entry): This.
1367         (elf_x86_64_legacy_plt_entry): Removed.
1368         (elf_x86_64_bnd_plt_entry): Renamed to ...
1369         (elf_x86_64_lazy_bnd_plt_entry): This.
1370         (elf_x86_64_legacy_plt2_entry): Renamed to ...
1371         (elf_x86_64_non_lazy_plt_entry): This.
1372         (elf_x86_64_bnd_plt2_entry): Renamed to ...
1373         (elf_x86_64_non_lazy_bnd_plt_entry): This.
1374         (elf_x86_64_eh_frame_plt): Renamed to ...
1375         (elf_x86_64_eh_frame_lazy_plt): This.
1376         (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
1377         (elf_x86_64_eh_frame_lazy_bnd_plt): This.
1378         (elf_x86_64_eh_frame_plt_got): Renamed to ...
1379         (elf_x86_64_eh_frame_non_lazy_plt): This.
1380         (elf_x86_64_lazy_plt_layout): New.
1381         (elf_x86_64_non_lazy_plt_layout): Likewise.
1382         (elf_x86_64_plt_layout): Likewise.
1383         (elf_x86_64_backend_data): Remove PLT layout information.  Add
1384         os for target system.
1385         (GET_PLT_ENTRY_SIZE): Removed.
1386         (elf_x86_64_lazy_plt): New.
1387         (elf_x86_64_non_lazy_plt): Likewise.
1388         (elf_x86_64_lazy_bnd_plt): Likewise.
1389         (elf_x86_64_non_lazy_bnd_plt): Likewise.
1390         (elf_x86-64_arch_bed): Updated.
1391         (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
1392         (elf_x86_64_create_dynamic_sections): Removed.
1393         (elf_x86_64_check_relocs): Don't check elf.dynobj.  Don't call
1394         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
1395         (elf_x86-64_adjust_dynamic_symbol): Updated.
1396         (elf_x86_64_allocate_dynrelocs): Updated.  Pass 0 as PLT header
1397         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
1398         size for PLT0 if there is no PLT0.  Get plt_entry_size from
1399         non_lazy_plt for non-lazy PLT entries.
1400         (elf_x86_64_size_dynamic_sections): Updated.  Get plt_entry_size
1401         from non_lazy_plt for non-lazy PLT entries.
1402         (elf_x86-64_relocate_section): Updated.  Properly get PLT index
1403         if there is no PLT0.
1404         (elf_x86_64_finish_dynamic_symbol): Updated.  Fill the first slot
1405         in the PLT entry with generic PLT layout.  Fill the non-lazy PLT
1406         entries with non-lazy PLT layout.  Don't fill the second and third
1407         slots in the PLT entry if there is no PLT0.
1408         (elf_x86_64_finish_dynamic_sections): Updated.  Don't fill PLT0
1409         if there is no PLT0.  Set sh_entsize on the .plt.got section.
1410         (compare_relocs): New.
1411         (elf_x86_64_plt_type): Likewise.
1412         (elf_x86_64_plt): Likewise.
1413         (elf_x86_64_nacl_plt): New. Forward declaration.
1414         (elf_x86_64_get_plt_sym_val): Removed.
1415         (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
1416         against all dynamic relocations.
1417         (elf_x86_64_link_setup_gnu_properties): New function.
1418         (elf_backend_create_dynamic_sections): Updated.
1419         (elf_backend_setup_gnu_properties): New.
1420         (elf_x86_64_nacl_plt): New.
1421         (elf_x86_64_nacl_arch_bed): Updated.
1422
1423 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
1424
1425         * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
1426         (LAZY_PLT_ENTRY_SIZE): This.
1427         (NON_LAZY_PLT_ENTRY_SIZE): New.
1428         (elf_i386_plt0_entry): Renamed to ...
1429         (elf_i386_lazy_plt0_entry): This.
1430         (elf_i386_plt_entry): Renamed to ...
1431         (elf_i386_lazy_plt_entry): This.
1432         (elf_i386_pic_plt0_entry): Renamed to ...
1433         (elf_i386_pic_lazy_plt0_entry): This.
1434         (elf_i386_pic_plt_entry): Renamed to ...
1435         (elf_i386_pic_lazy_plt_entry): This.
1436         (elf_i386_got_plt_entry): Renamed to ...
1437         (elf_i386_non_lazy_plt_entry): This.
1438         (elf_i386_pic_got_plt_entry): Renamed to ...
1439         (elf_i386_pic_non_lazy_plt_entry): This.
1440         (elf_i386_eh_frame_plt): Renamed to ...
1441         (elf_i386_eh_frame_lazy_plt): This.
1442         (elf_i386_eh_frame_plt_got): Renamed to ...
1443         (elf_i386_eh_frame_non_lazy_plt): This.
1444         (elf_i386_plt_layout): Renamed to ...
1445         (elf_i386_lazy_plt_layout): This.  Remove eh_frame_plt_got and
1446         eh_frame_plt_got_size.
1447         (elf_i386_non_lazy_plt_layout): New.
1448         (elf_i386_plt_layout): Likewise.
1449         (elf_i386_non_lazy_plt): Likewise.
1450         (GET_PLT_ENTRY_SIZE): Removed.
1451         (elf_i386_plt): Renamed to ...
1452         (elf_i386_lazy_plt): This.
1453         (elf_i386_backend_data): Remove plt.  Rename is_vxworks to os.
1454         (elf_i386_arch_bed): Updated.
1455         (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
1456         (elf_i386_create_dynamic_sections): Removed.
1457         (elf_i386_check_relocs): Don't check elf.dynobj.  Don't call
1458         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
1459         (elf_i386_adjust_dynamic_symbol): Updated.
1460         (elf_i386_allocate_dynrelocs): Updated.  Pass 0 as PLT header
1461         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
1462         size for PLT0 if there is no PLT0.
1463         (elf_i386_size_dynamic_sections): Updated.  Check whether GOT
1464         output section is discarded only if GOT isn't empty.
1465         (elf_i386_relocate_section): Updated.  Properly get PLT index
1466         if there is no PLT0.
1467         (elf_i386_finish_dynamic_symbol): Updated.  Don't fill the
1468         second and third slots in the PLT entry if there is no PLT0.
1469         (elf_i386_finish_dynamic_sections): Updated.  Don't fill PLT0
1470         if there is no PLT0.  Set sh_entsize on the .plt.got section.
1471         (elf_i386_nacl_plt): Forward declaration.
1472         (elf_i386_get_plt_sym_val): Removed.
1473         (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
1474         against all dynamic relocations.
1475         (elf_i386_link_setup_gnu_properties): New function.
1476         (elf_backend_create_dynamic_sections): Updated.
1477         (elf_backend_setup_gnu_properties): New.
1478         (elf_i386_nacl_plt): Updated.
1479         (elf_i386_nacl_arch_bed): Likewise.
1480         (elf_i386_vxworks_arch_bed): Likewise.
1481
1482 2017-05-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1483
1484         * elflink.c (elf_output_implib): Remove executable flag from import
1485         library bfd.
1486         * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
1487         library is a relocatable object file.
1488
1489 2017-05-01  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
1490
1491         PR ld/21404
1492         * elf32-avr.c (avr_should_move_sym): New function.
1493         (avr_should_reduce_sym_size): Likewise.
1494         (avr_should_increase_sym_size): Likewise.
1495         (elf32_avr_relax_delete_bytes): Adjust symbol values
1496         and sizes by calling new functions.
1497
1498 2017-05-01  Palmer Dabbelt  <palmer@dabbelt.com>
1499
1500         * config.bfd (riscv32-*): Enable rv64.
1501
1502 2017-05-02  Alan Modra  <amodra@gmail.com>
1503
1504         PR 21384
1505         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
1506         rather than h->root.type == bfd_link_hash_new.
1507         (bfd_elf_record_link_assignment): Similarly, call
1508         bfd_elf_link_mark_dynamic_symbol when h->non_elf.
1509
1510 2017-04-29  Alan Modra  <amodra@gmail.com>
1511
1512         PR 21432
1513         * reloc.c (reloc_offset_in_range): New function.
1514         (bfd_perform_relocation, bfd_install_relocation): Use it.
1515         (_bfd_final_link_relocate): Likewise.
1516
1517 2017-04-28  H.J. Lu  <hongjiu.lu@intel.com>
1518
1519         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
1520         before using .plt.got.
1521         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
1522
1523 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1524
1525         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
1526         instead of "+=" to update 0.
1527
1528 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1529
1530         * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
1531         .plt.got section here.
1532         (elf_i386_check_relocs): Don't create the .plt.got section.
1533         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
1534         the .plt.got and .plt.bnd sections here.
1535         (elf_x86_64_check_relocs): Don't create the .plt.got nor
1536         .plt.bnd sections.
1537
1538 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1539
1540         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
1541         has_bnd_reloc.
1542         (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
1543         (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
1544         (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
1545         (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
1546         has_bnd_reloc.
1547
1548 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1549
1550         * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
1551         to return bfd *.
1552         (_bfd_elf_link_setup_gnu_properties): Return bfd *.
1553         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
1554         the first relocatable ELF input with GNU properties.
1555
1556 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1557
1558         * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
1559         VxWorks for non-PIC.
1560
1561 2017-04-27  Alan Modra  <amodra@gmail.com>
1562
1563         * elf-bfd.h (struct elf_backend_data): Make asection param of
1564         elf_backend_eh_frame_address_size const.
1565         (_bfd_elf_eh_frame_address_size): Likewise.
1566         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
1567         * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
1568         * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
1569         * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
1570         * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
1571         (next_cie_fde_offset): Constify params.
1572         (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
1573
1574 2017-04-27  Alan Modra  <amodra@gmail.com>
1575
1576         * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
1577         (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
1578         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
1579         aug_data_len.
1580         (offset_adjust): New function.
1581         (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
1582         (adjust_eh_frame_local_symbols): Likewise.
1583         (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
1584         after changing anything.  Return true if anything changed.
1585         * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
1586         _bfd_elf_adjust_eh_frame_global_symbol for globals.
1587
1588 2017-04-27  Alan Modra  <amodra@gmail.com>
1589
1590         * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
1591         when force_local.
1592
1593 2017-04-27  Alan Modra  <amodra@gmail.com>
1594
1595         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
1596         (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
1597         (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
1598         (ppc_elf_relocate_section): Likewise.  Delete silly optimisation
1599         for undef and undefweak dyn_relocs.
1600         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
1601         (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
1602         (allocate_got, allocate_dynrelocs): Likewise.
1603         (ppc64_elf_relocate_section): Likewise.
1604
1605 2017-04-26  H.J. Lu  <hongjiu.lu@intel.com>
1606
1607         * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
1608         DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
1609         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
1610         add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
1611
1612 2017-04-26  Nick Clifton  <nickc@redhat.com>
1613
1614         PR binutils/21434
1615         * reloc.c (bfd_perform_relocation): Check for a negative address
1616         in the reloc.
1617
1618 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
1619
1620         PR ld/21334
1621         * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
1622         member.
1623         * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
1624         (elf_backend_always_renumber_dynsyms): Define.
1625         (elfNN_bed): Initialize `always_renumber_dynsyms' member.
1626         * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
1627         * elflink.c (bfd_elf_size_dynamic_sections): Also call
1628         `_bfd_elf_link_renumber_dynsyms' if the backend has requested
1629         it.
1630         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
1631
1632 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
1633
1634         * elflink.c (bfd_elf_size_dynamic_sections): Only call
1635         `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
1636         sections have been created.
1637
1638 2017-04-26  Nick Clifton  <nickc@redhat.com>
1639
1640         PR binutils/21431
1641         * compress.c (bfd_init_section_compress_status): Check the return
1642         value from bfd_malloc.
1643
1644 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1645
1646         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
1647         no_finish_dynamic_symbol.
1648         (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
1649         0.
1650         (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
1651         weak symbol, don't make it dynamic.
1652         (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
1653         set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
1654         relocation for GOT reference.
1655         (elf_x86_64_finish_dynamic_symbol): Abort if
1656         no_finish_dynamic_symbol isn't 0.
1657
1658 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1659
1660         PR ld/21402
1661         * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
1662         undefined weak symbol, don't make it dynamic.
1663         (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
1664         set no_finish_dynamic_symbol and generate R_386_RELATIVE
1665         relocation for R_386_GOT32.
1666
1667 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1668
1669         PR ld/21425
1670         * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
1671
1672 2017-04-23  Alan Modra  <amodra@gmail.com>
1673
1674         PR 21414
1675         * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
1676         * elf.c (lcomm_sym): New.
1677         (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
1678         * bfd-in2.h: Regenerate.
1679
1680 2017-04-23  Alan Modra  <amodra@gmail.com>
1681
1682         PR 21412
1683         * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
1684         parameters and comment.
1685         (_bfd_elf_get_reloc_section): Delete.
1686         (_bfd_elf_plt_get_reloc_section): Declare.
1687         * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
1688         New functions.  Don't blindly skip over assumed .rel/.rela prefix.
1689         Extracted from..
1690         (_bfd_elf_get_reloc_section): ..here.  Delete.
1691         (assign_section_numbers): Call elf_get_reloc_section.
1692         * elf64-ppc.c (elf_backend_get_reloc_section): Define.
1693         * elfxx-target.h (elf_backend_get_reloc_section): Update.
1694
1695 2017-04-23  Alan Modra  <amodra@gmail.com>
1696
1697         PR 21409
1698         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
1699         no symbols.
1700
1701 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
1702
1703         PR ld/21402
1704         * elf32-i386.c (elf_i386_link_hash_entry): Add
1705         no_finish_dynamic_symbol.
1706         (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
1707         (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
1708         symbol, don't make it dynamic in PIE.
1709         (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
1710         set no_finish_dynamic_symbol and generate R_386_RELATIVE
1711         relocation for R_386_GOT32
1712         (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
1713         isn't 0.
1714
1715 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
1716
1717         PR ld/19617
1718         PR ld/21086
1719         * elflink.c (elf_link_add_object_symbols): Require
1720         --no-dynamic-linker with -E/--dynamic-list when creating
1721         dynamic sections.
1722
1723 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
1724
1725         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
1726         if forced local.
1727
1728 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
1729
1730         * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
1731         dynamic symbol sorting.
1732
1733 2017-04-20  H.J. Lu  <hongjiu.lu@intel.com>
1734
1735         PR ld/21382
1736         * elflink.c (elf_link_add_object_symbols): Preserve
1737         dynamic_ref_after_ir_def when restoring the symbol table for
1738         unneeded dynamic object.
1739
1740 2017-04-19  H.J. Lu  <hongjiu.lu@intel.com>
1741
1742         PR ld/21401
1743         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
1744         on on undefined IFUNC symbol in the second PLT.
1745
1746 2017-04-19  Wedson Almeida Filho  <wedsonaf@gmail.com>
1747
1748         * peXXigen.c (pe_print_reloc): Correct chunk_end.
1749
1750 2017-04-19  Alan Modra  <amodra@gmail.com>
1751
1752         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
1753         or make dynamic for info->dynamic_undefined_weak 0 and 1.
1754         * elf32-ppc.c:Formatting.
1755         (ensure_undefweak_dynamic): Don't make dynamic when
1756         info->dynamic_undefined_weak is zero.
1757         (allocate_dynrelocs): Discard undefweak dyn_relocs for
1758         info->dynamic_undefined_weak.  Discard undef dyn_relocs when
1759         not default visibility.  Discard undef and undefweak
1760         dyn_relocs earlier.
1761         (ppc_elf_relocate_section): Adjust to suit.
1762         * elf64-ppc.c: Formatting.
1763         (ensure_undefweak_dynamic): Don't make dynamic when
1764         info->dynamic_undefined_weak is zero.
1765         (allocate_dynrelocs): Discard undefweak dyn_relocs for
1766         info->dynamic_undefined_weak.  Discard them earlier.
1767
1768 2017-04-17  H.J. Lu  <hongjiu.lu@intel.com>
1769
1770         PR ld/21389
1771         * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
1772         before generating the version definition section.
1773
1774 2017-04-17  Alan Modra  <amodra@gmail.com>
1775
1776         * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
1777         state when a regular object file defines a symbol with
1778         incompatible type to that defined by an earlier shared lib.
1779
1780 2017-04-13  Alan Modra  <amodra@gmail.com>
1781
1782         * coffcode.h: Wrap some overly long _bfd_error_handler args.
1783         * elf.c: Likewise.
1784         * elf32-arm.c: Likewise.
1785         * elf32-i386.c: Likewise.
1786         * elf32-mep.c: Likewise.
1787         * elf64-ia64-vms.c: Likewise.
1788         * elf64-x86-64.c: Likewise.
1789         * elflink.c: Likewise.
1790         * elfnn-ia64.c: Likewise.
1791         * elfxx-mips.c: Likewise.
1792
1793 2017-04-13  Alan Modra  <amodra@gmail.com>
1794
1795         * aoutx.h: Use %B and %A in error messages throughout file.
1796         * aout-cris.c: Likewise.
1797         * archive.c: Likewise.
1798         * binary.c: Likewise.
1799         * coff-rs6000.c: Likewise.
1800         * coff-tic4x.c: Likewise.
1801         * coffcode.h: Likewise.
1802         * coffgen.c: Likewise.
1803         * cofflink.c: Likewise.
1804         * coffswap.h: Likewise.
1805         * cpu-arm.c: Likewise.
1806         * elf-eh-frame.c: Likewise.
1807         * elf-m10300.c: Likewise.
1808         * elf.c: Likewise.
1809         * elf32-arc.c: Likewise.
1810         * elf32-arm.c: Likewise.
1811         * elf32-bfin.c: Likewise.
1812         * elf32-frv.c: Likewise.
1813         * elf32-iq2000.c: Likewise.
1814         * elf32-m32c.c: Likewise.
1815         * elf32-microblaze.c: Likewise.
1816         * elf32-nds32.c: Likewise.
1817         * elf32-rl78.c: Likewise.
1818         * elf32-rx.c: Likewise.
1819         * elf32-score.c: Likewise.
1820         * elf32-score7.c: Likewise.
1821         * elf32-sh64.c: Likewise.
1822         * elf32-v850.c: Likewise.
1823         * elf32-vax.c: Likewise.
1824         * elf32-visium.c: Likewise.
1825         * elf64-ia64-vms.c: Likewise.
1826         * elf64-mmix.c: Likewise.
1827         * elf64-sh64.c: Likewise.
1828         * elfcode.h: Likewise.
1829         * elfnn-aarch64.c: Likewise.
1830         * elfnn-ia64.c: Likewise.
1831         * elfxx-mips.c: Likewise.
1832         * hpux-core.c: Likewise.
1833         * ieee.c: Likewise.
1834         * ihex.c: Likewise.
1835         * linker.c: Likewise.
1836         * merge.c: Likewise.
1837         * mmo.c: Likewise.
1838         * oasys.c: Likewise.
1839         * pdp11.c: Likewise.
1840         * peXXigen.c: Likewise.
1841         * rs6000-core.c: Likewise.
1842         * vms-alpha.c: Likewise.
1843         * xcofflink.c: Likewise.
1844
1845 2017-04-13  Alan Modra  <amodra@gmail.com>
1846
1847         * bfd.c (PRINT_TYPE): Define.
1848         (_doprnt): New function.
1849         (error_handler_internal): Use _doprnt.
1850         * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
1851         calls in their natural order, throughout file.
1852         * coff-mcore.c: Likewise.
1853         * coff-ppc.c: Likewise.
1854         * coff-tic80.c: Likewise.
1855         * cofflink.c: Likewise.
1856         * elf-s390-common.c: Likewise.
1857         * elf.c: Likewise.
1858         * elf32-arm.c: Likewise.
1859         * elf32-i386.c: Likewise.
1860         * elf32-m32r.c: Likewise.
1861         * elf32-msp430.c: Likewise.
1862         * elf32-spu.c: Likewise.
1863         * elf64-ia64-vms.c: Likewise.
1864         * elf64-sparc.c: Likewise.
1865         * elf64-x86-64.c: Likewise.
1866         * elflink.c: Likewise.
1867         * elfnn-aarch64.c: Likewise.
1868         * elfnn-ia64.c: Likewise.
1869         * elfxx-mips.c: Likewise.
1870
1871 2017-04-13  Alan Modra  <amodra@gmail.com>
1872
1873         * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
1874         branch veneers" error.  Fix double space and format message.
1875         * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
1876         * elf64-ppc.c (tocsave_find): Supply missing %B arg.
1877
1878 2017-04-13  Alan Modra  <amodra@gmail.com>
1879
1880         * bfd-in2.h: Regenerate.
1881
1882 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
1883
1884         * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
1885         extra `\n' in warning/error messages.
1886         * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
1887         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
1888
1889 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
1890
1891         * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
1892         processor-specific properties with generic ELF target vector.
1893
1894 2017-04-10  Qing Zhao  <qing.zhao@oracle.com>
1895
1896         * elf32-sparc.c (elf_backend_fixup_symbol): New.
1897         * elf64-sparc.c (elf_backend_fixup_symbol): New.
1898         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
1899         (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
1900         has_non_got_reloc.
1901         (link_hash_newfunc): Initialize has_got_reloc and
1902         has_non_got_reloc.
1903         (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
1904         section.
1905         (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
1906         has_non_got_reloc.
1907         (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
1908         has_non_got_reloc.
1909         (_bfd_sparc_elf_fixup_symbol): New function.
1910         (allocate_dynrelocs): Don't allocate space for dynamic
1911         relocations and discard relocations against resolved undefined
1912         weak symbols in executable.  Don't make resolved undefined weak
1913         symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
1914         relocation against undefined weak symbols in PIE.
1915         (_bfd_sparc_elf_relocate_section): Don't generate dynamic
1916         relocations against resolved undefined weak symbols in PIE
1917         (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
1918         without ynamic PLT/GOT relocations for resolved undefined weak
1919         symbols.
1920         Don't generate dynamic relocation against resolved undefined
1921         weak symbol in executable.
1922         (pie_finish_undefweak_symbol): New function.
1923         (_bfd_sparc_elf_finish_dynamic_sections): Call
1924         pie_finish_undefweak_symbol on all symbols in PIE.
1925         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
1926         (_bfd_sparc_elf_fixup_symbol): New function.
1927
1928 2017-04-10  Nick Clifton  <nickc@redhat.com>
1929
1930         * config.bfd: Remove ns32k from obsolete list.
1931
1932 2017-04-10  Alan Modra  <amodra@gmail.com>
1933
1934         PR 21287
1935         * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
1936         (special_sections_i): Likewise for .init_array.
1937         (special_sections_p): Likewise for .preinit_array.
1938
1939 2017-04-07  H.J. Lu  <hongjiu.lu@intel.com>
1940
1941         PR ld/19579
1942         PR ld/21306
1943         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
1944         ELF_COMMON_DEF_P for common symbols.
1945         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
1946         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
1947         * elflink.c (_bfd_elf_merge_symbol): Revert commits
1948         202ac193bbbecc96a4978d1ac3d17148253f9b01 and
1949         07492f668d2173da7a2bda3707ff0985e0f460b6.
1950
1951 2017-04-07  Pedro Alves  <palves@redhat.com>
1952
1953         * opncls.c (bfd_get_debug_link_info): Rename to...
1954         (bfd_get_debug_link_info_1): ... this.  Change type of second
1955         parameter to void pointer.  Adjust.
1956         (bfd_get_debug_link_info): Reimplement on top of
1957         bfd_get_debug_link_info_1.
1958         (separate_debug_file_exists, separate_alt_debug_file_exists):
1959         Change type of second parameter to void pointer.  Adjust.
1960         (get_func_type, check_func_type): Change type of second parameter
1961         to void pointer.
1962         (find_separate_debug_file): Add 'func_data' parameter.  Pass it to
1963         the callback functions instead of passing the address of a local.
1964         (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
1965         find_separate_debug_file.
1966         (get_alt_debug_link_info_shim): Change type of second parameter to
1967         void pointer.  Adjust.
1968         (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
1969         find_separate_debug_file.
1970         (get_build_id_name, bfd_boolean check_build_id_file): Change type
1971         of second parameter to void pointer.  Adjust.
1972         (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
1973         pointer local to find_separate_debug_file.
1974
1975 2017-04-07  Tristan Gingold  <gingold@gingold-Precision-7510>
1976
1977         * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
1978         external symbols with a definition.
1979         (_bfd_coff_gc_mark_extra_sections): Fix typo.
1980
1981 2017-04-07  Alan Modra  <amodra@gmail.com>
1982
1983         * po/SRC-POTFILES.in: Regenerate.
1984
1985 2017-04-05  Alan Modra  <amodra@gmail.com>
1986
1987         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
1988         reference counting.
1989
1990 2017-04-02  Jon Turney  <jon.turney@dronecode.org.uk>
1991
1992         (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
1993         numbers for DataDirectory entry indicies passed to
1994         add_data_entry().
1995
1996 2017-04-04  H.J. Lu  <hongjiu.lu@intel.com>
1997
1998         * elf.c (get_program_header_size): Add a GNU_MBIND segment for
1999         each GNU_MBIND section and align GNU_MBIND section to page size.
2000         (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
2001         segment for each GNU_MBIND section.
2002         (_bfd_elf_init_private_section_data): Copy sh_info from input
2003         for GNU_MBIND section.
2004
2005 2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
2006
2007         * elfnn-riscv.c (GP_NAME): Delete.
2008         (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
2009         (_bfd_riscv_relax_lui): Likewise.
2010
2011 2017-04-04  Nick Clifton  <nickc@redhat.com>
2012
2013         PR binutils/21342
2014         * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
2015         dereference.
2016         (bfd_elf_final_link): Only initialize the extended symbol index
2017         section if there are extended symbol tables to list.
2018
2019 2017-04-03  H.J. Lu  <hongjiu.lu@intel.com>
2020
2021         * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
2022         (BFD32_BACKENDS_CFILES): Add elf-properties.c.
2023         * configure.ac (elf): Add elf-properties.lo.
2024         * Makefile.in: Regenerated.
2025         * configure: Likewise.
2026         * elf-bfd.h (elf_property_kind): New.
2027         (elf_property): Likewise.
2028         (elf_property_list): Likewise.
2029         (elf_properties): Likewise.
2030         (_bfd_elf_parse_gnu_properties): Likewise.
2031         (_bfd_elf_get_property): Likewise.
2032         (_bfd_elf_link_setup_gnu_properties): Likewise.
2033         (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
2034         and setup_gnu_properties.
2035         (elf_obj_tdata): Add properties.
2036         * elf-properties.c: New file.
2037         * elf32-i386.c (elf_i386_parse_gnu_properties): New.
2038         (elf_i386_merge_gnu_properties): Likewise.
2039         (elf_backend_parse_gnu_properties): Likewise.
2040         (elf_backend_merge_gnu_properties): Likewise.
2041         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2042         (elf_x86_64_merge_gnu_properties): Likewise.
2043         (elf_backend_parse_gnu_properties): Likewise.
2044         (elf_backend_merge_gnu_properties): Likewise.
2045         * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
2046         (elf_backend_parse_gnu_properties): Likewise.
2047         (elf_backend_setup_gnu_properties): Likewise.
2048         (elfNN_bed): Add elf_backend_parse_gnu_properties,
2049         elf_backend_merge_gnu_properties and
2050         elf_backend_setup_gnu_properties.
2051
2052 2017-03-30  Pip Cet  <pipcet@gmail.com>
2053
2054         * elf32-wasm32.c: Add relocation code, two relocs.
2055         * reloc.c: Add wasm32 relocations.
2056         * libbfd.h: Regenerate.
2057         * bfd-in2.h: Regenerate.
2058         * bfd/po/bfd.pot: Regenerate.
2059
2060 2017-03-29  Nick Clifton  <nickc@redhat.com>
2061
2062         PR binutils/18025
2063         * coff-bfd.h (struct coff_section_data): Add new fields:
2064         saved_bias and bias.
2065         * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
2066         computed for PE binaries.
2067         * dwarf2.c (scan_unit_for_symbols): Only warn once about each
2068         missing abbrev.
2069
2070 2017-03-28  Hans-Peter Nilsson  <hp@axis.com>
2071
2072         PR ld/16044
2073         * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
2074         to handle a local symbol with a hash-symbol-entry; without PLT.
2075         Add BFD_ASSERT for an incidental case with GOT entry present.
2076         (cris_elf_check_relocs): Increment PLT refcount only if the symbol
2077         isn't forced-or-set local.
2078
2079 2017-03-27  Pip Cet  <pipcet@gmail.com>
2080
2081         * wasm-module.c: New file to support WebAssembly modules.
2082         * wasm-module.h: New file to support WebAssembly modules.
2083         * doc/webassembly.texi: Start documenting wasm-module.c.
2084         * config.bfd: Add wasm_vec.
2085         * targets.c: Likewise.
2086         * configure.ac: Likewise.
2087         * Makefile.am: Add entries for wasm-module.c.
2088         * Makefile.in: Regenerate.
2089         * configure: Regenerate.
2090         * po/SRC-POTFILES.in: Regenerate.
2091
2092 2017-03-27  Pip Cet  <pipcet@gmail.com>
2093
2094         * cpu-wasm32.c: New file to support wasm32 architecture.
2095         * elf32-wasm32.c: New file to support wasm32 architecture.
2096         * Makefile.am: Add wasm32 architecture.
2097         * archures.c: Likewise.
2098         * config.bfd: Likewise.
2099         * configure.ac: Likewise.
2100         * targets.c: Likewise.
2101         * Makefile.in: Regenerate.
2102         * bfd-in2.h: Regenerate.
2103         * configure: Regenerate.
2104         * po/SRC-POTFILES.in: Regenerate.
2105
2106 2017-03-20  Alan Modra  <amodra@gmail.com>
2107
2108         PR 21266
2109         * elf64-ppc.c (compare_symbols): Stabilize sort.
2110
2111 2017-03-18  Alan Modra  <amodra@gmail.com>
2112
2113         * elf64-ppc.c (struct ppc_link_hash_table): Add
2114         local_ifunc_resolver and maybe_local_ifunc_resolver.
2115         (ppc_build_one_stub): Set flags on emitting dynamic
2116         relocation to ifunc.
2117         (ppc64_elf_relocate_section): Likewise.
2118         (ppc64_elf_finish_dynamic_symbol): Likewise.
2119         (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
2120         local dynamic relocs to ifuncs.
2121         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
2122         local_ifunc_resolver and maybe_local_ifunc_resolver.
2123         (ppc_elf_relocate_section): Set flag on emitting dynamic
2124         relocation to ifuncs.
2125         (ppc_elf_finish_dynamic_symbol): Likewise.
2126         (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
2127         dynamic relocs to ifuncs.
2128
2129 2017-03-13  Nick Clifton  <nickc@redhat.com>
2130
2131         PR binutils/21202
2132         * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
2133         BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
2134         (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
2135         BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
2136         * bfd-in2.h: Regenerate.
2137         * libbfd.h: Regenerate.
2138         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
2139         names.
2140         (IS_AARCH64_TLSDESC_RELOC): Likewise.
2141         (elfNN_aarch64_howto_table): Likewise.
2142         (aarch64_tls_transition_without_check): Likewise.
2143         (aarch64_reloc_got_type): Likewise.
2144         (elfNN_aarch64_final_link_relocate): Likewise.
2145         (elfNN_aarch64_tls_relax): Likewise.
2146         (elfNN_aarch64_relocate_section): Likewise.
2147         (elfNN_aarch64_gc_sweep_hook): Likewise.
2148         (elfNN_aarch64_check_relocs): Likewise.
2149         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
2150         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2151
2152 2017-03-11  Alan Modra  <amodra@gmail.com>
2153
2154         * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
2155         parameter is in fact used.  Whitespace fixes.
2156         * elf64-ppc.c: Likewise.
2157
2158 2017-03-09  Sam Thursfield  <sam.thursfield@codethink.co.uk>
2159
2160         * rs6000-core.c (CORE_NEW): Simplify macro when
2161         AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
2162
2163 2017-03-07  Alan Modra  <amodra@gmail.com>
2164
2165         PR 21224
2166         PR 20519
2167         * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
2168         dyn_relocs check.
2169
2170 2017-03-05  Alan Modra  <amodra@gmail.com>
2171
2172         * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
2173         * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
2174         (next_cie_fde_offset): New function.
2175         (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
2176         (_bfd_elf_discard_section_eh_frame): Align zero terminator to
2177         four bytes.  Align CIEs to four or eight bytes depending on
2178         per_encoding_aligned8.  Align FDEs according to their encoding.
2179         Pad last FDE to output section alignment.
2180         (_bfd_elf_write_section_eh_frame): Adjust to suit.  Remove
2181         assertion.
2182         * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
2183         (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
2184         (ppc64_elf_finish_dynamic_sections): Adjust to suit.
2185
2186 2017-03-02  Martin Bickel  <binutils@ineranves.de>
2187
2188         PR ld/21212
2189         * elf.c (rewrite_elf_program_header): Do not issue a warning for
2190         empty segments which have a zero filesz, but a non-zero memsz.
2191
2192 2017-03-02  Alan Modra  <amodra@gmail.com>
2193
2194         * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
2195
2196 2017-02-28  Alan Modra  <amodra@gmail.com>
2197
2198         * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
2199         (ppc64_elf_relocate_section): Likewise.
2200
2201 2017-02-28  Alan Modra  <amodra@gmail.com>
2202
2203         PR 20995
2204         * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
2205         rather than elf32_nios2_hash_table or elf_hash_table.
2206         (create_got_section): Likewise.
2207         (nios2_elf32_finish_dynamic_symbol): Likewise.
2208         (nios2_elf32_adjust_dynamic_symbol): Likewise.
2209         (nios2_elf32_size_dynamic_sections): Likewise.
2210         (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
2211         vars.  Use htab equivalents directly instead.  Don't create
2212         all dynamic sections on needing just the GOT.  Use a goto
2213         rather than a fall-through with reloc test.  Ensure
2214         htab->dynobj is set when making dynamic sreloc section.
2215         (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
2216         equivalent directly instead.  Don't segfault on looking for
2217         .dynamic when dynamic sections have not been created.  Don't
2218         segfault on .got.plt being discarded.
2219         (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
2220         Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
2221         fixme and another not so relevant comment.
2222         (nios2_elf_add_symbol_hook): Delete dynobj var.  If not
2223         already set, set hash table dynobj on creating .sbss.
2224
2225 2017-02-28  Alan Modra  <amodra@gmail.com>
2226
2227         * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
2228         * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
2229         (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
2230         (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
2231         (ppc64_elf_relocate_section): Likewise.
2232         * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
2233         (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
2234         (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
2235         * libbfd.h: Regenerate.
2236         * bfd-in2.h: Regenerate.
2237
2238 2017-02-28  Alan Modra  <amodra@gmail.com>
2239
2240         * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
2241         dynamic .data.rel.ro read-only.
2242         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
2243         rather than section flags when deciding where copy reloc goes.
2244         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
2245         * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
2246         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
2247         * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
2248         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
2249         * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
2250         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
2251         * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
2252         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
2253         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
2254         * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
2255         * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
2256         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
2257         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
2258         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
2259         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
2260         * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
2261         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
2262         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
2263
2264 2017-02-28  Maciej W. Rozycki  <macro@imgtec.com>
2265
2266         * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
2267         `jalr $0, $25' instruction encoding.
2268
2269 2017-02-27  Nick Clifton  <nickc@redhat.com>
2270
2271         PR ld/21180
2272         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
2273         generating a seg-fault when encountering a symbol that has been
2274         deleted by garbage collection.
2275
2276 2017-02-25  Alan Modra  <amodra@gmail.com>
2277
2278         * elf32-arc.c (struct dynamic_sections): Delete.
2279         (enum dyn_section_types): Delete.
2280         (dyn_section_names): Delete.
2281         (arc_create_dynamic_sections): Delete.
2282         (elf_arc_finish_dynamic_sections): Don't call the above.  Don't
2283         segfault on discarded .rela.plt section.
2284         (elf_arc_size_dynamic_sections): Formatting.  Don't call
2285         arc_create_dynamic_sections.  Don't allocate memory for sections
2286         handled by the generic linker.  Correct code finding relocs in
2287         read-only sections.  Set SEC_EXCLUDE on zero size .got,
2288         .got.plt, and .dynbss sections.  Do set .interp for pies.
2289
2290 2017-02-24  Andrew Waterman  <andrew@sifive.com>
2291
2292         * elfnn-riscv.c (GP_NAME): New macro.
2293         (riscv_global_pointer_value): Use it.
2294         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
2295         output section, consider only that section's alignment.
2296
2297 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
2298
2299         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
2300         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
2301         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
2302         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
2303
2304 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
2305
2306         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
2307         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
2308         or misaligned.
2309
2310 2017-02-23  Alan Modra  <amodra@gmail.com>
2311
2312         PR 20744
2313         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
2314         16D relocations.
2315         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
2316         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
2317         relocs.
2318
2319 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
2320
2321         PR ld/20828
2322         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
2323         processing ahead of the call to `elf_gc_sweep_symbol'.
2324
2325 2017-02-22  Nick Clifton  <nickc@redhat.com>
2326
2327         PR binutils/21193
2328         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
2329         created section 4-byte alignment.
2330
2331 2017-02-22  Alan Modra  <amodra@gmail.com>
2332
2333         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
2334         on .got or .plt output section being discarded by script.
2335         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
2336         vxworks splt temp.
2337
2338 2017-02-21  Alan Modra  <amodra@gmail.com>
2339
2340         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
2341         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
2342
2343 2017-02-20  Alan Modra  <amodra@gmail.com>
2344
2345         PR 21181
2346         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
2347         if DT_RELSZ/DT_RELASZ is zero.
2348
2349 2017-02-17  Nick Clifton  <nickc@redhat.com>
2350
2351         * compress.c (bfd_get_full_section_contents): Remember to reduce
2352         compressed size by the sizeof the compression header when
2353         decompressing the contents.
2354
2355 2017-02-17  Pedro Alves  <palves@redhat.com>
2356
2357         * srec.c (Chunk): Rename to ...
2358         (_bfd_srec_len): ... this.
2359         (S3Forced): Rename to ...
2360         (_bfd_srec_forceS3): ... this.
2361         * objcopy.c: Adjust all references.
2362
2363 2017-02-17  Pedro Alves  <palves@redhat.com>
2364
2365         * archive.c (bsd_write_armap): Rename to ...
2366         (_bfd_bsd_write_armap): ... this.
2367         (coff_write_armap): Rename to ...
2368         (_bfd_coff_write_armap): ... this.
2369         * libbfd-in.h (bsd_write_armap): Rename to ...
2370         (_bfd_bsd_write_armap): ... this.
2371         (coff_write_armap): Rename to ...
2372         (_bfd_coff_write_armap): ... this.
2373         * aout-target.h, aout-tic30.c: Adjust all users.
2374         * libbfd.h: Regenerate.
2375
2376 2017-02-17  Pedro Alves  <palves@redhat.com>
2377
2378         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
2379         (warn_deprecated): Rename to ...
2380         (_bfd_warn_deprecated): ... this.
2381         * libbfd.c (warn_deprecated): Rename to ...
2382         (_bfd_warn_deprecated): ... this.
2383         * bfd-in2.h: Regenerate.
2384
2385 2017-02-17  Pedro Alves  <palves@redhat.com>
2386
2387         * bfdio.c (real_ftell): Rename to ...
2388         (_bfd_real_ftell): ... this.
2389         (real_fseek): Rename to ...
2390         (_bfd_real_fseek): ... this.
2391         (real_fopen): Rename to ...
2392         (_bfd_real_fopen): ... this.
2393         * libbfd-in.h (real_ftell): Rename to ...
2394         (_bfd_real_ftell): ... this.
2395         (real_fseek): Rename to ...
2396         (_bfd_real_fseek): ... this.
2397         (real_fopen): Rename to ...
2398         (_bfd_real_fopen): ... this.
2399         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
2400         * libbfd.h: Regenerate.
2401
2402 2017-02-17  Pedro Alves  <palves@redhat.com>
2403
2404         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
2405         * libbfd.c (read_unsigned_leb128): Rename to ...
2406         (_bfd_read_unsigned_leb128): ... this.
2407         (read_signed_leb128): Rename to ...
2408         (_bfd_read_signed_leb128): ... this.
2409         (safe_read_leb128): Rename to ...
2410         (_bfd_safe_read_leb128): ... this.
2411         * libbfd-in.h (read_unsigned_leb128): Rename to ...
2412         (_bfd_read_unsigned_leb128): ... this.
2413         (read_signed_leb128): Rename to ...
2414         (_bfd_read_signed_leb128): ... this.
2415         (safe_read_leb128): Rename to ...
2416         (_bfd_safe_read_leb128): ... this.
2417         * libbfd.h: Renegerate.
2418
2419 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
2420
2421         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
2422         before trying to fine matching file and line information.
2423
2424 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
2425
2426         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
2427         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
2428         not match current bfd, then reload debug information.  Record bfd
2429         we're loading debug info for in the stash.  If we have debug
2430         informatin in the cache then perform section placement before
2431         returning.
2432
2433 2017-02-16  Alan Modra  <amodra@gmail.com>
2434
2435         PR 21000
2436         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
2437         * elfxx-target.h (elf_backend_no_page_alias): Define.
2438         (elfNN_bed): Init new field.
2439         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
2440         ensure PT_LOAD segment starts on a new page.
2441         * elf32-hppa.c (elf_backend_no_page_alias): Define.
2442
2443 2017-02-16  Alan Modra  <amodra@gmail.com>
2444
2445         PR 21132
2446         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
2447         if pic.
2448
2449 2017-02-16  Jiong Wang <jiong.wang@arm.com>
2450
2451         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
2452         * bfd-in2.h: Regenerated.
2453
2454 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
2455
2456         PR ld/21168
2457         * elf32-i386.c (elf_i386_relocate_section): Allow
2458         "lea foo@GOT, %reg" in PIC.
2459
2460 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
2461
2462         PR ld/20244
2463         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
2464         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
2465         error against local IFUNC symbol without a base register for
2466         PIC.
2467
2468 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
2469
2470         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
2471         `%P: %H:' with `info->callbacks->einfo'.
2472         (ppc_elf_relocate_section): Likewise.
2473         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
2474         (ppc64_elf_edit_toc): Likewise.
2475         (ppc64_elf_relocate_section): Likewise.
2476
2477 2017-02-14  Alan Modra  <amodra@gmail.com>
2478
2479         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
2480         --gc-keep-exported, and test versioned field of sym rather than
2481         looking for @ in name.
2482
2483 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
2484
2485         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
2486         __global_pointer$.
2487
2488 2017-02-13  Nick Clifton  <nickc@redhat.com>
2489
2490         PR binutils/21151
2491         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
2492         unit length field.
2493
2494 2017-02-07  Andrew Waterman  <andrew@sifive.com>
2495
2496         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
2497         entry size if PLT header is written.
2498
2499 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
2500
2501         Fix sparc64 dynamic relocation processing to use the dynamic
2502         symbol count.
2503         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
2504         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
2505         should be used.
2506
2507 2017-02-03  Nick Clifton  <nickc@redhat.com>
2508
2509         PR 21096
2510         * coffcode.h (coff_write_object_contents): Enlarge size of
2511         s_name_buf in order to avoid compile time warning about possible
2512         integer truncation.
2513         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
2514         32-bits of insn value before printing into buffer.
2515
2516 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2517
2518         * elfxx-mips.c (mips_elf_hash_sort_data): Add
2519         `max_local_dynindx'.
2520         (mips_elf_sort_hash_table): Handle it.
2521         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
2522         symbols bump up `max_local_dynindx' rather than
2523         `max_non_got_dynindx'.
2524
2525 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2526
2527         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
2528         `min_got_dynindx', `max_unref_got_dynindx' and
2529         `max_non_got_dynindx' members to the `bfd_size_type' data type.
2530         (mips_elf_sort_hash_table): Adjust accordingly.
2531
2532 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2533
2534         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
2535         to access the hash table.
2536
2537 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2538
2539         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
2540         non-NULL `htab' to the beginning.
2541
2542 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2543
2544         * elflink.c (elf_gc_sweep): Wrap overlong line.
2545
2546 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
2547
2548         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
2549         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
2550         * elfxx-mips.c (mips_elf_link_hash_table): Add
2551         `ignore_branch_isa' member.
2552         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
2553         in branch relocation calculation as an error if
2554         `ignore_branch_isa' has been set.
2555         (_bfd_mips_elf_insn32): Rename to...
2556         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
2557         parameter to `insn32' and add an `ignore_branch_isa' parameter.
2558         Handle the new parameter.
2559
2560 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
2561
2562         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
2563         local variable dynobj.
2564
2565         PR ld/20995
2566         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
2567         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
2568         executable from read-only sections into sdynrelro.
2569         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
2570         dynamic relocs in sdynrelro.
2571         (elf_backend_want_dynrelro): Define.
2572
2573 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2574
2575         * config.bfd (*-*-rtemsaout*): Mark as removed.
2576
2577 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2578
2579         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
2580         (arm-*-rtems*): Move to (arm*-*-eabi*).
2581         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
2582         (m68-*-rtems*): Move to (m68*-*-elf*).
2583
2584 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2585
2586         * config.bfd (*-*-rtemscoff*): Mark as removed.
2587
2588 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
2589
2590         PR ld/20828
2591         * elflink.c (bfd_elf_record_link_assignment): Revert last
2592         change and don't ever clear `forced_local'.  Set `mark'
2593         unconditionally.
2594         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
2595         file.
2596         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
2597         (bfd_elf_size_dynamic_sections): ... here.
2598         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
2599         and set `mark' instead in `__tls_get_addr_opt' processing.
2600         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
2601
2602 2017-01-24  Alan Modra  <amodra@gmail.com>
2603
2604         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
2605         where dynamic relocs are preferable.  Allow ifunc too.
2606         (ensure_undefweak_dynamic): New function.
2607         (allocate_dynrelocs): Use it here.  Move plt handling last and
2608         don't make symbols dynamic, simplifying loop.  Only make undef
2609         weak symbols with GOT entries dynamic.  Correct condition
2610         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
2611         comments.  Remove goto.
2612         (ppc_elf_relocate_section): Correct test for using dynamic
2613         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
2614         to suit.  Set up explicit tls_index entries and implicit GOT
2615         tls_index entries resolvable at link time for
2616         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
2617         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
2618         (ensure_undefweak_dynamic): New function.
2619         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
2620         with GOT entries dynamic.  Remove unnecessary test of
2621         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
2622         (ppc64_elf_relocate_section): Correct test for using dynamic
2623         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
2624         to suit.  Set up explicit tls_index entries and implicit GOT
2625         tls_index entries resolvable at link time for __tls_get_addr_opt.
2626         Simplify expression to clear mem for prelink.
2627
2628 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
2629
2630         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
2631
2632 2017-01-20  Jiong Wang <jiong.wang@arm.com>
2633
2634         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
2635         (elf_backend_hash_symbol): Define.
2636
2637 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
2638
2639         PR ld/20828
2640         * elflink.c (bfd_elf_record_link_assignment): Clear any
2641         `forced_local' marking for DSO symbols that are not being
2642         provided.
2643
2644 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
2645
2646         * elfnn-riscv.c (riscv_elf_object_p): New function.
2647
2648 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
2649
2650         PR ld/21038
2651         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
2652         plt_bnd_eh_frame.
2653         (elf_x86_64_check_relocs): Create .eh_frame section for the
2654         .plt.bnd section.
2655         (elf_x86_64_size_dynamic_sections): Allocate and initialize
2656         .eh_frame section for the .plt.bnd section.
2657         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
2658         for the .plt.bnd section.
2659
2660 2017-01-12  Nick Clifton  <nickc@redhat.com>
2661
2662         PR binutils/20876
2663         * opncls.c (find_separate_debug_file): Add include_dirs
2664         parameter.  Only include the directory part of the bfd's filename
2665         in search paths if include_dirs is true.  Add a couple of extra
2666         locations for looking for debug files.
2667         ( bfd_follow_gnu_debuglink): Update invocation of
2668         find_separate_debug_file.
2669         (bfd_follow_gnu_debugaltlink): Likewise.
2670         (get_build_id): New function: Finds the build-id of the given bfd.
2671         (get_build_id_name): New function: Computes the name of the
2672         separate debug info file for a bfd, based upon its build-id.
2673         (check_build_id_file): New function: Checks to see if a separate
2674         debug info file exists at the given location, and that its
2675         build-id matches that of the original bfd.
2676         (bfd_follow_build_id_debuglink): New function: Finds a separate
2677         debug info file for a given bfd by using the build-id method.
2678         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
2679         method of locating a separate debug info file before using the
2680         debuglink method.
2681         * bfd-in2.h: Regenerate.
2682
2683 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
2684
2685         PR ld/21038
2686         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
2687         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
2688         elf_x86_64_eh_frame_plt_got.
2689         (elf_x86_64_size_dynamic_sections): Get unwind info from
2690         elf_x86_64_bnd_arch_bed for the BND PLT.
2691
2692 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
2693
2694         * config.bfd: Add entries for i686-redox and x86_64-redox.
2695
2696 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2697
2698         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
2699         to 4 bytes.
2700         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
2701         .eh_frame section to 4 bytes for x32.
2702         (elf_x86_64_check_relocs): Likewise.
2703
2704 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2705
2706         PR ld/20830
2707         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
2708         (PLT_GOT_FDE_LENGTH): Likewise.
2709         (elf_i386_plt_layout): Add eh_frame_plt_got and
2710         eh_frame_plt_got_size.
2711         (elf_i386_plt): Updated.
2712         (elf_i386_link_hash_table): Add plt_got_eh_frame.
2713         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
2714         (elf_i386_size_dynamic_sections): Allocate and initialize
2715         .eh_frame section for .plt.got.
2716         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
2717         .plt.got.
2718         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
2719         eh_frame_plt_got_size.
2720         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
2721         (PLT_GOT_FDE_LENGTH): Likewise.
2722         (elf_x86_64_backend_data): Add eh_frame_plt_got and
2723         eh_frame_plt_got_size.
2724         (elf_x86_64_arch_bed): Updated.
2725         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
2726         eh_frame_plt_got_size.
2727         (elf_x86_64_nacl_arch_bed): Likewise.
2728         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
2729         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
2730         (elf_x86_64_size_dynamic_sections): Allocate and initialize
2731         .eh_frame section for .plt.got.
2732         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
2733         for .plt.got.
2734
2735 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2736
2737         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
2738         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
2739
2740 2017-01-09  Nick Clifton  <nickc@redhat.com>
2741
2742         * dwarf2.c (lookup_address_in_function_table): Return early if
2743         there are no functions in the given comp unit, or if the high
2744         address of the last function in the comp unit is less than the
2745         desired address.
2746
2747 2017-01-09  Nick Clifton  <nickc@redhat.com>
2748
2749         PR binutils/21013
2750         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
2751         message if there are too many symbols to load.
2752
2753 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
2754
2755         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
2756         if relocs are cached.
2757
2758 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
2759
2760         PR ld/21017
2761         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
2762         for R_MICROBLAZE_GOTOFF_64.
2763
2764 2017-01-03  Nick Clifton  <nickc@redhat.com>
2765
2766         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
2767         warning about using a possibly uninitialised variable.
2768
2769 2017-01-02  Alan Modra  <amodra@gmail.com>
2770
2771         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
2772         (allocate_plt_static, allocate_dynrelocs): Use it.
2773
2774 2017-01-02  Alan Modra  <amodra@gmail.com>
2775
2776         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
2777         .PARISC.unwind section.
2778
2779 2017-01-02  Alan Modra  <amodra@gmail.com>
2780
2781         PR ld/20989
2782         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
2783         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
2784         indirect to GOT pointer relative code edit.
2785
2786 2017-01-02  Alan Modra  <amodra@gmail.com>
2787
2788         Update year range in copyright notice of all files.
2789
2790 For older changes see ChangeLog-2016
2791 \f
2792 Copyright (C) 2017 Free Software Foundation, Inc.
2793
2794 Copying and distribution of this file, with or without modification,
2795 are permitted in any medium without royalty provided the copyright
2796 notice and this notice are preserved.
2797
2798 Local Variables:
2799 mode: change-log
2800 left-margin: 8
2801 fill-column: 74
2802 version-control: never
2803 End: