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