fca37c0da5d47bdd479ef245758aa2ae504f3030
[external/binutils.git] / bfd / ChangeLog
1 2017-11-01  Alan Modra  <amodra@gmail.com>
2
3         PR 22374
4         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Don't create a plt
5         entry when just a dynamic reloc can serve.  Ensure no dynamic
6         relocations when UNDEFWEAK_NO_DYNAMIC_RELOC by setting non_got_ref.
7         Expand and move the non_got_ref comment.
8         * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
9
10 2017-10-31  Nick Clifton  <nickc@redhat.com>
11
12         PR 22373
13         * peicode.h (pe_bfd_read_buildid): Check for invalid size and data
14         offset values.
15
16 2017-10-30  Alan Modra  <amodra@gmail.com>
17
18         * elf32-frv.c (ELF_TARGET_ID): Don't define for generic
19         elf target.
20
21         * elflink.c (elf_gc_sweep): Test elf_object_id in addition to
22         relocs_compatible.
23         (bfd_elf_gc_sections): Likewise.
24
25 2017-10-30  Alan Modra  <amodra@gmail.com>
26
27         PR 22269
28         * elf32-hppa.c (elf32_hppa_check_relocs): Move SEC_ALLOC test to
29         ensure non_got_ref is not set due to debug references.
30         (elf32_hppa_adjust_dynamic_symbol): Tidy plabel handling.  Use
31         SYMBOL_CALLS_LOCAL and UNDEFWEAK_NO_DYNAMIC_RELOC when determining
32         need for a plt entry.
33         (allocate_dynrelocs): Similarly for got entries.  Tidy code discarding
34         dynamic relocs when pic.  Remove bogus code attempting to handle
35         commons.
36         (elf32_hppa_relocate_section): Similarly.  Delete resolved_to_zero
37         and simplify.
38         (elf32_hppa_finish_dynamic_symbol): Use UNDEFWEAK_NO_DYNAMIC_RELOC
39         and SYMBOL_REFERENCES_LOCAL in GOT handling.
40
41 2017-10-28  Alan Modra  <amodra@gmail.com>
42
43         PR 22300
44         * elflink.c (_bfd_elf_merge_symbol): Remove relocs_compatible check.
45         * elf32-hppa.c (elf_backend_relocs_compatible): Define.
46         * elf32-ppc.c (elf_backend_relocs_compatible): Define.
47         * elf64-ppc.c (elf_backend_relocs_compatible): Define.
48
49 2017-10-25  Alan Modra  <amodra@gmail.com>
50
51         * archive.c (_bfd_compute_and_write_armap): Match "__gnu_lto_slim"
52         optionally prefixed with "_".
53         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
54
55 2017-10-24  Andrew Waterman  <andrew@sifive.com>
56
57         * elfnn-riscv.c (_bfd_riscv_relax_lui): Don't relax to c.lui
58         when rd is x0.
59
60 2017-10-24  Renlin Li  <renlin.li@arm.com>
61
62         PR ld/21703
63         * elflink.c (_bfd_elf_merge_symbol): Handle multiple definition case.
64
65 2017-10-23  Nick Clifton  <nickc@redhat.com>
66
67         PR 22319
68         * elflink.c (elf_link_output_extsym): Keep global undefined
69         symbols if they have been marked as needed.
70
71 2017-10-23  Maciej W. Rozycki  <macro@imgtec.com>
72
73         * elfn32-mips.c (mips_elf_n32_mkobject): New prototype and
74         function.
75         (bfd_elf32_mkobject): Use `mips_elf_n32_mkobject' rather than
76         `_bfd_mips_elf_mkobject'.
77
78 2017-10-22  Hans-Peter Nilsson  <hp@axis.com>
79
80         PR gas/22304
81         * config.bfd (cris-*-* | crisv32-*-*): Require a 64-bit BFD.
82
83 2017-10-19  Palmer Dabbelt  <palmer@dabbelt.com>
84
85         * elfnn-riscv.c (riscv_pcgp_hi_reloc): New structure.
86         (riscv_pcgp_lo_reloc): Likewise.
87         (riscv_pcgp_relocs): Likewise.
88         (riscv_init_pcgp_relocs): New function.
89         (riscv_free_pcgp_relocs): Likewise.
90         (riscv_record_pcgp_hi_reloc): Likewise.
91         (riscv_record_pcgp_lo_reloc): Likewise.
92         (riscv_delete_pcgp_hi_reloc): Likewise.
93         (riscv_use_pcgp_hi_reloc): Likewise.
94         (riscv_record_pcgp_lo_reloc): Likewise.
95         (riscv_find_pcgp_lo_reloc): Likewise.
96         (riscv_delete_pcgp_lo_reloc): Likewise.
97         (_bfd_riscv_relax_pc): Likewise.
98         (_bfd_riscv_relax_section): Handle R_RISCV_PCREL_* relocations
99         via the new functions above.
100
101 2017-10-19  Palmer Dabbelt  <palmer@dabbelt.com>
102
103         * elfnn-riscv.c (R_RISCV_DELETE): New define.
104         (_bfd_riscv_relax_delete): New function.
105         (perform_relocation): Handle R_RISCV_DELETE.
106         (_bfd_riscv_relax_section): Likewise.
107
108 2017-10-19  H.J. Lu  <hongjiu.lu@intel.com>
109
110         PR ld/22263
111         * elfxx-tilegx.c (tilegx_elf_tls_transition): Replace
112         bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
113         bfd_link_executable for TLS check.
114         (tilegx_elf_check_relocs): Likewise.
115         (allocate_dynrelocs): Likewise.
116         (tilegx_elf_relocate_section): Likewise.
117
118 2017-10-19  H.J. Lu  <hongjiu.lu@intel.com>
119
120         PR ld/22263
121         * elf32-tilepro.c (tilepro_elf_tls_transition): Replace
122         bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
123         bfd_link_executable for TLS check.
124         (tilepro_elf_check_relocs): Likewise.
125         (allocate_dynrelocs): Likewise.
126         (tilepro_elf_relocate_section): Likewise.
127
128 2017-10-19  H.J. Lu  <hongjiu.lu@intel.com>
129
130         PR ld/22263
131         * elfxx-sparc.c (sparc_elf_tls_transition): Replace
132         bfd_link_pic with !bfd_link_executable, !bfd_link_pic with
133         bfd_link_executable for TLS check.
134         (_bfd_sparc_elf_check_relocs): Likewise.
135         (allocate_dynrelocs): Likewise.
136         (_bfd_sparc_elf_relocate_section): Likewise.
137
138 2017-10-18  H.J. Lu  <hongjiu.lu@intel.com>
139
140         * elf32-tilepro.c (tilepro_elf_gc_mark_hook): Call
141         _bfd_generic_link_add_one_symbol to mark __tls_get_addr.
142         * elfxx-tilegx.c (tilegx_elf_gc_mark_hook): Likewise.
143
144 2017-10-17  H.J. Lu  <hongjiu.lu@intel.com>
145
146         * elf32-microblaze.c (microblaze_elf_check_relocs): Check for
147         indirect and warning symbols.
148
149 2017-10-17  Alan Modra  <amodra@gmail.com>
150
151         PR 22307
152         * elf-properties.c (_bfd_elf_parse_gnu_properties): Compare datasz
153         against size left rather than comparing pointers.  Reorganise loop.
154
155 2017-10-17  Alan Modra  <amodra@gmail.com>
156
157         PR 22306
158         * aoutx.h (aout_get_external_symbols): Handle stringsize of zero,
159         and error for any other size that doesn't cover the header word.
160
161 2017-10-16  H.J. Lu  <hongjiu.lu@intel.com>
162
163         * elf-bfd.h (elf_backend_data): Remove gc_sweep_hook.
164         * elf32-arm.c (elf32_arm_gc_sweep_hook): Removed.
165         (elf_backend_gc_sweep_hook): Likewise.
166         * elf32-bfin.c (bfin_gc_sweep_hook): Likewise.
167         (bfinfdpic_gc_sweep_hook): Likewise.
168         (elf_backend_gc_sweep_hook): Likewise.
169         * elf32-cr16.c (elf32_cr16_gc_sweep_hook): Likewise.
170         (elf_backend_gc_sweep_hook): Likewise.
171         * elf32-cris.c (cris_elf_gc_sweep_hook): Likewise.
172         (elf_backend_gc_sweep_hook): Likewise.
173         * elf32-hppa.c (elf32_hppa_gc_sweep_hook): Likewise.
174         (elf_backend_gc_sweep_hook): Likewise.
175         * elf32-lm32.c (lm32_elf_gc_sweep_hook): Likewise.
176         (elf_backend_gc_sweep_hook): Likewise.
177         * elf32-m32r.c (m32r_elf_gc_sweep_hook): Likewise.
178         (elf_backend_gc_sweep_hook): Likewise.
179         * elf32-m68k.c (elf_m68k_got_entry): Remove elf_m68k_gc_sweep_hook
180         from comments.
181         (elf_m68k_remove_got_entry_type): Removed.
182         (elf_m68k_find_got_entry_ptr): Likewise.
183         (elf_m68k_remove_got_entry): Likewise.
184         (elf_m68k_gc_sweep_hook): Likewise.
185         (elf_backend_gc_sweep_hook): Likewise.
186         * elf32-mcore.c (mcore_elf_gc_sweep_hook): Likewise.
187         (elf_backend_gc_sweep_hook): Likewise.
188         * elf32-metag.c (elf_metag_gc_sweep_hook): Likewise.
189         (elf_backend_gc_sweep_hook): Likewise.
190         * elf32-microblaze.c (elf_backend_gc_sweep_hook): Likewise.
191         (elf_backend_gc_sweep_hook): Likewise.
192         * elf32-mips.c (elf_backend_gc_sweep_hook): Likewise.
193         (elf_backend_gc_sweep_hook): Likewise.
194         * elf32-nds32.c (nds32_elf_gc_sweep_hook): Likewise.
195         (elf_backend_gc_sweep_hook): Likewise.
196         * elf32-nios2.c (nios2_elf32_gc_sweep_hook): Likewise.
197         (elf_backend_gc_sweep_hook): Likewise.
198         * elf32-or1k.c (or1k_elf_gc_sweep_hook): Likewise.
199         (elf_backend_gc_sweep_hook): Likewise.
200         * elf32-ppc.c (ppc_elf_gc_sweep_hook): Likewise.
201         (elf_backend_gc_sweep_hook): Likewise.
202         * elf32-s390.c (elf_s390_gc_sweep_hook): Likewise.
203         (elf_backend_gc_sweep_hook): Likewise.
204         * elf32-sparc.c (elf_backend_gc_sweep_hook): Likewise.
205         * elf32-tic6x.c (elf32_tic6x_gc_sweep_hook): Likewise.
206         (elf_backend_gc_sweep_hook): Likewise.
207         * elf32-tilegx.c (elf_backend_gc_sweep_hook): Likewise.
208         * elf32-tilepro.c (tilepro_elf_gc_sweep_hook): Likewise.
209         (elf_backend_gc_sweep_hook): Likewise.
210         * elf32-vax.c (elf_vax_gc_sweep_hook): Likewise.
211         (elf_backend_gc_sweep_hook): Likewise.
212         * elf32-xtensa.c (elf_xtensa_gc_sweep_hook): Likewise.
213         (elf_backend_gc_sweep_hook): Likewise.
214         * elf64-alpha.c (elf64_alpha_gc_sweep_hook): Likewise.
215         (elf_backend_gc_sweep_hook): Likewise.
216         * elf64-mips.c (elf_backend_gc_sweep_hook): Likewise.
217         * elf64-mmix.c (mmix_elf_gc_sweep_hook): Likewise.
218         (elf_backend_gc_sweep_hook): Likewise.
219         * elf64-ppc.c (elf_backend_gc_sweep_hook): Likewise.
220         (ppc64_elf_gc_sweep_hook): Likewise.
221         * elf64-s390.c (elf_s390_gc_sweep_hook): Likewise.
222         (elf_backend_gc_sweep_hook): Likewise.
223         * elf64-sparc.c (elf_backend_gc_sweep_hook): Likewise.
224         * elf64-tilegx.c (elf_backend_gc_sweep_hook): Likewise.
225         * elflink.c (elf_link_add_object_symbols): Don't call
226         _bfd_elf_link_check_relocs here.
227         (gc_sweep_hook_fn): Removed.
228         (elf_gc_sweep): Remove gc_sweep_hook.
229         * elfnn-aarch64.c (elfNN_aarch64_gc_sweep_hook): Removed.
230         (elf_backend_gc_sweep_hook): Likewise.
231         * elfnn-riscv.c (riscv_elf_gc_sweep_hook): Likewise.
232         (elf_backend_gc_sweep_hook): Likewise.
233         * elfxx-mips.c (_bfd_mips_elf_gc_sweep_hook): Likewise.
234         * elfxx-mips.h (_bfd_mips_elf_gc_sweep_hook): Likewise.
235         (elf_backend_gc_sweep_hook): Likewise.
236         * elfxx-sparc.c (_bfd_sparc_elf_gc_sweep_hook): Likewise.
237         * elfxx-sparc.h (_bfd_sparc_elf_gc_sweep_hook): Likewise.
238         * elfxx-target.h (elf_backend_gc_sweep_hook): Likewise.
239         (elfNN_bed): Remove elf_backend_gc_sweep_hook.
240         * elfxx-tilegx.c (tilegx_elf_gc_sweep_hook): Removed.
241         * elfxx-tilegx.h (tilegx_elf_gc_sweep_hook): Likewise.
242
243 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
244
245         * elf32-i386.c (elf_i386_backend_data): Removed.
246         (get_elf_i386_backend_data): Likewise.
247         (elf_i386_arch_bed): Replace elf_i386_backend_data with
248         elf_x86_backend_data.
249         (elf_i386_get_synthetic_symtab): Likewise.
250         (elf_i386_nacl_arch_bed): Likewise.
251         (elf_i386_vxworks_arch_bed): Likewise.
252         (elf_i386_relocate_section): Check target_os instead of
253         is_vxworks.
254         (elf_i386_finish_dynamic_symbol): Likewise.
255         (elf_i386_finish_dynamic_sections): Use htab->plt0_pad_byte.
256         Check target_os instead of is_vxworks.
257         (elf_i386_link_setup_gnu_properties): Remove normal_target and
258         is_vxworks.  Initialize plt0_pad_byte.
259         * elf64-x86-64.c (elf_x86_64_backend_data); Removed.
260         (get_elf_x86_64_arch_data): Likewise.
261         (get_elf_x86_64_backend_data): Likewise.
262         (elf_x86_64_arch_bed): Replace elf_x86_64_backend_data with
263         elf_x86_backend_data.
264         (elf_x86_64_get_synthetic_symtab): Likewise.
265         (elf_x86_64_nacl_arch_bed): Likewise.
266         (elf_x86_64_link_setup_gnu_properties): Remove is_vxworks and
267         normal_target.  Initialize plt0_pad_byte.
268         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Check target_os
269         instead of is_vxworks.
270         (_bfd_x86_elf_size_dynamic_sections): Likewise.
271         (_bfd_x86_elf_finish_dynamic_sections): Likewise.
272         (_bfd_x86_elf_adjust_dynamic_symbol): Likewise.
273         (_bfd_x86_elf_link_hash_table_create): Initialize target_os.
274         (_bfd_x86_elf_link_setup_gnu_properties): Remove is_vxworks.
275         Update normal_target.  Set up plt0_pad_byte.  Check target_os
276         instead of is_vxworks.
277         * elfxx-x86.h (elf_x86_target_os): New.
278         (elf_x86_backend_data): Likewise.
279         (get_elf_x86_backend_data): Likewise.
280         (elf_x86_link_hash_table): Remove is_vxworks.  Add plt0_pad_byte
281         and target_os.
282         (elf_x86_init_table): Remove normal_target and is_vxworks.  Add
283         plt0_pad_byte.
284
285 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
286
287         * elf32-i386.c (elf_i386_finish_dynamic_sections): Call
288         _bfd_x86_elf_finish_dynamic_sections.
289         * elf64-x86-64.c (elf_x86_64_finish_dynamic_sections): Likewise.
290         * elfxx-x86.c (_bfd_x86_elf_finish_dynamic_sections): New
291         function.
292         * elfxx-x86.h (_bfd_x86_elf_finish_dynamic_sections): New
293         prototype.
294
295 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
296
297         PR ld/21384
298         * elf32-cris.c (elf_cris_discard_excess_program_dynamics): Don't
299         hide symbol which was forced to be dynamic.
300
301 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
302
303         PR ld/22269
304         * elf32-cris.c (cris_elf_relocate_section): Don't generate
305         dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
306         (cris_elf_check_relocs): Don't allocate dynamic relocation
307         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
308
309 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
310
311         PR ld/22269
312         * elf32-sh.c (allocate_dynrelocs): Discard dynamic relocations
313         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
314         (sh_elf_relocate_section): Don't generate dynamic relocation if
315         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
316
317 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
318
319         PR ld/22269
320         * elf32-s390.c (allocate_dynrelocs): Discard dynamic
321         relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
322         (elf_s390_relocate_section): Don't generate dynamic relocation
323         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
324         * elf64-s390.c (allocate_dynrelocs): Discard dynamic
325         relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
326         (elf_s390_relocate_section): Don't generate dynamic relocation
327         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
328
329 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
330
331         PR ld/22269
332         * elf32-nios2.c (nios2_elf32_relocate_section): Don't generate
333         dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
334         (allocate_dynrelocs): Discard dynamic relocations if
335         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
336
337 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
338
339         PR ld/22269
340         * elf32-microblaze.c (microblaze_elf_relocate_section): Don't
341         generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is
342         true.
343         (allocate_dynrelocs): Discard dynamic relocations if
344         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
345
346 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
347
348         PR ld/22269
349         * elf32-m68k.c (elf_m68k_check_relocs): Don't allocate dynamic
350         relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
351         (elf_m68k_adjust_dynamic_symbol): Don't make symbol dynamic if
352         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
353         (elf_m68k_relocate_section): Don't generate dynamic relocation
354         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
355
356 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
357
358         PR ld/22269
359         * elf32-hppa.c (ensure_undef_dynamic): Don't make undefined
360         symbol dynamic if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
361         (allocate_dynrelocs): Discard dynamic relocations if
362         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
363         (elf32_hppa_relocate_section): Don't generate dynamic
364         relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
365
366 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
367
368         PR ld/22269
369         * elfnn-ia64.c (elfNN_ia64_check_relocs): Don't allocate
370         dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
371         (allocate_fptr): Don't allocate function pointer if
372         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
373         (allocate_dynrel_entries): Don't allocate dynamic relocation
374         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
375         (set_got_entry): Don't set GOT entry if
376         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
377         (set_pltoff_entry): Don't set PLTOFF entry if
378         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
379         (elfNN_ia64_relocate_section): Don't install dynamic relocation
380         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
381
382 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
383
384         PR ld/22269
385         * elfxx-mips.c (mips_elf_calculate_relocation): Don't generate
386         dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
387         (allocate_dynrelocs): Don't allocate dynamic relocations if
388         UNDEFWEAK_NO_DYNAMIC_RELOC is true.
389
390 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
391
392         PR ld/22269
393         * elf32-arm.c (elf32_arm_final_link_relocate): Don't generate
394         dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
395         (allocate_dynrelocs_for_symbol): Discard dynamic relocations
396         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
397
398 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
399
400         PR ld/22269
401         * elf32-tilepro.c (allocate_dynrelocs): Discard dynamic
402         relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
403         (tilepro_elf_relocate_section): Don't generate dynamic
404         relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
405         * elfxx-tilegx.c (allocate_dynrelocs): Discard dynamic
406         relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
407         (tilegx_elf_relocate_section): Don't generate dynamic
408         relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
409
410 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
411
412         PR ld/22269
413         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Don't
414         generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is
415         true.
416         (elfNN_aarch64_allocate_dynrelocs): Discard dynamic relocations
417         if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
418
419 2017-10-14  H.J. Lu  <hongjiu.lu@intel.com>
420
421         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Moved to ...
422         * elf-bfd.h (UNDEFWEAK_NO_DYNAMIC_RELOC): Here.
423         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Removed.
424
425 2017-10-12  James Bowman  <james.bowman@ftdichip.com>
426
427         * bfd-in2.h: Regenerate.
428         * libbfd.h: Regenerate.
429         * elf32-ft32.c: Add HOWTO R_FT32_15.
430         * reloc.c: Add BFD_RELOC_FT32_15.
431
432 2017-10-12  Nick Clifton  <nickc@redhat.com>
433
434         * reloc.c (enum bfd_reloc_status): Start values at 2.
435         * bfd-in2.h: Regenerate.
436         * elfnn-aarch64.c (aarch64_relocate): Invert sense of function, so
437         that a TRUE return indicates success.  Compare the result of
438         calling _bfd_aarch64_elf_put_addend against bfd_reloc_ok.
439         (build_one_stub): Change sense of tests against aarch64_relocate
440         return value.
441         (elfNN_aarch64_tls_relax): Return bfd_reloc_notsupported, rather
442         than FALSE, when an error is detected.
443         (elfNN_aarch64_final_link_relocate): Likewise.
444
445 2017-10-12  H.J. Lu  <hongjiu.lu@intel.com>
446
447         * elf32-i386.c (elf_backend_hide_symbol): New.
448         * elf64-x86-64.c (elf_backend_hide_symbol): Likewise.
449         * elfxx-x86.c (_bfd_x86_elf_hide_symbol): Likewise.
450         * elfxx-x86.h (_bfd_x86_elf_hide_symbol): Likewise.
451
452 2017-10-12  Alan Modra  <amodra@gmail.com>
453
454         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Call
455         elf_backend_hide_symbol, not _bfd_elf_link_hash_hide_symbol.
456         (bfd_elf_define_start_stop): Likewise.
457
458 2017-10-12  Alan Modra  <amodra@gmail.com>
459
460         * elf32-nds32.c (nds32_elf_size_dynamic_sections): Set .interp
461         when executable rather than non-PIC.
462         * elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
463         * elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
464
465 2017-10-11  Maciej W. Rozycki  <macro@imgtec.com>
466
467         * elf-bfd.h (elf_backend_data): Add `linux_prpsinfo64_ugid16'
468         member.
469         * elf-linux-core.h (elf_external_linux_prpsinfo64): Rename to...
470         (elf_external_linux_prpsinfo64_ugid32): ... this.
471         (swap_linux_prpsinfo32_out): Rename to...
472         (swap_linux_prpsinfo32_ugid32_out): ... this.
473         (elf_external_linux_prpsinfo64_ugid16): New structure.
474         (swap_linux_prpsinfo64_ugid16_out): New function.
475         * elfxx-target.h [!elf_backend_linux_prpsinfo64_ugid16]
476         (elf_backend_linux_prpsinfo64_ugid16): Define.
477         (elfNN_bed): Initialize `linux_prpsinfo64_ugid16' member.
478         * elf.c (elfcore_write_linux_prpsinfo64): Handle both variants
479         of the 64-bit Linux core PRPSINFO note.
480         * elf64-sh64.c (elf_backend_linux_prpsinfo64_ugid16): Define.
481
482 2017-10-11  Maciej W. Rozycki  <macro@imgtec.com>
483
484         * elf-bfd.h (elf_backend_data): Add `linux_prpsinfo32_ugid16'
485         member.
486         (elfcore_write_ppc_linux_prpsinfo32): Remove prototype.
487         * elf32-ppc.c (elfcore_write_ppc_linux_prpsinfo32): Remove.
488         (elf_external_ppc_linux_prpsinfo32)
489         (swap_ppc_linux_prpsinfo32_out): Move to...
490         * elf-linux-core.h (elf_external_linux_prpsinfo32_ugid32)
491         (swap_linux_prpsinfo32_ugid32_out): ... these.
492         (elf_external_linux_prpsinfo32): Rename to...
493         (elf_external_linux_prpsinfo32_ugid16): ... this.
494         (swap_linux_prpsinfo32_out): Rename to...
495         (swap_linux_prpsinfo32_ugid16_out): ... this.
496         * elfxx-target.h [!elf_backend_linux_prpsinfo32_ugid16]
497         (elf_backend_linux_prpsinfo32_ugid16): Define.
498         (elfNN_bed): Initialize `linux_prpsinfo32_ugid16' member.
499         * elf.c (elfcore_write_linux_prpsinfo32): Handle both variants
500         of the 32-bit Linux core PRPSINFO note.
501         * elf32-am33lin.c (elf_backend_linux_prpsinfo32_ugid16): Define.
502         * elf32-arm.c (elf_backend_linux_prpsinfo32_ugid16): Define.
503         * elf32-cris.c (elf_backend_linux_prpsinfo32_ugid16): Define.
504         * elf32-frv.c (elf_backend_linux_prpsinfo32_ugid16): Define.
505         * elf32-i386.c (elf_backend_linux_prpsinfo32_ugid16): Define.
506         * elf32-m32r.c (elf_backend_linux_prpsinfo32_ugid16): Define.
507         * elf32-m68k.c (elf_backend_linux_prpsinfo32_ugid16): Define.
508         * elf32-s390.c (elf_backend_linux_prpsinfo32_ugid16): Define.
509         * elf32-sh.c (elf_backend_linux_prpsinfo32_ugid16): Define.
510         * elf32-sparc.c (elf_backend_linux_prpsinfo32_ugid16): Define.
511
512 2017-10-11  Maciej W. Rozycki  <macro@imgtec.com>
513
514         * elf-linux-core.h (elf_external_linux_prpsinfo64): Move the
515         `gap' member ahead of `pr_flag'.
516
517 2017-10-11  Pedro Alves  <palves@redhat.com>
518
519         * bfd.c (_doprnt): Rename to ...
520         (_bfd_doprnt): ... this.
521         (error_handler_internal): Adjust.
522
523 2017-10-10  H.J. Lu  <hongjiu.lu@intel.com>
524
525         * elf32-i386.c (elf_i386_check_relocs): Set GOT refcount to 1
526         instead of incrementing it.
527         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
528
529 2017-10-10  Renlin Li  <renlin.li@arm.com>
530
531         PR ld/21402
532         * elf32-arm.c (allocate_dynrelocs_for_symbol): Only make undefined weak
533          symbols into dynamic.
534
535 2017-10-09  H.J. Lu  <hongjiu.lu@intel.com>
536
537         PR ld/22274
538         * elfnn-riscv.c (riscv_elf_link_hash_table): Add max_alignment.
539         (riscv_elf_link_hash_table_create): Initialize max_alignment to
540         (bfd_vma) -1.
541         (_bfd_riscv_relax_section): Cache the max alignment of output
542         sections if possible.
543
544 2017-10-10  Alan Modra  <amodra@gmail.com>
545
546         * elf64-ppc.c (ppc64_elf_before_check_relocs): Set sec_type for
547         .opd whenever .opd is present and non-zero size.  Move code
548         setting abiversion to/from output file earlier.  Only set
549         u.opd.func_sec when --gc-sections.  Read relocs and set up
550         u.opd.func_sec values here..
551         (ppc64_elf_check_relocs): ..rather than here.  Simplify opd
552         section tests.
553         (ppc64_elf_edit_opd): Don't set sec_type for .opd here.
554
555 2017-10-09  H.J. Lu  <hongjiu.lu@intel.com>
556
557         * elf-m10300.c (mn10300_elf_check_relocs): Don't free cached
558         isymbuf.
559
560 2017-10-09  H.J. Lu  <hongjiu.lu@intel.com>
561
562         * elf32-bfin.c (bfin_size_dynamic_sections): Don't create the
563         .interp section with "ld --no-dynamic-linker".
564
565 2017-10-09  Alan Modra  <amodra@gmail.com>
566
567         PR 22212
568         * dwarf2.c (_bfd_dwarf2_cleanup_debug_info): Free
569         funcinfo_hash_table and varinfo_hash_table.
570
571 2017-10-08  H.J. Lu  <hongjiu.lu@intel.com>
572
573         * elf32-sh.c (readonly_dynrelocs): Dump dynamic relocation
574         in read-only section with minfo.
575         (sh_elf_size_dynamic_sections): Likewise.
576
577 2017-10-08  H.J. Lu  <hongjiu.lu@intel.com>
578
579         * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Remove
580         a strayed comment.
581
582 2017-10-08  H.J. Lu  <hongjiu.lu@intel.com>
583
584         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_sections): Set
585         this_hdr.sh_entsize only if section size > 0.
586
587 2017-10-08  H.J. Lu  <hongjiu.lu@intel.com>
588
589         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Reformat.
590
591 2017-10-07  H.J. Lu  <hongjiu.lu@intel.com>
592
593         * elfxx-sparc.c (readonly_dynrelocs): Dump dynamic relocation
594         in read-only section with minfo.
595         (_bfd_sparc_elf_size_dynamic_sections): Likewise.
596
597 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
598
599         * elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Update
600         comments.
601
602 2017-10-06  John Baldwin  <jhb@FreeBSD.org>
603
604         * elf-bfd.h (struct elf_backend_data): Add
605         `elf_backend_grok_freebsd_prstatus'.
606         * elf.c (elfcore_grok_freebsd_note): Call
607         `elf_backend_grok_freebsd_prstatus' to handle NT_PRSTATUS if
608         present.
609         * elfn32-mips.c (elf_n32_mips_grok_freebsd_prstatus): New
610         function.
611         (elf_backend_grok_freebsd_prstatus): Define.
612         * elfxx-target.h (elf_backend_grok_freebsd_prstatus): Define.
613         (elfNN_bed): Initialize `elf_backend_grok_freebsd_prstatus'.
614
615 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
616
617         * elf32-i386.c (elf_i386_check_relocs): Replace has_got_reloc
618         and has_non_got_reloc with zero_undefweak.
619         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
620         * elfxx-x86.c (_bfd_x86_elf_link_hash_newfunc): Initialize
621         zero_undefweak to 1.
622         (_bfd_x86_elf_copy_indirect_symbol): Replace has_got_reloc and
623         has_non_got_reloc with zero_undefweak.
624         * elfxx-x86.h (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace
625         has_got_reloc and has_non_got_reloc with zero_undefweak.
626         (elf_x86_link_hash_entry): Likewise.
627
628 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
629
630         * elfxx-x86.h (COPY_INPUT_RELOC_P): Add "do/while(0);".
631         (VERIFY_COPY_RELOC): Likewise.
632
633 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
634
635         * elfxx-x86.h (VERIFY_COPY_RELOC): New.
636         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
637         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
638
639 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
640
641         * elfxx-x86.h (VERIFY_PLT_ENTRY): New.
642         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use it.
643         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
644
645 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
646
647         * elfxx-x86.h (COPY_INPUT_RELOC_P): New.
648         * elf32-i386.c (elf_i386_relocate_section): Use it.
649         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
650
651 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
652
653         * elf32-i386.c (X86_SIZE_TYPE_P): New.
654         (elf_i386_relocate_section): Use GENERATE_DYNAMIC_RELOCATION_P.
655         * elf64-x86-64.c (X86_SIZE_TYPE_P): New.
656         (elf_x86_64_relocate_section): Use GENERATE_DYNAMIC_RELOCATION_P.
657         * elfxx-x86.h (GENERATE_DYNAMIC_RELOCATION_P): New.
658
659 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
660
661         * elfxx-x86.h (POINTER_LOCAL_IFUNC_P): New.
662         (PLT_LOCAL_IFUNC_P): Likewise.
663         * elf32-i386.c (elf_i386_relocate_section): Use them.
664         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
665
666 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
667
668         * elfxx-x86.h (GENERATE_RELATIVE_RELOC_P): New.
669         * elf32-i386.c (elf_i386_relocate_section): Use it.
670         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
671
672 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
673
674         * elfxx-x86.h (RESOLVED_LOCALLY_P): New.
675         * elf32-i386.c (elf_i386_relocate_section): Use it.
676         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
677
678 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
679
680         * elf32-i386.c (X86_PCREL_TYPE_P): New.
681         (elf_i386_check_relocs): Use NEED_DYNAMIC_RELOCATION_P.
682         * elf64-x86-64.c (IS_X86_64_PCREL_TYPE): Renamed to ...
683         (X86_PCREL_TYPE_P): This.
684         (elf_x86_64_check_relocs): Use NEED_DYNAMIC_RELOCATION_P.
685         Replace IS_X86_64_PCREL_TYPE with X86_PCREL_TYPE_P.
686         (elf_x86_64_relocate_section): Replace IS_X86_64_PCREL_TYPE with
687         X86_PCREL_TYPE_P.
688         * elfxx-x86.h (NEED_DYNAMIC_RELOCATION_P): New.
689
690 2017-10-06  H.J. Lu  <hongjiu.lu@intel.com>
691
692         * elfxx-x86.h (TLS_TRANSITION_IE_TO_LE_P): New.
693         * elf32-i386.c (elf_i386_tls_transition): Use it.
694         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
695
696 2017-10-05  H.J. Lu  <hongjiu.lu@intel.com>
697
698         * elf32-ppc.c (readonly_dynrelocs): Add a link_info argument.
699         Dump dynamic relocation in read-only section with minfo if
700         needed.
701         (ppc_elf_adjust_dynamic_symbol): Pass NULL to readonly_dynrelocs.
702         (maybe_set_textrel): Likewise.
703         (ppc_elf_size_dynamic_sections): Dump dynamic relocation in
704         read-only section with minfo.
705
706 2017-10-05  John Baldwin  <jhb@FreeBSD.org>
707
708         * elf.c (elfcore_grok_freebsd_note): Handle NT_ARM_VFP.
709
710 2017-10-05  H.J. Lu  <hongjiu.lu@intel.com>
711
712         * elf32-tilepro.c (readonly_dynrelocs): Dump dynamic relocation
713         in read-only section with minfo.
714         (tilepro_elf_size_dynamic_sections): Likewise.
715         * elfxx-tilegx.c (readonly_dynrelocs): Likewise.
716         (tilegx_elf_size_dynamic_sections): Likewise.
717
718 2017-10-05  Pedro Alves  <palves@redhat.com>
719
720         PR 22245
721         * bfd.c (bfd_set_error): Revert 2017-10-04 change.  Remove
722         ellipsis parameter.  Split out bfd_error_on_input code to..
723         (bfd_set_input_error): .. New function.
724         * archive.c (_bfd_write_archive_contents): Use bfd_set_input_error.
725         * vms-lib.c (_bfd_vms_lib_write_archive_contents): Likewise.
726         * bfd-in2.h: Regenerate.
727
728 2017-10-05  Alan Modra  <amodra@gmail.com>
729
730         * elflink.c (elf_link_input_bfd): Correct ctor/dtor in init_array/
731         fini_array error value.
732
733 2017-10-05  Alan Modra  <amodra@gmail.com>
734
735         PR 21167
736         * elf.c (_bfd_elf_setup_sections): Don't trim reloc sections from
737         groups.
738         (_bfd_elf_init_reloc_shdr): Pass sec_hdr, use it to copy SHF_GROUP
739         flag from section.
740         (elf_fake_sections): Adjust calls.  Exit immediately on failure.
741         (bfd_elf_set_group_contents): Add associated reloc section indices
742         to group contents.
743
744 2017-10-04  Alan Modra  <amodra@gmail.com>
745
746         * elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't sort or
747         classify symbols for ELFv2.
748
749 2017-10-04  Pavel I. Kryukov <kryukov@frtk.ru>
750
751         PR 22245
752         * bfd.c (bfd_set_error): Avoid UB on passing arg to va_start that
753         undergoes default promotion.
754         * bfd-in2.h: Regenerate.
755
756 2017-10-02  Alan Modra  <amodra@gmail.com>
757
758         * elf32-ppc.c (ppc_elf_relocate_section): Fix comment typo.
759         * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
760
761 2017-10-01  Alan Modra  <amodra@gmail.com>
762
763         PR 21957
764         * dwarf2.c (new_line_sorts_after): Remove end_sequence comparison.
765         (add_line_info): Always put end_sequence last.
766
767 2017-10-01  Alan Modra  <amodra@gmail.com>
768
769         PR 22047
770         * dwarf2.c (read_section): Allocate buffer with extra byte for
771         bfd_simple_get_relocated_section_contents rather than copying
772         afterwards.
773
774 2017-09-29  Alan Modra  <amodra@gmail.com>
775
776         * merge.c (merge_strings): Return FALSE on malloc failure.
777         (_bfd_merge_sections): Return failures from record_section and
778         merge_strings.
779
780 2017-09-28  Alan Modra  <amodra@gmail.com>
781
782         PR 22220
783         * elflink.c (_bfd_elf_merge_symbol): Set non_ir_ref_dynamic in
784         a case where plugin_notice isn't called.
785
786 2017-09-27  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
787
788         * elf32-nds32.c (nds32_elf_relax_section): Fix a tautological
789         comparison.
790
791 2017-09-26  H.J. Lu  <hongjiu.lu@intel.com>
792
793         PR ld/22199
794         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't pass
795         output_bfd to info->callbacks->minfo.
796
797 2017-09-26  Nick Clifton  <nickc@redhat.com>
798
799         PR 22172
800         * elf64-x86-64.c (elf_x86_64_info_to_howto): Do not trigger an
801         assertion failure if elf_x86_64_rtype_to_howto has already issued
802         an error message.
803
804 2017-09-26  Alan Modra  <amodra@gmail.com>
805
806         PR 22210
807         * dwarf2.c (read_formatted_entries): Use read_attribute_value to
808         read data.
809
810 2017-09-26  Nick Clifton  <nickc@redhat.com>
811
812         PR 22210
813         * dwarf2.c (read_formatted_entries): Fail early if we know that
814         the loop parsing data entries will overflow the end of the
815         section.
816
817 2017-09-26  Alan Modra  <amodra@gmail.com>
818
819         PR 22209
820         * dwarf2.c (struct comp_unit): Delete sec_info_ptr field.
821         (find_abstract_instance_name): Calculate DW_FORM_ref_addr relative
822         to stash->info_ptr_memory, and check die_ref is within that memory.
823         Set info_ptr_end correctly when another CU is refd.  Check die_ref
824         for DW_FORM_ref4 etc. is within CU.
825
826 2017-09-26  Alan Modra  <amodra@gmail.com>
827
828         PR 22205
829         * dwarf2.c (concat_filename): Return "<unknown>" on NULL filename.
830         (read_formatted_entries): Init "fe".
831         (decode_line_info <DW_LNE_define_file>): Use line_info_add_file_name.
832
833 2017-09-26  Alan Modra  <amodra@gmail.com>
834
835         PR 22204
836         * dwarf2.c (decode_line_info): Ensure line_ptr stays within
837         bounds in inner loop.
838
839 2017-09-25  Alan Modra  <amodra@gmail.com>
840
841         PR 22202
842         * dwarf1.c (parse_die): Sanity check pointer against section limit
843         before dereferencing.
844         (parse_line_table): Likewise.
845
846 2017-09-25  Alan Modra  <amodra@gmail.com>
847
848         PR 22201
849         * dwarf2.c (scan_unit_for_symbols): Ignore DW_AT_name unless it
850         has string form.
851         (parse_comp_unit): Likewise.
852
853 2017-09-25  Alan Modra  <amodra@gmail.com>
854
855         PR 22200
856         * dwarf2.c (read_formatted_entries): Error on format_count zero.
857
858 2017-09-24  Alan Modra  <amodra@gmail.com>
859
860         PR 22197
861         * opncls.c (bfd_get_debug_link_info_1): Properly check that crc is
862         within section bounds.
863
864 2017-09-24  Alan Modra  <amodra@gmail.com>
865
866         PR 22191
867         * dwarf2.c (decode_line_info): Properly free line sequences on error.
868
869 2017-09-24  Alan Modra  <amodra@gmail.com>
870
871         PR 22187
872         * dwarf2.c (find_abstract_instance_name): Add orig_info_ptr and
873         pname param.  Return status.  Make name const.  Don't abort,
874         return an error.  Formatting.  Exit if current info_ptr matches
875         orig_info_ptr.  Update callers.
876         (scan_unit_for_symbols): Start at nesting_level of zero.  Make
877         nested_funcs an array of structs for extensibility.  Formatting.
878
879 2017-09-24  Alan Modra  <amodra@gmail.com>
880
881         PR 22186
882         * dwarf2.c (decode_line_info): Fail on lh.line_range of zero
883         rather than dividing by zero.
884
885 2017-09-24  Alan Modra  <amodra@gmail.com>
886
887         PR 22169
888         * dwarf2.c (decode_line_info): Correct .debug_line unit_length check.
889
890 2017-09-24  Alan Modra  <amodra@gmail.com>
891
892         PR 22167
893         * dwarf2.c (scan_unit_for_symbols): Check u.blk->data is non-NULL.
894
895 2017-09-24  Alan Modra  <amodra@gmail.com>
896
897         PR 22166
898         * elf.c (_bfd_elf_slurp_version_tables): Test sh_info on
899         SHT_GNU_verneed section for sanity.  Don't zalloc memory for
900         verref.
901
902 2017-09-22  H.J. Lu  <hongjiu.lu@intel.com>
903
904         PR binutils/22170
905         * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Guard against
906         corrupted PLT.
907
908 2017-09-22  H.J. Lu  <hongjiu.lu@intel.com>
909
910         PR binutils/22163
911         * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Also return
912         -1 if bfd_canonicalize_dynamic_reloc returns 0.
913
914 2017-09-22  Pedro Alves  <palves@redhat.com>
915             Alan Modra  <amodra@gmail.com>
916
917         * version.h: Add comment.
918
919 2017-09-21  Andreas Arnez  <arnez@linux.vnet.ibm.com>
920
921         * elf.c (elfcore_grok_note): For the cases NT_S390_GS_CB and
922         NT_S390_GS_BC, correct the previously swapped invocations of
923         elfcore_grok_s390_gs_bc and elfcore_grok_s390_gs_cb.
924
925 2017-09-19  Alan Modra  <amodra@gmail.com>
926
927         PR 21441
928         * elf64-ppc.c (ppc64_elf_build_stubs): Don't check glink_eh_frame
929         size.
930
931 2017-09-19  Alan Modra  <amodra@gmail.com>
932
933         PR 22150
934         * elflink.c (bfd_elf_size_dynamic_sections): Garbage collect
935         symbols before calculating verrefs.  Don't renumber dynsyms
936         after gc.  Exclude .gnu.version when zero or one dynsym.
937         Localize some vars and reindent.
938
939 2017-09-18  H.J. Lu  <hongjiu.lu@intel.com>
940
941         PR ld/22148
942         * elfxx-x86.c (_bfd_x86_elf_get_synthetic_symtab): Check error
943         return from bfd_canonicalize_dynamic_reloc.
944
945 2017-09-15  Alan Modra  <amodra@gmail.com>
946
947         PR 22116
948         * archive.c (bfd_ar_hdr_from_filesystem): Detect when status.st_size
949         overflows bfd_size_type.
950
951 2017-09-14  H.J. Lu  <hongjiu.lu@intel.com>
952
953         PR ld/22135
954         * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument
955         to indicate if conversion is performed.
956         (elf_i386_check_relocs): Cache section contents and relocations
957         if conversion is performed.
958         * elf64-x86-64.c (elf_x86_64_check_relocs): Cache section
959         contents and relocations if conversion is performed.
960
961 2017-09-14  Nick Clifton  <nickc@redhat.com>
962
963         PR binutils/22113
964         * peXXigen.c (pe_print_idata): Extend check for HintName vector
965         entries.
966
967 2017-09-13  H.J. Lu  <hongjiu.lu@intel.com>
968
969         * elfxx-x86.h: Fix a typo in comments.
970
971 2017-09-09  Kamil Rytarowski  <n54@gmx.com>
972
973         * elf32-nds32.c: Rename __BIT() to N32_BIT().
974
975 2017-09-09  Alan Modra  <amodra@gmail.com>
976
977         * elf64-ppp.c (plt_stub_pad): Handle positive and negative
978         plt_stub_align.
979
980 2017-09-09  H.J. Lu  <hongjiu.lu@intel.com>
981
982         * elf32-i386.c (elf_i386_relocate_section): Update usage of
983         UNDEFINED_WEAK_RESOLVED_TO_ZERO.
984         (elf_i386_finish_dynamic_symbol): Likewise.
985         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
986         (elf_x86_64_finish_dynamic_symbol): Likewise.
987         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Likewise.
988         (_bfd_x86_elf_fixup_symbol): Likewise.
989
990 2017-09-09  H.J. Lu  <hongjiu.lu@intel.com>
991
992         * elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
993         check has_non_got_reloc.
994
995 2017-09-09  H.J. Lu  <hongjiu.lu@intel.com>
996
997         PR ld/22115
998         * elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def.
999         Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
1000         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check
1001         linker_def.  Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
1002         * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref
1003         and linker_def on __ehdr_start if it is referenced and not
1004         defined.
1005         (_bfd_x86_elf_link_symbol_references_local): Also set local_ref
1006         and return TRUE when building executable, if a symbol has
1007         non-GOT/non-PLT relocations in text section or there is no
1008         dynamic linker.
1009         * elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def.
1010
1011 2017-09-08  H.J. Lu  <hongjiu.lu@intel.com>
1012
1013         * elfxx-x86.h: Update comments.
1014
1015 2017-09-08  H.J. Lu  <hongjiu.lu@intel.com>
1016
1017         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Replace
1018         elf_x86_plt_layout_table with elf_x86_init_table.
1019         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties):
1020         Likewise.
1021         * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties):
1022         Likewise.
1023         * elfxx-x86.h (elf_x86_plt_layout_table): Renamed to ...
1024         (elf_x86_init_table): This.
1025         (_bfd_x86_elf_link_setup_gnu_properties): Replace
1026         elf_x86_plt_layout_table with elf_x86_init_table.
1027
1028 2017-09-07  H.J. Lu  <hongjiu.lu@intel.com>
1029
1030         * configure.ac (bfd_backends): Don't add elf64-x86-64.lo nor
1031         elf64.lo together with elfxx-x86.lo for 64-bit BFD.
1032         * configure: Regenerated.
1033         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set r_info
1034         and r_sym fields of plt_layout.
1035         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties):
1036         Likewise.
1037         * elfxx-x86.c (elf_x86_64_is_reloc_section): Remove BFD64 check.
1038         (_bfd_x86_elf_link_hash_table_create): Likewise.  Don't set
1039         r_info nor r_sym fields.
1040         (_bfd_x86_elf_link_setup_gnu_properties): Set r_info and r_sym
1041         fields of htab.
1042         * elfxx-x86.h (elf_x86_plt_layout_table): Add r_info and r_sym.
1043
1044 2017-09-07  Palmer Dabbelt  <palmer@dabbelt.com>
1045
1046         * (_bfd_riscv_relax_align): Call bfd_set_error and
1047         print an error message when unable to relax a .align directive.
1048
1049 2017-09-07  Palmer Dabbelt  <palmer@dabbelt.com>
1050
1051         * elfnn-riscv.c (riscv_zero_pcrel_hi_reloc): New function.
1052         (riscv_record_pcrel_hi_reloc): Add absolute argument.
1053         (riscv_elf_relocate_section): Call riscv_zero_pcrel_hi_reloc for
1054         R_RISCV_PCREL_HI20 relocs, and pass the result to
1055         riscv_record_pcrel_hi_reloc.
1056
1057 2017-09-07  H.J. Lu  <hongjiu.lu@intel.com>
1058
1059         * elf32-i386.c (elf_i386_convert_load_reloc): Add an argument,
1060         r_type_p.  Remove the converted argument.  Replace
1061         SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P.  Return
1062         the new relocation type via r_type_p.
1063         (elf_i386_relocate_section): Likewise.
1064         (elf_i386_finish_dynamic_symbol): Likewise.
1065         (need_convert_load): Removed.
1066         (check_relocs_failed): Updated.
1067         (elf_i386_check_relocs): Call elf_i386_convert_load_reloc,
1068         instead of setting need_convert_load.
1069         (_bfd_i386_elf_convert_load): Removed.
1070         * elf64-x86-64.c (need_convert_load): Removed.
1071         (check_relocs_failed): Updated.
1072         (elf_x86_64_convert_load_reloc): Add an argument, r_type_p.
1073         Replace SYMBOL_REFERENCES_LOCAL with SYMBOL_REFERENCES_LOCAL_P.
1074         Return the new relocation type via r_type_p.
1075         (elf_x86_64_check_relocs): Call elf_x86_64_convert_load_reloc,
1076         instead of setting need_convert_load.
1077         (elf_x86_64_check_relocs): Don't check PIC if relocation has
1078         been converted.
1079         (_bfd_x86_64_elf_convert_load): Removed.
1080         (elf_x86_64_relocate_section): Replace SYMBOL_REFERENCES_LOCAL
1081         with SYMBOL_REFERENCES_LOCAL_P.
1082         (elf_x86_64_finish_dynamic_symbol): Likewise.
1083         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Don't
1084         set convert_load.
1085         (_bfd_x86_elf_size_dynamic_sections): Don't call convert_load.
1086         (_bfd_x86_elf_link_symbol_references_local): New function.
1087         * elfxx-x86.h (SYMBOL_REFERENCES_LOCAL_P): New.
1088         (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Replace elf.forced_local with
1089         SYMBOL_REFERENCES_LOCAL_P.
1090         (elf_x86_link_hash_entry): Add local_ref.
1091         (elf_x86_link_hash_table): Remove convert_load.
1092         (_bfd_i386_elf_convert_load): Removed.
1093         (_bfd_x86_64_elf_convert_load): Likewise.
1094         (_bfd_x86_elf_link_symbol_references_local): New.
1095
1096 2017-09-06  H.J. Lu  <hongjiu.lu@intel.com>
1097
1098         * elf64-x86-64.c (R_X86_64_converted_reloc_bit): New.
1099         (elf_x86_64_info_to_howto): Get the real relocation type by
1100         masking out R_X86_64_converted_reloc_bit.
1101         (elf_x86_64_check_tls_transition): Get the real relocation type
1102         by masking out R_X86_64_converted_reloc_bit.
1103         (elf_x86_64_convert_load_reloc): Set R_X86_64_converted_reloc_bit
1104         instead of setting converted_reloc.
1105         (elf_x86_64_relocate_section): Check R_X86_64_converted_reloc_bit
1106         instead of converted_reloc. Get the real relocation type by
1107         masking out R_X86_64_converted_reloc_bit.
1108         (elf_x86_64_link_setup_gnu_properties): Verify that the value of
1109         R_X86_64_converted_reloc_bit is valid.
1110         * elfxx-x86.h (converted_reloc): Removed.
1111
1112 2017-09-06  H.J. Lu  <hongjiu.lu@intel.com>
1113
1114         * elf32-i386.c (elf_i386_relocate_section): Don't change r_type
1115         when calling elf_i386_tls_transition.  Don't use ELF32_R_TYPE
1116         to get the relocation type again.
1117         * elf64-x86-64.c (elf_x86_64_relocate_section): Don't change
1118         r_type when calling elf_x86_64_tls_transition.  Don't use
1119         ELF32_R_TYPE to get the relocation type again.
1120
1121 2017-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1122
1123         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Properly set
1124         converted_reloc.
1125
1126 2017-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1127
1128         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Remove the sec
1129         argument.  Don't check relocation overflow.  Avoid relocation
1130         overflow if --no-relax is used.  Set converted_reloc on symbol
1131         if a GOTPCREL relocation is converted.
1132         (elf_x86_64_relocate_section): Issue a fatal error and suggest
1133         --no-relax if GOTPCREL relocation conversion leads to relocation
1134         overflow.
1135         * elfxx-x86.h (elf_x86_link_hash_entry): Add converted_reloc.
1136
1137 2017-09-05  Alexander Fedotov <alexander.fedotov@nxp.com>
1138             Edmar Wienskoski <edmar.wienskoski@nxp.com
1139
1140         * elf32-ppc.c (ppc_elf_howto_raw): Add R_PPC_VLE_ADDR20.
1141         (ppc_elf_check_relocs): Handle it.
1142         (ppc_elf_vle_split20): New function.
1143         (ppc_elf_relocate_section): Handle R_PPC_VLE_ADDR20.
1144
1145 2017-09-03  H.J. Lu  <hongjiu.lu@intel.com>
1146
1147         PR ld/22071
1148         * elfxx-x86.c (elf_x86_allocate_dynrelocs): Set tlsdesc_plt
1149         for x86-64 if GOT_TLS_GDESC_P is true.
1150
1151 2017-09-03  Alan Modra  <amodra@gmail.com>
1152
1153         PR 22067
1154         * elfxx-x86.h (elf_x86_hash_table): Check is_elf_hash_table first.
1155
1156 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1157
1158         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
1159         tls_get_addr for x86-64 in one place.
1160
1161 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1162
1163         * configure.ac (bfd_backends): Add elf64-x86-64.lo together
1164         with elfxx-x86.lo for 64-bit BFD.
1165         * configure: Regenerated.
1166
1167 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1168
1169         * elf32-i386.c (elf_i386_convert_load): Renamed to ...
1170         (_bfd_i386_elf_convert_load): This.  Remove static.
1171         (elf_i386_size_dynamic_sections): Removed.
1172         (elf_backend_size_dynamic_sections): Likewise.
1173         * elf64-x86-64.c (elf_x86_64_convert_load): Renamed to ...
1174         (_bfd_x86_64_elf_convert_load): This.  Remove static.
1175         (elf_x86_64_size_dynamic_sections): Removed.
1176         (elf_backend_size_dynamic_sections): Likewise.
1177         * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): Renamed to ...
1178         (elf_x86_allocate_dynrelocs): This.  Make it static.
1179         (_bfd_x86_elf_allocate_local_dynrelocs): Renamed to ...
1180         (elf_x86_allocate_local_dynreloc): This.  Make it static.
1181         (elf_i386_is_reloc_section): New function.
1182         (elf_x86_64_is_reloc_section): Likewise.
1183         (_bfd_x86_elf_link_hash_table_create): Initialize convert_load,
1184         is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent.
1185         Rearrange got_entry_size initialization.
1186         (_bfd_x86_elf_size_dynamic_sections): New function.
1187         * elfxx-x86.h (elf_x86_link_hash_table): Add convert_load,
1188         is_reloc_section, dt_reloc, dt_reloc_sz and dt_reloc_ent.
1189         (_bfd_i386_elf_convert_load): New.
1190         (_bfd_x86_64_elf_convert_load): Likewise.
1191         (_bfd_x86_elf_size_dynamic_sections): Likewise.
1192         (elf_backend_size_dynamic_sections): Likewise.
1193         (_bfd_x86_elf_allocate_dynrelocs): Removed.
1194         (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
1195
1196 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1197
1198         * elfxx-x86.h (elf_x86_link_hash_table): Rearrange fields and
1199         update comments.
1200
1201 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1202
1203         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
1204         sgotplt_jump_table_size with elf_x86_compute_jump_table_size.
1205
1206 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1207
1208         * elf32-i386.c (PLT_CIE_LENGTH, PLT_FDE_LENGTH,
1209         PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Moved to ...
1210         * elfxx-x86.h (PLT_CIE_LENGTH, PLT_FDE_LENGTH,
1211         PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Here.
1212         * elf64-x86-64.c (PLT_CIE_LENGTH, PLT_FDE_LENGTH,
1213         PLT_FDE_START_OFFSET, PLT_FDE_LEN_OFFSET): Removed.
1214
1215 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1216
1217         * elf32-i386.c (elf_i386_allocate_dynrelocs): Removed.
1218         (elf_i386_allocate_local_dynrelocs): Likewise.
1219         (elf_i386_size_dynamic_sections): Replace
1220         elf_i386_allocate_dynrelocs/elf_i386_allocate_local_dynrelocs
1221         with _bfd_x86_elf_allocate_dynrelocs and
1222         _bfd_x86_elf_allocate_local_dynrelocs.
1223         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Removed.
1224         (elf_x86_64_allocate_local_dynrelocs): Likewise.
1225         (elf_x86_64_size_dynamic_sections): Replace
1226         elf_x86_64_allocate_dynrelocs/elf_x86_64_allocate_local_dynrelocs
1227         with _bfd_x86_elf_allocate_dynrelocs and
1228         _bfd_x86_elf_allocate_local_dynrelocs.
1229         * elfxx-x86.c (_bfd_x86_elf_allocate_dynrelocs): New function.
1230         (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
1231         * elfxx-x86.h (_bfd_x86_elf_allocate_dynrelocs): New prototype.
1232         (_bfd_x86_elf_allocate_local_dynrelocs): Likewise.
1233
1234 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1235
1236         * elf32-i386.c (is_i386_elf): Removed.
1237         (elf_i386_check_relocs): Replace is_i386_elf with is_x86_elf.
1238         (elf_i386_size_dynamic_sections): Likewise.
1239         (elf_i386_relocate_section): Likewise.
1240         * elf64-x86-64.c (is_x86_64_elf): Removed.
1241         (elf_x86_64_check_relocs): Replace is_x86_64_elf with
1242         is_x86_elf.
1243         (elf_x86_64_size_dynamic_sections): Likewise.
1244         (elf_x86_64_relocate_section): Likewise.
1245         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
1246         target_id.
1247         * elfxx-x86.h (elf_x86_link_hash_table): Add target_id.
1248         (is_x86_elf): New.
1249
1250 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1251
1252         * elf32-i386.c (elf_i386_compute_jump_table_size): Removed.
1253         (elf_i386_allocate_dynrelocs): Replace
1254         elf_i386_compute_jump_table_size with
1255         elf_x86_compute_jump_table_size.
1256         (elf_i386_size_dynamic_sections): Likewise.
1257         * elf64-x86-64.c (elf_x86_64_compute_jump_table_size): Removed.
1258         (elf_x86_64_allocate_dynrelocs): Replace
1259         elf_x86_64_compute_jump_table_size with
1260         elf_x86_compute_jump_table_size.
1261         (elf_x86_64_size_dynamic_sections): Likewise.
1262         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
1263         got_entry_size.
1264         * elfxx-x86.h (elf_x86_link_hash_table): Add got_entry_size.
1265         (elf_x86_compute_jump_table_size): New.
1266
1267 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1268
1269         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Initialize
1270         sizeof_reloc.
1271         (_bfd_x86_elf_adjust_dynamic_symbol): Use sizeof_reloc.
1272         * elfxx-x86.h (elf_x86_link_hash_table): Add sizeof_reloc.
1273
1274 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1275
1276         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check VxWorks
1277         with htab->is_vxworks.
1278         (elf_i386_size_dynamic_sections): Likewise.
1279         (elf_i386_relocate_section): Likewise.
1280         (elf_i386_finish_dynamic_symbol): Likewise.
1281         (elf_i386_finish_dynamic_sections): Likewise.
1282
1283 2017-09-02  H.J. Lu  <hongjiu.lu@intel.com>
1284
1285         * elf32-i386.c (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG,
1286         GOT_TLS_IE_BOTH, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P,
1287         GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Moved to ...
1288         * elfxx-x86.h (GOT_TLS_IE, GOT_TLS_IE_POS, GOT_TLS_IE_NEG,
1289         GOT_TLS_IE_BOTH, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P,
1290         GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Here.
1291         * elf64-x86-64.c (GOT_TLS_IE, GOT_TLS_GDESC, GOT_TLS_GD_BOTH_P,
1292         GOT_TLS_GD_P, GOT_TLS_GDESC_P, GOT_TLS_GD_ANY_P): Removed.
1293
1294 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
1295
1296         PR ld/22064
1297         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Check
1298         ELF_COMMON_DEF_P for common symbols.
1299
1300 2017-09-02  Alan Modra  <amodra@gmail.com>
1301
1302         * elf-eh-frame.c (offset_adjust): Avoid false positive gcc warning.
1303         * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Likewise.
1304         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
1305
1306 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
1307
1308         * elf32-i386.c (elf_i386_gc_mark_hook): Removed.
1309         (elf_backend_gc_mark_hook): Likewise.
1310         * elf64-x86-64.c (elf_x86_64_gc_mark_hook): Likewise.
1311         (elf_backend_gc_mark_hook): Likewise.
1312         * elfxx-x86.c (_bfd_x86_elf_gc_mark_hook): New function.
1313         * elfxx-x86.h (_bfd_x86_elf_gc_mark_hook): New.
1314         (elf_backend_gc_mark_hook): Likewise.
1315
1316 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
1317
1318         * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Removed.
1319         (elf_backend_adjust_dynamic_symbol): Likewise.
1320         * elf64-x86-64.c (elf_x86_64_adjust_dynamic_symbol): Likewise.
1321         (elf_backend_adjust_dynamic_symbol): Likewise.
1322         * elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): New function.
1323         (_bfd_x86_elf_link_setup_gnu_properties): Copy is_vxworks.
1324         * elfxx-x86.h (elf_x86_link_hash_table): Add is_vxworks.
1325         (_bfd_x86_elf_adjust_dynamic_symbol): New.
1326         (elf_backend_adjust_dynamic_symbol): Likewise.
1327
1328 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
1329
1330         * elfxx-x86.h (elf_x86_plt_layout_table): Fix a typo in
1331         comments.
1332
1333 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
1334
1335         * elf32-i386.c (elf_i386_mkobject): Removed.
1336         (bfd_elf32_mkobject): Likewise.
1337         * elf64-x86-64.c (elf_x86_64_mkobject): Likewise.
1338         (bfd_elf64_mkobject): Likewise.
1339         (bfd_elf32_mkobject): Likewise.
1340         * elfxx-x86.c (_bfd_x86_elf_mkobject): New function.
1341         * elfxx-x86.h (_bfd_x86_elf_mkobject): New.
1342         (bfd_elf64_mkobject): Likewise.
1343         (bfd_elf32_mkobject): Likewise.
1344
1345 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
1346
1347         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Updated.
1348         Call _bfd_x86_elf_link_setup_gnu_properties.
1349         * elf64-x86-64.c (elf_x86_lazy_plt_layout): Initialize
1350         pic_plt0_entry and pic_plt_entry fields with the non-PIC PLT
1351         entries.
1352         (elf_x86_64_non_lazy_plt): Likewise.
1353         (elf_x86_64_lazy_bnd_plt): Likewise.
1354         (elf_x86_64_non_lazy_bnd_plt): Likewise.
1355         (elf_x86_64_lazy_ibt_plt): Likewise.
1356         (elf_x32_lazy_ibt_plt): Likewise.
1357         (elf_x86_64_non_lazy_ibt_plt): Likewise.
1358         (elf_x32_non_lazy_ibt_plt): Likewise.
1359         (elf_x86_64_nacl_plt): Likewise.
1360         (elf_x86_64_link_setup_gnu_properties): Updated.  Call
1361         _bfd_x86_elf_link_setup_gnu_properties.
1362         * elfxx-x86.c: Include elf-vxworks.h".
1363         (_bfd_x86_elf_link_setup_gnu_properties): New function.
1364         * elfxx-x86.h (elf_x86_lazy_plt_layout): Remove "for i386 only"
1365         comments for pic_plt0_entry and pic_plt_entry.
1366         (elf_x86_non_lazy_plt_layout): Likewise.
1367         (elf_x86_plt_layout_table): New.
1368         (_bfd_x86_elf_link_setup_gnu_properties): Likewise.
1369
1370 2017-09-01  H.J. Lu  <hongjiu.lu@intel.com>
1371
1372         PR ld/22061
1373         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Create
1374         .eh_frame section for the second PLT.
1375         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Correct
1376         alignment of .eh_frame section for the second PLT.
1377
1378 2017-09-01  Nick Clifton  <nickc@redhat.com>
1379
1380         PR 22059
1381         * dwarf2.c (decode_line_info): Fix test for an overlong line info
1382         structure.
1383
1384 2017-09-01  Nick Clifton  <nickc@redhat.com>
1385
1386         PR 22058
1387         * elf-attrs.c (_bfd_elf_parse_attributes): Ensure that the
1388         attribute buffer is NUL terminated.
1389
1390 2017-08-31  Nick Clifton  <nickc@redhat.com>
1391
1392         PR 22047
1393         * dwarf2.c (read_section): If necessary add a terminating NUL byte
1394         to dwarf string sections.
1395
1396 2017-08-31  Alan Modra  <amodra@gmail.com>
1397
1398         * po/SRC-POTFILES.in: Regenerate.
1399
1400 2017-08-31  Alan Modra  <amodra@gmail.com>
1401
1402         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't exit early
1403         for a section containing just a terminator.  Allow multiple
1404         terminators at end of section.
1405         * elflink.c (bfd_elf_discard_info): Iterate over .eh_frame
1406         sections when not adding alignment.  Assert on terminator in
1407         the middle of FDEs.
1408
1409 2017-08-31  Alan Modra  <amodra@gmail.com>
1410
1411         PR 21441
1412         PR 22048
1413         * elflink.c (bfd_elf_discard_info): Don't pad embedded zero
1414         terminators.
1415
1416 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
1417
1418         * configure.ac (bfd_backends): Add elf64.lo together with
1419         elfxx-x86.lo for 64-bit BFD.
1420         * configure: Regenerated.
1421
1422 2017-08-31  James Bowman  <james.bowman@ftdichip.com>
1423
1424         * elf32-ft32.c (ft32_elf_howto_table): Use complain_overflow_dont
1425         for R_FT32_18.
1426
1427 2017-08-31  Alan Modra  <amodra@gmail.com>
1428
1429         PR binutils/22032
1430         * opncls.c (bfd_close_all_done): Don't call bfd_cache_close
1431         before _close_and_cleanup.  Call iovec->bclose after.
1432         (bfd_close): Remove code common to, and call, bfd_close_all_done.
1433
1434 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
1435
1436         * elf32-i386.c (elf_i386_plt_type): Removed.
1437         (elf_i386_plt): Likewise.
1438         (elf_i386_get_synthetic_symtab): Updated.   Call
1439         _bfd_x86_elf_get_synthetic_symtab.
1440         * elf64-x86-64.c (elf_x86_64_plt_type): Removed.
1441         (elf_x86_64_plt): Likewise.
1442         (elf_x86_64_get_synthetic_symtab): Updated.  Call
1443         _bfd_x86_elf_get_synthetic_symtab.
1444         * elfxx-x86.c (elf_i386_get_plt_got_vma): New function.
1445         (elf_x86_64_get_plt_got_vma): Likewise.
1446         (elf_i386_valid_plt_reloc_p): Likewise.
1447         (elf_x86_64_valid_plt_reloc_p): Likewise.
1448         (_bfd_x86_elf_get_synthetic_symtab): Likewise.
1449         * elfxx-x86.h (elf_x86_plt_type): New.
1450         (elf_x86_plt): Likewise.
1451         (_bfd_x86_elf_get_synthetic_symtab): Likewise.
1452
1453 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
1454
1455         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Check
1456         target_id instead of elf_machine_code.
1457
1458 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
1459
1460         * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed.
1461         (elf_i386_lazy_plt_layout): Likewise.
1462         (elf_i386_non_lazy_plt_layout): Likewise.
1463         (elf_i386_plt_layout): Likewise.
1464         (elf_i386_link_hash_table): Likewise.
1465         (elf_i386_next_tls_desc_index): Likewise.
1466         (elf_i386_srelplt2): Likewise.
1467         (elf_i386_plt): Likewise.
1468         (elf_i386_lazy_plt): Likewise.
1469         (elf_i386_non_lazy_plt): Likewise.
1470         (elf_i386_link_hash_table_create): Likewise.
1471         (bfd_elf32_bfd_link_hash_table_create): Likewise.
1472         (elf_i386_lazy_plt): Updated.
1473         (elf_i386_non_lazy_plt): Likewise.
1474         (elf_i386_lazy_ibt_plt): Likewise.
1475         (elf_i386_non_lazy_ibt_plt): Likewise.
1476         (elf_i386_allocate_dynrelocs): Likewise.
1477         (elf_i386_size_dynamic_sections): Likewise.
1478         (elf_i386_relocate_section): Likewise.
1479         (elf_i386_finish_dynamic_symbol): Likewise.
1480         (elf_i386_finish_dynamic_sections): Likewise.
1481         (elf_i386_get_synthetic_symtab): Likewise.
1482         (elf_i386_link_setup_gnu_properties): Likewise.
1483         (elf_i386_nacl_plt): Likewise.
1484         * elf64-x86-64.c (ABI_64_P): Removed.
1485         (ELF64_DYNAMIC_INTERPRETER): Likewise.
1486         (ELF32_DYNAMIC_INTERPRETER): Likewise.
1487         (elf_x86_64_lazy_plt_layout): Likewise.
1488         (elf_x86_64_non_lazy_plt_layout): Likewise.
1489         (elf_x86_64_plt_layout): Likewise.
1490         (elf_x86_64_link_hash_table): Likewise.
1491         (elf_x86_64_plt): Likewise.
1492         (elf_x86_64_lazy_plt): Likewise.
1493         (elf_x86_64_non_lazy_plt): Likewise.
1494         (elf_x86_64_link_hash_table_create): Likewise.
1495         (bfd_elf64_bfd_link_hash_table_create): Likewise.
1496         (bfd_elf32_bfd_link_hash_table_create): Likewise.
1497         (elf_x86_64_lazy_plt): Updated.
1498         (elf_x86_64_non_lazy_plt): Likewise.
1499         (elf_x86_64_lazy_bnd_plt): Likewise.
1500         (elf_x86_64_non_lazy_bnd_plt): Likewise.
1501         (elf_x86_64_lazy_ibt_plt): Likewise.
1502         (elf_x32_lazy_ibt_plt): Likewise.
1503         (elf_x86_64_non_lazy_ibt_plt): Likewise.
1504         (elf_x32_non_lazy_ibt_plt): Likewise.
1505         (elf_x86_64_allocate_dynrelocs): Likewise.
1506         (elf_x86_64_size_dynamic_sections): Likewise.
1507         (elf_x86_64_relocate_section): Likewise.
1508         (elf_x86_64_finish_dynamic_symbol): Likewise.
1509         (elf_x86_64_finish_dynamic_sections): Likewise.
1510         (elf_x86_64_get_synthetic_symtab): Likewise.
1511         (elf_x86_64_link_setup_gnu_properties): Likewise.
1512         (elf_x86_64_nacl_plt): Likewise.
1513         * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and
1514         "elf/x86-64.h".
1515         (ELF32_DYNAMIC_INTERPRETER): New.
1516         (ELF64_DYNAMIC_INTERPRETER): Likewise.
1517         (ELFX32_DYNAMIC_INTERPRETER): Likewise.
1518         (_bfd_x86_elf_link_hash_table_create): Likewise.
1519         (_bfd_x86_elf_link_hash_table_free): Renamed to ...
1520         (elf_x86_link_hash_table_free): This.  Make it static.
1521         * elfxx-x86.h: Don't include "objalloc.h".
1522         (ABI_64_P): New.
1523         (elf_x86_lazy_plt_layout): Likewise.
1524         (elf_x86_non_lazy_plt_layout): Likewise.
1525         (elf_x86_plt_layout): Likewise.
1526         (_bfd_x86_elf_link_hash_table_create): Likewise.
1527         (bfd_elf64_bfd_link_hash_table_create): Likewise.
1528         (bfd_elf32_bfd_link_hash_table_create): Likewise.
1529         (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt,
1530         srelplt2 and next_tls_desc_index.
1531         (_bfd_x86_elf_link_hash_table_free): Removed.
1532
1533 2017-08-30  Maciej W. Rozycki  <macro@imgtec.com>
1534
1535         * elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
1536         branch offset interpretation.
1537
1538 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
1539
1540         PR binutils/22032
1541         * opncls.c (bfd_close_all_done): Call _close_and_cleanup.
1542
1543 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
1544
1545         * elf64-x86-64.c (elf_x86_64_next_tls_desc_index): Removed.
1546         (elf_x86_64_srelplt2): Likewise.
1547
1548 2017-08-30  Alan Modra  <amodra@gmail.com>
1549
1550         * elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt.
1551         (ppc64_elf_tls_optimize): Set it.
1552         (ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert
1553         insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when
1554         addis would add zero.
1555         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt.
1556         (ppc_elf_tls_optimize): Set it.
1557         (ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert
1558         insn on TPREL16_LO relocs to use r2 when addis would add zero.
1559
1560 2017-08-30  Alan Modra  <amodra@gmail.com>
1561
1562         * elf64-ppc.c (ppc64_elf_relocate_section): When optimizing
1563         __tls_get_addr call sequences to LE, don't move the addi down
1564         to the nop.  Replace the bl with addi and leave the nop alone.
1565
1566 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
1567
1568         * elf32-i386.c (elf_i386_pie_finish_undefweak_symbol):
1569         Re-indent.
1570         * elf64-x86-64.c (elf_x86_64_finish_local_dynamic_symbol):
1571         Likewise.
1572         (elf_x86_64_pie_finish_undefweak_symbol): Likewise.
1573
1574 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
1575
1576         * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo.
1577         (BFD64_BACKENDS): Likewise.
1578         (BFD32_BACKENDS_CFILES): Add elfxx-x86.c.
1579         (BFD64_BACKENDS_CFILES): Likewise.
1580         * Makefile.in: Regenerated.
1581         * configure.ac (bfd_backends): Add elfxx-x86.lo together with
1582         elf32-i386.lo and elf64-x86-64.lo.
1583         * configure: Regenerated.
1584         * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h",
1585         "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
1586         "objalloc.h" and "hashtab.h".
1587         (ELIMINATE_COPY_RELOCS): Removed.
1588         (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
1589         (SYMBOL_NO_COPYRELOC): Likewise.
1590         (elf_i386_link_hash_entry): Likewise.
1591         (GOT_UNKNOWN): Likewise.
1592         (GOT_NORMAL): Likewise.
1593         (GOT_TLS_GD): Likewise.
1594         (elf_i386_hash_entry): Likewise.
1595         (elf_i386_obj_tdata): Likewise.
1596         (elf_i386_tdata): Likewise.
1597         (elf_i386_local_got_tls_type): Likewise.
1598         (elf_i386_local_tlsdesc_gotent): Likewise.
1599         (elf_i386_hash_table): Likewise.
1600         (elf_i386_link_hash_newfunc): Likewise.
1601         (elf_i386_local_htab_hash): Likewise.
1602         (elf_i386_local_htab_eq): Likewise.
1603         (elf_i386_get_local_sym_hash): Likewise.
1604         (elf_i386_link_hash_table_free): Likewise.
1605         (elf_i386_copy_indirect_symbol): Likewise.
1606         (elf_i386_fixup_symbol): Likewise.
1607         (elf_i386_readonly_dynrelocs): Likewise.
1608         (elf_i386_always_size_sections): Likewise.
1609         (elf_i386_set_tls_module_base): Likewise.
1610         (elf_i386_dtpoff_base): Likewise.
1611         (compare_relocs): Likewise.
1612         (elf_i386_hash_symbol): Likewise.
1613         (elf_i386_parse_gnu_properties): Likewise.
1614         (elf_i386_merge_gnu_properties): Likewise.
1615         (elf_i386_link_check_relocs): Likewise.
1616         (elf_i386_merge_symbol_attribute): Likewise.
1617         (bfd_elf32_bfd_link_check_relocs): Likewise.
1618         (elf_backend_copy_indirect_symbol): Likewise.
1619         (elf_backend_always_size_sections): Likewise.
1620         (elf_backend_omit_section_dynsym): Likewise.
1621         (elf_backend_hash_symbol): Likewise.
1622         (elf_backend_fixup_symbol): Likewise.
1623         (elf_backend_parse_gnu_properties): Likewise.
1624         (elf_backend_merge_gnu_properties): Likewise.
1625         (elf_backend_merge_symbol_attribute): Likewise.
1626         (elf_i386_mkobject): Updated.
1627         (elf_i386_link_hash_table_create): Likewise.
1628         (elf_i386_check_tls_transition): Likewise.
1629         (elf_i386_tls_transition): Likewise.
1630         (elf_i386_convert_load_reloc): Likewise.
1631         (elf_i386_check_relocs): Likewise.
1632         (elf_i386_adjust_dynamic_symbol): Likewise.
1633         (elf_i386_allocate_dynrelocs): Likewise.
1634         (elf_i386_convert_load): Likewise.
1635         (elf_i386_size_dynamic_sections): Likewise.
1636         (elf_i386_relocate_section): Likewise.
1637         (elf_i386_finish_dynamic_symbol ): Likewise.
1638         (elf_i386_finish_dynamic_sections): Likewise.
1639         (elf_i386_output_arch_local_syms): Likewise.
1640         (elf_i386_get_synthetic_symtab): Likewise.
1641         (elf_i386_link_setup_gnu_properties): Likewise.
1642         (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead
1643         of elf_link_hash_table, as base.
1644         (elf_i386_next_tls_desc_index): New.
1645         (elf_i386_srelplt2): Likewise.
1646         (elf_i386_plt): Likewise.
1647         (elf_i386_lazy_plt): Likewise.
1648         (elf_i386_non_lazy_plt): Likewise.
1649         * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h",
1650         "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
1651         "objalloc.h" and "hashtab.h".
1652         (ELIMINATE_COPY_RELOCS): Removed.
1653         (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
1654         (SYMBOL_NO_COPYRELOC): Likewise.
1655         (elf_x86_64_link_hash_entry): Likewise.
1656         (GOT_UNKNOWN): Likewise.
1657         (GOT_NORMAL): Likewise.
1658         (GOT_TLS_GD): Likewise.
1659         (elf_x86_64_hash_entry): Likewise.
1660         (elf_x86_64_obj_tdata): Likewise.
1661         (elf_x86_64_tdata): Likewise.
1662         (elf_x86_64_local_got_tls_type): Likewise.
1663         (elf_x86_64_local_tlsdesc_gotent): Likewise.
1664         (elf_x86_64_hash_table): Likewise.
1665         (elf_x86_64_link_hash_newfunc): Likewise.
1666         (elf_x86_64_local_htab_hash): Likewise.
1667         (elf_x86_64_local_htab_eq): Likewise.
1668         (elf_x86_64_get_local_sym_hash): Likewise.
1669         (elf_x86_64_link_hash_table_free): Likewise.
1670         (elf_x86_64_copy_indirect_symbol): Likewise.
1671         (elf_x86_64_fixup_symbol): Likewise.
1672         (elf_x86_64_readonly_dynrelocs): Likewise.
1673         (elf_x86_64_always_size_sections): Likewise.
1674         (elf_x86_64_set_tls_module_base): Likewise.
1675         (elf_x86_64_dtpoff_base): Likewise.
1676         (compare_relocs): Likewise.
1677         (elf_x86_64_merge_symbol_attribute): Likewise.
1678         (elf_x86_64_hash_symbol): Likewise.
1679         (elf_x86_64_parse_gnu_properties): Likewise.
1680         (elf_x86_64_merge_gnu_properties): Likewise.
1681         (elf_x86_64_link_check_relocs): Likewise.
1682         (elf_backend_copy_indirect_symbol): Likewise.
1683         (elf_backend_always_size_sections): Likewise.
1684         (bfd_elf64_bfd_link_check_relocs): Likewise.
1685         (elf_backend_merge_symbol_attribute): Likewise.
1686         (elf_backend_hash_symbol): Likewise.
1687         (elf_backend_omit_section_dynsym): Likewise.
1688         (elf_backend_fixup_symbol): Likewise.
1689         (elf_backend_parse_gnu_properties): Likewise.
1690         (elf_backend_merge_gnu_properties): Likewise.
1691         (bfd_elf32_bfd_link_check_relocs): Likewise.
1692         (elf_x86_64_mkobject): Updated.
1693         (elf_x86_64_link_hash_table_create): Likewise.
1694         (elf_x86_64_check_tls_transition): Likewise.
1695         (elf_x86_64_tls_transition): Likewise.
1696         (elf_x86_64_convert_load_reloc): Likewise.
1697         (elf_x86_64_check_relocs): Likewise.
1698         (elf_x86_64_adjust_dynamic_symbol): Likewise.
1699         (elf_x86_64_allocate_dynrelocs): Likewise.
1700         (elf_x86_64_convert_load): Likewise.
1701         (elf_x86_64_size_dynamic_sections): Likewise.
1702         (elf_x86_64_relocate_section): Likewise.
1703         (elf_x86_64_finish_dynamic_symbol ): Likewise.
1704         (elf_x86_64_finish_dynamic_sections): Likewise.
1705         (elf_x86_64_output_arch_local_syms): Likewise.
1706         (elf_x86_64_get_synthetic_symtab): Likewise.
1707         (elf_x86_64_link_setup_gnu_properties): Likewise.
1708         (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table,
1709         instead of elf_link_hash_table, as base.
1710         (elf_x86_64_next_tls_desc_index): New.
1711         (elf_x86_64_srelplt2): Likewise.
1712         (elf_x86_64_plt): Likewise.
1713         (elf_x86_64_lazy_plt): Likewise.
1714         (elf_x86_64_non_lazy_plt): Likewise.
1715         * elfxx-x86.c: New file.
1716         * elfxx-x86.h: Likewise.
1717
1718 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
1719
1720         * elf32-i386.c (elf_i386_get_synthetic_symtab): Simplify bad
1721         return.
1722         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
1723
1724 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
1725
1726         * elf32-i386.c (elf_i386_get_synthetic_symtab): Check valid PLT
1727         sections before checking dynamic relocations and free invalid
1728         PLT section contents.
1729         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
1730
1731 2017-08-28  H.J. Lu  <hongjiu.lu@intel.com>
1732
1733         * elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): Removed.
1734         * elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): Likewise.
1735
1736 2017-08-28  H.J. Lu  <hongjiu.lu@intel.com>
1737
1738         PR binutils/22018
1739         * elf32-i386.c (elf_i386_get_synthetic_symtab): Check for valid
1740         PLT section size.
1741         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
1742
1743 2017-08-27  H.J. Lu  <hongjiu.lu@intel.com>
1744
1745         * elf32-i386.c (elf_i386_link_hash_newfunc): Initialize
1746         def_protected.
1747         * elf64-x86-64.c (elf_x86_64_link_hash_newfunc): Likewise.
1748
1749 2017-08-26  H.J. Lu  <hongjiu.lu@intel.com>
1750
1751         PR ld/21997
1752         * elf-bfd.h (elf_obj_tdata): Use ENUM_BITFIELD on object_id,
1753         dyn_lib_class and has_gnu_symbols.  Change bad_symtab to bitfield.
1754         Add a has_no_copy_on_protected bitfield.
1755         (elf_has_no_copy_on_protected): New.
1756         * elf-properties.c (_bfd_elf_parse_gnu_properties): Set
1757         elf_has_no_copy_on_protected for GNU_PROPERTY_NO_COPY_ON_PROTECTED.
1758         (elf_merge_gnu_property_list): Likewise.
1759         (_bfd_elf_link_setup_gnu_properties): Set extern_protected_data
1760         to FALSE for elf_has_no_copy_on_protected.
1761         * elf32-i386.c (SYMBOL_NO_COPYRELOC): New.
1762         (elf_i386_link_hash_entry): Add def_protected.
1763         (elf_i386_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
1764         when checking info->nocopyreloc.
1765         (elf_i386_link_setup_gnu_properties): Don't set
1766         extern_protected_data here.
1767         (elf_i386_merge_symbol_attribute): New function.
1768         (elf_backend_merge_symbol_attribute): New.
1769         * elf64-x86-64.c (SYMBOL_NO_COPYRELOC): New.
1770         (elf_x86_64_link_hash_entry): Add def_protected.
1771         (elf_x86_64_need_pic): Report protected symbol for def_protected.
1772         (elf_x86_64_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
1773         when checking info->nocopyreloc.
1774         (elf_x86_64_relocate_section): Also check for R_X86_64_PC32
1775         relocation run-time overflow and unresolvable R_X86_64_32S
1776         relocation against protected data symbol defined in shared object
1777         with GNU_PROPERTY_NO_COPY_ON_PROTECTED.
1778         (elf_x86_64_link_setup_gnu_properties): Don't set
1779         extern_protected_data here.
1780         (elf_x86_64_merge_symbol_attribute): New function.
1781         (elf_backend_merge_symbol_attribute): New.
1782
1783 2017-08-26  Alan Modra  <amodra@gmail.com>
1784
1785         * elf32-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
1786         (ppc_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
1787         (ppc_elf_relocate_section): Comment fix.
1788         * elf64-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
1789         (ppc64_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
1790         Support dynamic relocs for TPREL16 when non-pic too.
1791         (dec_dynrel_count): Adjust TPREL16 handling as per check_relocs.
1792         (ppc64_elf_relocate_section): Support dynamic relocs for TPREL16
1793         when non-pic too.
1794
1795 2017-08-25  H.J. Lu  <hongjiu.lu@intel.com>
1796
1797         * elf32-i386.c (elf_i386_link_hash_entry): Remove redundant
1798         "symbol" in comments.
1799         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Likewise.
1800
1801 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
1802
1803         PR ld/22001
1804         * elf64-x86-64.c (elf_x86_64_relocate_section): Check for
1805         R_X86_64_PC32 relocation run-time overflow and unresolvable
1806         R_X86_64_32S relocation with -z nocopyreloc.
1807
1808 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
1809
1810         * elf32-i386.c (elf_i386_check_relocs): Revert the last change.
1811         Undefined symbols may not have a type.
1812         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1813
1814 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
1815
1816         * elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for
1817         bfd_link_info.  Report shared, PIE or PDE object based on
1818         bfd_link_info.
1819         (elf_x86_64_check_relocs): Update elf_x86_64_need_pic call.
1820         (elf_x86_64_relocate_section): Likewise.
1821
1822 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
1823
1824         * elf32-i386.c (elf_i386_check_relocs): Increment PLT count only
1825         for function symbols.
1826         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
1827
1828 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
1829
1830         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
1831         extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
1832         is set on any input relocatable file.
1833         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
1834
1835 2017-08-23  Alan Modra  <amodra@gmail.com>
1836
1837         PR 21988
1838         * elf64-ppc.c (ensure_undef_dynamic): Rename from
1839         ensure_undefweak_dynamic.  Handle undefined too.
1840         * elf32-ppc.c (ensure_undef_dynamic): Likewise.
1841         * elf32-hppa.c (ensure_undef_dynamic): Likewise.
1842         (allocate_dynrelocs): Discard undefined non-default visibility
1843         relocs first.  Make undefined syms dynamic.  Tidy goto.
1844
1845 2017-08-21  Alan Modra  <amodra@gmail.com>
1846             H.J. Lu  <hongjiu.lu@intel.com>
1847
1848         PR ld/21964
1849         * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols.
1850         * elflink.c (bfd_elf_define_start_stop): Rewrite.
1851
1852 2017-08-21  Hans-Peter Nilsson  <hp@bitrange.com>
1853
1854         PR ld/20125
1855         * elf64-mmix.c (mmix_elf_relax_section): Correct handling of
1856         undefined weak symbols.
1857
1858 2017-08-18  Nick Clifton  <nickc@redhat.com>
1859
1860         PR binutils/21962
1861         * tekhex.c (getsym): Fix check for source pointer walking off the
1862         end of the input buffer.
1863
1864 2017-08-17  Szabolcs Nagy  <szabolcs.nagy@arm.com>
1865
1866         PR ld/18808
1867         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC
1868         relocations in debug sections, change abort to _bfd_error_handler.
1869
1870 2017-08-14  Nick Clifton  <nickc@redhat.com>
1871
1872         PR 21957
1873         * elf.c (setup_group): Check for an empty or very small group
1874         section.
1875         * po/bfd.pot: Regenerate.
1876
1877 2017-08-14  Alan Modra  <amodra@gmail.com>
1878
1879         PR 21441
1880         * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't add
1881         alignment padding here.
1882         * elflink.c (bfd_elf_discard_info): Add .eh_frame padding here
1883         in a reverse pass over sections.
1884
1885 2017-08-11  H.J. Lu  <hongjiu.lu@intel.com>
1886
1887         PR binutils/21943
1888         * elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
1889         for @plt suffixes first.
1890         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
1891
1892 2017-08-08  Nick Clifton  <nickc@redhat.com>
1893
1894         PR 21916
1895         * elf-attrs.c (_bfd_elf_parse_attributes): Complain about very
1896         small section lengths.
1897         * elf.c (_bfd_elf_setup_sections): Skip empty entries in the group
1898         table.
1899         (elfcore_grok_freebsd_prstatus): Add checks to make sure that
1900         there is enough data present in the note.
1901
1902 2017-08-08  Alan Modra  <amodra@gmail.com>
1903
1904         PR 21017
1905         * elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
1906         got.refcount for GOTOFF relocs, just create .got section.
1907
1908 2017-08-07  H.J. Lu  <hongjiu.lu@intel.com>
1909
1910         * elflink.c (elf_link_add_object_symbols): Move common symbol
1911         check after bed->common_definition.
1912
1913 2017-08-07  Alan Modra  <amodra@gmail.com>
1914
1915         PR 21910
1916         * elflink.c (bfd_elf_final_link): Don't segfault when sections
1917         needed to define various dynamic tags have been discarded.
1918
1919 2017-08-07  Nick Clifton  <nickc@redhat.com>
1920
1921         PR 21884
1922         * elf32-i386.c (elf_i386_link_setup_gnu_properties): If the dynobj
1923         has not been set then use the bfd returned by
1924         _bfd_elf_link_setup_gnu_properties.  If that is null then search
1925         through all the input bfds selecting the first normal, ELF format
1926         one.
1927         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
1928
1929 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
1930
1931         * elf32-i386.c (elf_i386_link_hash_entry): Change tls_get_addr
1932         to 1 bit.
1933         (elf_i386_link_hash_newfunc): Initialize tls_get_addr to 0.
1934         (elf_i386_check_tls_transition): Check tls_get_addr directly.
1935         (elf_i386_convert_load_reloc): Update tls_get_addr check.
1936         (elf_i386_link_check_relocs): New function.
1937         (bfd_elf32_bfd_link_check_relocs): New.
1938         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Change tls_get_addr
1939         to 1 bit.
1940         (elf_x86_64_link_hash_newfunc): Initialize tls_get_addr to 0.
1941         (elf_x86_64_check_tls_transition): Check tls_get_addr directly.
1942         (elf_x86_64_convert_load_reloc): Update tls_get_addr check.
1943         (elf_x86_64_link_check_relocs): New function.
1944         (bfd_elf64_bfd_link_check_relocs): New.
1945         (bfd_elf32_bfd_link_check_relocs): Likewise.
1946
1947 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
1948
1949         PR ld/21903:
1950         * elflink.c (elf_link_add_object_symbols): Treat common symbol
1951         as undefined for --no-define-common.
1952
1953 2017-08-05  Alan Modra  <amodra@gmail.com>
1954
1955         * elf32-hppa.c (elf32_hppa_set_gp): Don't require an
1956         hppa_link_hash_table.
1957
1958 2017-08-02  Max Filippov  <jcmvbkbc@gmail.com>
1959
1960         * xtensa-isa.c (xtensa_isa_init): Don't update lookup table
1961         entries for sysregs with negative indices.
1962
1963 2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1964
1965         * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
1966         isn't the S/390 specific elf data.
1967         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
1968
1969 2017-07-31  Kuan-Lin Chen  <rufus@andestech.com>
1970
1971         * elfxx-riscv.c (riscv_elf_add_sub_reloc): New function.
1972         * (howto_table) [R_RISCV_ADD8]: Use riscv_elf_add_sub_reloc.
1973         [R_RISCV_ADD16]: Likewise.
1974         [R_RISCV_ADD32]: Likewise.
1975         [R_RISCV_ADD64]: Likewise.
1976         [R_RISCV_SUB6]: Likewise.
1977         [R_RISCV_SUB8]: Likewise.
1978         [R_RISCV_SUB16]: Likewise.
1979         [R_RISCV_SUB32]: Likewise.
1980         [R_RISCV_SUB64]: Likewise.
1981
1982 2017-07-31  Alan Modra  <amodra@gmail.com>
1983
1984         * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
1985         without ld.so checks.
1986
1987 2017-07-29  Alan Modra  <amodra@gmail.com>
1988
1989         PR 21847
1990         * elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry.
1991         (ppc64_elf_merge_symbol): Set non_zero_localentry.
1992         (is_elfv2_localentry0): Test non_zero_localentry.
1993         (ppc64_elf_tls_setup): Default to --no-plt-localentry.
1994
1995 2017-07-28  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1996
1997         * elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
1998         pointer check for htab->elf.irelplt.
1999         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
2000
2001 2017-07-27  Nick Clifton  <nickc@redhat.com>
2002
2003         PR 21840
2004         * mach-o.c (bfd_mach_o_read_symtab_strtab): Fail if the symtab
2005         size is -1.
2006         * nlmcode.h (nlm_swap_auxiliary_headers_in): Replace assertion
2007         with error return.
2008         * section.c (bfd_make_section_with_flags): Fail if the name or bfd
2009         are NULL.
2010         * vms-alpha.c (bfd_make_section_with_flags): Correct computation
2011         of end pointer.
2012         (evax_bfd_print_emh): Check for invalid string lengths.
2013
2014 2017-07-25  Nick Clifton  <nickc@redhat.com>
2015
2016         * po/fr.po: Updated French translation.
2017
2018 2017-07-25  Benjamin Green  <bengreen5mx@gmail.com>
2019
2020         PR 21824
2021         * elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
2022         16-bit absolute branches into 10-bit pc-relative branches on the
2023         MSP430 as well as the MSP430X.
2024
2025 2017-07-25  Alan Modra  <amodra@gmail.com>
2026
2027         * elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
2028         (stub_eh_frame_size): New function.
2029         (ppc_size_one_stub): Set group tls_get_addr_opt_bctrl.
2030         (group_sections): Init group tls_get_addr_opt_bctrl.
2031         (ppc64_elf_size_stubs): Update sizing and initialization of
2032         .eh_frame.  Iteration over stubs via group list.
2033         (ppc64_elf_build_stubs): Iterate over stubs via group list.
2034         (ppc64_elf_finish_dynamic_sections): Update finalization of
2035         .eh_frame.
2036
2037 2017-07-24  Nick Clifton  <nickc@redhat.com>
2038
2039         PR 21813
2040         * mach-o.c (bfd_mach_o_canonicalize_relocs): Pass the base address
2041         of the relocs to the canonicalize_one_reloc routine.
2042         * mach-o.h (struct bfd_mach_o_backend_data): Update the prototype
2043         for the _bfd_mach_o_canonicalize_one_reloc field.
2044         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add
2045         res_base parameter.  Use to check for corrupt pair relocs.
2046         * mach-o-aarch64.c (bfd_mach_o_arm64_canonicalize_one_reloc):
2047         Likewise.
2048         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc):
2049         Likewise.
2050         * mach-o-x86-64.c (bfd_mach_o_x86_64_canonicalize_one_reloc):
2051         Likewise.
2052
2053         * vms-alpha.c (_bfd_vms_slurp_eihd): Make sure that there is
2054         enough data in the record before attempting to parse it.
2055         (_bfd_vms_slurp_eeom): Likewise.
2056
2057         (_bfd_vms_slurp_egsd): Check for an invalid section index.
2058         (image_set_ptr): Likewise.
2059         (alpha_vms_slurp_relocs): Likewise.
2060
2061         (alpha_vms_object_p): Check for a truncated record.
2062
2063 2017-07-24  Nick Clifton  <nickc@redhat.com>
2064
2065         PR 21803
2066         * reloc.c (_bfd_unrecognized_reloc): New function.  Reports
2067         an unrecognized reloc and sets the bfd_error value.
2068         * libbfd.h: Regenerate.
2069         * elf32-arm.c (elf32_arm_final_link_relocate): Use the new
2070         function.
2071         * elf32-i386.c (elf_i386_relocate_section): Likewise.
2072         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
2073         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2074         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
2075         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
2076
2077 2017-07-23  Alan Modra  <amodra@gmail.com>
2078
2079         * elf64-ppc.c (ppc64_elf_size_stubs): Correct advance to
2080         restore of LR.
2081
2082 2017-07-19  Szabolcs Nagy  <szabolcs.nagy@arm.com>
2083
2084         PR ld/18841
2085         * elfnn-aarch64.c (elfNN_aarch64_reloc_type_class): Return
2086         reloc_class_ifunc for ifunc symbols.
2087
2088 2017-07-19  Nick Clifton  <nickc@redhat.com>
2089
2090         PR 21787
2091         * archive.c (bfd_generic_archive_p): If the bfd does not have the
2092         correct magic bytes at the start, set the error to wrong format
2093         and clear the format selector before returning NULL.
2094
2095 2017-07-19  Nick Clifton  <nickc@redhat.com>
2096
2097         PR 21786
2098         * coff-rs6000.c (_bfd_strntol): New function.
2099         (_bfd_strntoll): New function.
2100         (GET_VALUE_IN_FIELD): New macro.
2101         (EQ_VALUE_IN_FIELD): new macro.
2102         (_bfd_xcoff_slurp_armap): Use new macros.
2103         (_bfd_xcoff_archive_p): Likewise.
2104         (_bfd_xcoff_read_ar_hdr): Likewise.
2105         (_bfd_xcoff_openr_next_archived_file): Likewise.
2106         (_bfd_xcoff_stat_arch_elt): Likewise.
2107         * coff64-rs6000.c (_bfd_strntol): New function.
2108         (_bfd_strntoll): New function.
2109         (GET_VALUE_IN_FIELD): New macro.
2110         (xcoff64_slurp_armap): Use new macros.
2111
2112 2017-07-19  Claudiu Zissulescu  <claziss@synopsys.com>
2113             John Eric Martin  <John.Martin@emmicro-us.com>
2114
2115         * bfd-in2.h: Regenerate.
2116         * libbfd.h: Regenerate.
2117         * elf32-arc.c (JLI): Define.
2118         * reloc.c: Add JLI relocations.
2119
2120 2017-07-18  Nick Clifton  <nickc@redhat.com>
2121
2122         PR 21775
2123         * coff-sh.c: Fix spelling typos.
2124         * compress.c: Likewise.
2125         * cpu-pdp11.c: Likewise.
2126         * ecofflink.c: Likewise.
2127         * elf-m10300.c: Likewise.
2128         * elf.c: Likewise.
2129         * elf32-arm.c: Likewise.
2130         * elf32-m68k.c: Likewise.
2131         * elf32-nds32.c: Likewise.
2132         * elf32-ppc.c: Likewise.
2133         * elf32-sh.c: Likewise.
2134         * elf32-v850.c: Likewise.
2135         * elf64-ppc.c: Likewise.
2136         * elf64-x86-64.c: Likewise.
2137         * elflink.c: Likewise.
2138         * elfnn-aarch64.c: Likewise.
2139         * elfxx-mips.c: Likewise.
2140         * som.c: Likewise.
2141         * sunos.c: Likewise.
2142         * vms-alpha.c: Likewise.
2143         * xcofflink.c: Likewise.
2144
2145 2017-07-18  Nick Clifton  <nickc@redhat.com>
2146
2147         PR binutils/21781
2148         * coffcode.h (handle_COMDAT): Replace abort with an error message
2149         and return.
2150
2151 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
2152
2153         PR ld/21782
2154         * elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check
2155         to shared library.
2156
2157 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
2158
2159         * elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
2160
2161 2017-07-16  Alan Modra  <amodra@gmail.com>
2162
2163         * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
2164         __tls_index GOT entries when using __tls_get_addr_opt stub.
2165         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
2166
2167 2017-07-12  Alan Modra  <amodra@gmail.com>
2168
2169         * po/es.po: Update from translationproject.org/latest/bfd/.
2170         * po/fi.po: Likewise.
2171         * po/fr.po: Likewise.
2172         * po/id.po: Likewise.
2173         * po/ja.po: Likewise.
2174         * po/ro.po: Likewise.
2175         * po/ru.po: Likewise.
2176         * po/sr.po: Likewise.
2177         * po/sv.po: Likewise.
2178         * po/tr.po: Likewise.
2179         * po/uk.po: Likewise.
2180         * po/vi.po: Likewise.
2181         * po/zh_CN.po: Likewise.
2182         * po/hr.po: New file from translationproject.org.
2183         * configure.ac (ALL_LINGUAS): Add hr.  Sort.
2184         * configure: Regenerate.
2185
2186 2017-07-12  Nick Clifton  <nickc@redhat.com>
2187
2188         Fix compile time warnings using gcc 7.1.1.
2189         * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
2190         plt_name buffer.
2191         (elf_xtensa_get_gotplt_section): Increase length of got_name
2192         buffer.
2193         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
2194         default return of FALSE.
2195         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
2196         default return of FALSE.
2197
2198 2017-07-12  Alan Modra  <amodra@gmail.com>
2199
2200         * binary.c (binary_set_section_contents): Don't print filepos in
2201         error message.
2202         (coff_write_object_contents): Cast size_t for error message.
2203         (coff_slurp_line_table): Don't use bfd_vma symndx.
2204         (coff_slurp_reloc_table): Remove unneeded cast.
2205         * dwarf2.c (read_section): Cast bfd_int64_t to long long for
2206         error message.
2207         (find_abstract_instance_name): Likewise.
2208         * elf32-arm.c (arm_type_of_stub): Correct error arg order.
2209         (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
2210         (elf32_arm_check_relocs): Make r_symndx an int.
2211         * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
2212         format string.
2213         * elf32-metag.c (elf_metag_relocate_section): Delete extra error
2214         message arg.
2215         * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
2216         error message.
2217         * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
2218         * elf32-s390.c (elf_s390_check_relocs): Likewise.
2219         * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
2220         * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
2221         * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
2222         * elf64-s390.c (elf_s390_check_relocs): Likewise.
2223         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
2224         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
2225         * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
2226         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
2227         * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
2228         * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
2229         and use %lu for error message.
2230         * elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
2231         * mmo.c (mmo_scan): Make stab_loc a file_ptr.  Cast expression for
2232         error message.
2233
2234         * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
2235         in error message.
2236         (elf32_arm_final_link_relocate): Likewise.
2237         * coff-arm.c (bfd_arm_process_before_allocation): Likewise.
2238         * coffcode.h (styp_to_sec_flags): Likewise.
2239         * cofflink.c (_bfd_coff_write_global_sym): Likewise.
2240         * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
2241         * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
2242         * elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
2243         (elf32_bfin_merge_private_bfd_data): Likewise.
2244         * elf32-cris.c (cris_elf_relocate_section): Likewise.
2245         * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
2246         * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
2247         (i370_elf_relocate_section): Likewise.
2248         * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
2249         * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
2250         * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
2251         * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
2252         * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
2253         * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
2254         * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
2255         * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
2256         (_bfd_mips_elf_merge_private_bfd_data): Likewise.
2257         * ieee.c (ieee_write_id, read_id): Likewise.
2258         * mach-o.c (bfd_mach_o_write_contents): Likewise.
2259         (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
2260         (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
2261         (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
2262         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
2263         * stabs.c (_bfd_link_section_stabs): Likewise.
2264
2265         * coff-arm.c (coff_arm_relocate_section): Use L modifier in error
2266         format.
2267         * coff-mcore.c (coff_mcore_relocate_section): Likewise.
2268         * coff-ppc.c (coff_ppc_relocate_section): Likewise.
2269         * coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
2270         * coff-sh.c (sh_relax_section): Likewise.
2271         (sh_relax_delete_bytes, sh_swap_insns): Likewise.
2272         * coff-tic80.c (coff_tic80_relocate_section): Likewise.
2273         * coffcode.h (coff_slurp_reloc_table): Likewise.
2274         * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
2275         (_bfd_coff_read_string_table): Likewise.
2276         * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
2277         * compress.c (bfd_get_full_section_contents): Likewise.
2278         * dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
2279         * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
2280         * elf.c (bfd_elf_string_from_elf_section): Likewise.
2281         * elf32-arc.c (arc_special_overflow_checks): Likewise.
2282         * elf32-arm.c (elf32_arm_tls_relax): Likewise.
2283         (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
2284         (elf32_arm_write_section): Likewise.
2285         * elf32-bfin.c (bfin_relocate_section): Likewise.
2286         (bfinfdpic_relocate_section): Likewise.
2287         * elf32-hppa.c (hppa_build_one_stub): Likewise.
2288         (final_link_relocate, elf32_hppa_relocate_section): Likewise.
2289         * elf32-i386.c (elf_i386_tls_transition): Likewise.
2290         (elf_i386_relocate_section): Likewise.
2291         * elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
2292         * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
2293         * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
2294         * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
2295         * elf32-metag.c (elf_metag_relocate_section): Likewise.
2296         * elf32-nds32.c (unrecognized_reloc_msg): Likewise.
2297         (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
2298         (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
2299         (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
2300         (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
2301         (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
2302         (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
2303         (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
2304         (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
2305         * elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
2306         * elf32-rx.c (UNSAFE_FOR_PID): Likewise.
2307         * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
2308         * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
2309         * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
2310         * elf32-sh.c (sh_elf_relax_section): Likewise.
2311         (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
2312         (sh_elf_relocate_section): Likewise.
2313         * elf32-sh64.c (shmedia_prepare_reloc): Likewise.
2314         * elf32-spu.c (spu_elf_relocate_section): Likewise.
2315         * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
2316         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
2317         * elf32-v850.c (v850_elf_relax_section): Likewise.
2318         * elf32-vax.c (elf_vax_check_relocs): Likewise.
2319         (elf_vax_relocate_section): Likewise.
2320         * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
2321         (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
2322         (compute_text_actions, compute_ebb_proposed_actions): Likewise.
2323         (do_fix_for_relocatable_link): Likewise.
2324         * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
2325         (elf64_alpha_relax_with_lituse): Likewise.
2326         * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
2327         (elf_hppa_final_link_relocate): Likewise.
2328         * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
2329         (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
2330         (elf64_vms_link_add_object_symbols): Likewise.
2331         * elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
2332         (mmix_final_link_relocate): Likewise.
2333         * elf64-s390.c (invalid_tls_insn): Likewise.
2334         (elf_s390_relocate_section): Likewise.
2335         * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
2336         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
2337         (elf_x86_64_relocate_section): Likewise.
2338         * elfcode.h (elf_slurp_symbol_table): Likewise.
2339         * elfcore.h (elf_core_file_p): Likewise.
2340         * elflink.c (elf_link_read_relocs_from_section): Likewise.
2341         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
2342         (elfNN_aarch64_relocate_section): Likewise.
2343         * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
2344         (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
2345         * elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
2346         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
2347         (_bfd_mips_elf_relocate_section): Likewise.
2348         (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
2349         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
2350         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
2351         * ieee.c (ieee_slurp_external_symbols): Likewise.
2352         * ihex.c (ihex_write_object_content): Likewise.
2353         * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
2354         * merge.c (_bfd_merged_section_offset): Likewise.
2355         * mmo.c (mmo_write_loc_chunk): Likewise.
2356         (mmo_write_object_contents): Likewise.
2357         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
2358         * stabs.c (_bfd_link_section_stabs): Likewise.
2359         * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
2360
2361 2017-07-11  Alan Modra  <amodra@gmail.com>
2362
2363         * elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
2364
2365 2017-07-11  Alan Modra  <amodra@gmail.com>
2366
2367         * elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
2368         instruction" error using _bfd_error_handler, not einfo.
2369
2370 2017-07-10  Nick Clifton  <nickc@redhat.com>
2371
2372         * coffcode.h (coff_slurp_symbol_table): Do not include an entry
2373         for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
2374
2375 2017-07-07  John Baldwin  <jhb@FreeBSD.org>
2376
2377         * elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
2378
2379 2017-07-07  Alan Modra  <amodra@gmail.com>
2380
2381         * coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.
2382
2383 2017-07-07  Alan Modra  <amodra@gmail.com>
2384
2385         * bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
2386         as long long.  Move code replacing "ll" with "I64", and simplify.
2387
2388 2017-07-06  H.J. Lu  <hongjiu.lu@intel.com>
2389
2390         * bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
2391         to 1.
2392
2393 2017-07-05  H.J. Lu  <hongjiu.lu@intel.com>
2394
2395         * dwarf2.c (line_info_add_include_dir_stub): Replace time with
2396         xtime.
2397         (line_info_add_file_name): Likewise.
2398         (decode_line_info): Likewise.
2399
2400 2017-07-04  Tristan Gingold  <gingold@adacore.com>
2401
2402         * version.m4: Bump version to 2.29.51
2403         * configure: Regenerate.
2404
2405 2017-07-04  Jiong Wang  <jiong.wang@arm.com>
2406
2407         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
2408         sanity check at the head of this function.
2409
2410 2017-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
2411
2412         * dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
2413         dwarf_line_str_size.
2414         (struct attr_abbrev): Add field implicit_const.
2415         (dwarf_debug_sections): Add .debug_line_str.
2416         (enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
2417         (dwarf_debug_section_assert): Add static assertion.
2418         (read_indirect_line_string): New.
2419         (read_abbrevs): Support DW_FORM_implicit_const.
2420         (is_str_attr): Support DW_FORM_line_strp.
2421         (read_attribute_value): Support DW_FORM_line_strp and
2422         DW_FORM_implicit_const.
2423         (read_attribute): Support DW_FORM_implicit_const.
2424         (line_info_add_include_dir, line_info_add_include_dir_stub):
2425         (line_info_add_file_name, read_formatted_entries): New.
2426         (decode_line_info, parse_comp_unit): Support DWARF 5.
2427         (_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.
2428
2429 2017-07-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
2430
2431         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
2432         abort statement that was put for symbols that are not dynamic.
2433
2434 2017-07-03  Tristan Gingold  <gingold@adacore.com>
2435
2436         * po/bfd.pot: Regenerate
2437
2438 2017-07-03  Alan Modra  <amodra@gmail.com>
2439
2440         * bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
2441         __MSVCRT__.  Support "L" modifier for bfd_vma.  Formatting.
2442         * elf.c (setup_group): Use "Lx" to print sh_size.
2443         (_bfd_elf_setup_sections): Remove unnecessary cast and print
2444         unknown section type in hex.
2445         (copy_special_section_fields): Style fix.
2446         (bfd_section_from_shdr): Correct format for sh_link.  Use a
2447         common error message for all the variants of unrecognized
2448         section types.
2449         (assign_file_positions_for_load_sections): Use "Lx" for lma
2450         adjust error message.
2451         (assign_file_positions_for_non_load_sections): Formatting.
2452         (rewrite_elf_program_header): Formatting.  Use "Lx" for
2453         bfd_vma values in error messages.
2454         * elfcode.h (elf_slurp_reloc_table_from_section): Cast
2455         ELF_R_SYM value to type expected by format.
2456         * elflink.c (elf_link_read_relocs_from_section): Use "Lx"
2457         in error messages.
2458         (elf_link_add_object_symbols): Use "Lu" for symbol sizes.
2459         (elf_link_input_bfd): Use "Lx" for r_info.
2460         (bfd_elf_gc_record_vtinherit): Use "Lx" for offset.
2461
2462 2017-07-03  Alan Modra  <amodra@gmail.com>
2463
2464         * bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
2465         * coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
2466         Microsoft C library variant of long long format specifier.
2467         (PRINT20): Cast value to bfd_uint64_t not long long.
2468         * coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
2469         * coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
2470         long long.  Don't cast to bfd_vma.
2471         * elf32-score.c (score3_bfd_getl48): Likewise.
2472         * vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.
2473
2474 2017-07-03  Alan Modra  <amodra@gmail.com>
2475
2476         * elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
2477         print d_tag.
2478         (bfd_elf_print_symbol): Don't cast symbol->flags.
2479         (_bfd_elf_symbol_from_bfd_symbol): Likewise.
2480         * elf32-ppc.c (ppc_elf_begin_write_processing): Correct
2481         _bfd_error_handler argument order.
2482         (ppc_elf_merge_private_bfd_data): Don't cast flags.
2483
2484 2017-07-03  Alan Modra  <amodra@gmail.com>
2485
2486         * configure.ac: Invoke AC_CHECK_TYPES for long long.  Invoke
2487         AC_TYPE_LONG_DOUBLE.
2488         * configure: Regenerate.
2489         * config.in: Regenerate.
2490
2491 2017-06-29  Andrew Waterman  <andrew@sifive.com>
2492
2493         * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
2494         relocs.
2495
2496 2017-06-29  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
2497
2498         * elfxx-sparc.c (allocate_dynrelocs): Don't make a symbol dynamic
2499         unless it is undefined weak.
2500         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Set the flag
2501         relative_reloc to direct non-dynamic symbols to R_SPARC_RELATIVE
2502         relocation.
2503         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): If symbol
2504         is not dynamic in PIC, abort.
2505
2506 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
2507
2508         PR ld/21402
2509         * elfnn-aarch64.c (elfNN_aarch64_allocate_dynrelocs): Only make
2510         undefined weak symbols into dynamic.
2511         (elfNN_aarch64_final_link_relocate): Generate runtime RELATIVE
2512         relocation for non-dynamic symbols.
2513         (elfNN_aarch64_finish_dynamic_symbol): Add sanity check.
2514
2515 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
2516
2517         * elfnn-aarch64.c (aarch64_relocation_aginst_gp_p): New function.
2518         (elfNN_aarch64_final_link_relocate): Delete duplicated code for
2519         BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
2520         BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
2521         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Optimize the
2522         support for them.
2523
2524 2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
2525
2526         * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
2527         (elfcore_write_s390_gs_bc): Likewise.
2528         * elf.c (elfcore_grok_s390_gs_cb): New function.
2529         (elfcore_grok_s390_gs_bc): New function.
2530         (elfcore_grok_note): Call them.
2531         (elfcore_write_s390_gs_cb): New function.
2532         (elfcore_write_s390_gs_bc): New function.
2533         (elfcore_write_register_note): Call them.
2534
2535 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
2536
2537         * libbfd.c (_bfd_generic_get_section_contents): Don't call
2538         bfd_get_file_size.  Check archive element size.
2539         (_bfd_generic_get_section_contents_in_window): Likewise.
2540
2541 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
2542
2543         * bfd-in2.h: Regenerated.
2544         * bfdio.c (bfd_get_size): Change return type to ufile_ptr.
2545         (bfd_get_file_size): Likewise.
2546
2547 2017-06-28  Maciej W. Rozycki  <macro@imgtec.com>
2548             Matthew Fortune  <matthew.fortune@imgtec.com>
2549
2550         * archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
2551         * cpu-mips.c (I_interaptiv_mr2): New enum value.
2552         (arch_info_struct): Add "mips:interaptiv-mr2" entry.
2553         * elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
2554         case.
2555         (mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
2556         (bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
2557         (print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
2558         (mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
2559         `bfd_mach_mips_interaptiv_mr2' entries.
2560         * bfd-in2.h: Regenerate.
2561
2562 2017-06-27  Nick Clifton  <nickc@redhat.com>
2563
2564         * tekhex.c (pass_over): Revert accidental conversion of a local
2565         array to a static array.
2566
2567 2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
2568
2569         PR ld/13402
2570         * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
2571         reloc addend if necessary. Adjust diff only if
2572         shrinked_insn_address < end_address.
2573
2574 2017-06-27  Alan Modra  <amodra@gmail.com>
2575
2576         PR binutils/21665
2577         * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
2578         (_bfd_generic_get_section_contents_in_window): Likewise.
2579
2580 2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>
2581
2582         * elfnn-riscv.c (perform_relocation): Support the new
2583         R_RISCV_32_PCREL relocation.
2584         (riscv_elf_relocate_section): Likewise.
2585         * elfxx-riscv.c (howto_table): Likewise.
2586         (riscv_reloc_map): Likewise.
2587         * bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
2588         * libbfd.h: Regenerate.
2589
2590 2017-06-27  Alan Modra  <amodra@gmail.com>
2591
2592         PR binutils/21665
2593         * libbfd.c (_bfd_generic_get_section_contents): Delete abort.
2594         Use unsigned file pointer type, and remove cast.
2595         * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
2596         Add "count", not "sz".
2597
2598 2017-06-26  Pedro Alves  <palves@redhat.com>
2599
2600         PR binutils/21665
2601         * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
2602         "sz".
2603
2604 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
2605
2606         PR binutils/21665
2607         * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
2608         a missing line.
2609
2610 2017-06-26  Maciej W. Rozycki  <macro@imgtec.com>
2611
2612         * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
2613         * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
2614         E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
2615         (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
2616         `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
2617
2618 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
2619
2620         PR binutils/21665
2621         * compress.c (bfd_get_full_section_contents): Don't check the
2622         file size here.
2623         * libbfd.c (_bfd_generic_get_section_contents): Check for and
2624         reject a section whose size + offset is greater than the size
2625         of the entire file.
2626         (_bfd_generic_get_section_contents_in_window): Likewise.
2627
2628 2017-06-26  Nick Clifton  <nickc@redhat.com>
2629
2630         PR binutils/21670
2631         * tekhex.c (getvalue): Check for the source pointer exceeding the
2632         end pointer before the first byte is read.
2633
2634 2017-06-26  Nick Clifton  <nickc@redhat.com>
2635
2636         PR binutils/21665
2637         * opncls.c (get_build_id): Check that the section is big enough
2638         to contain the whole note.
2639         * compress.c (bfd_get_full_section_contents): Check for and reject
2640         a section whose size is greater than the size of the entire file.
2641         * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
2642         contain a notes section.
2643
2644 2017-06-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
2645
2646         * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
2647         pointer checks.
2648         (elf_s390_modify_segment_map): Likewise.
2649         (bfd_elf_s390_set_options): Lisewise.
2650
2651 2017-06-26  Alan Modra  <amodra@gmail.com>
2652
2653         * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
2654         a --just-syms bfd.
2655         (_bfd_elf_size_group_sections): Skip --just-syms bfds.
2656         (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
2657         .preinit_array on --just-syms bfds.
2658         (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
2659         (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
2660         (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
2661
2662 2017-06-25  Sergei Trofimovich  <slyfox@gentoo.org>
2663
2664         * elf.c (find_link): Bounds check "hint".
2665
2666 2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>
2667
2668         * elf32-arm.c (using_thumb_only): Update list of architectures in
2669         BFD_ASSERT for which the logic is valid.
2670         (using_thumb2_bl): Likewise.
2671         (using_thumb2): Likewise and return true for ARMv8-R.
2672         (arch_has_arm_nop): Likewise.
2673         (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
2674         merging logic.  Update commentis for value 15 of v8m_baseline,
2675         v8m_mainline and v4t_plus_v6_m arrays.  Use v8r array to decide
2676         merging of value 15 of Tag_CPU_arch.
2677
2678 2017-06-23  Jiong Wang  <jiong.wang@arm.com>
2679
2680         * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
2681         BFD_RELOC_AARCH64_ADR_GOT_PAGE
2682         * bfd-in2.h: Regenerate.
2683
2684 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
2685
2686         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
2687         the error_alignment label forward.  Properly align program
2688         property note section.
2689
2690 2017-06-22  Eric Christopher  <echristo@gmail.com>
2691
2692         * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
2693         abs to fix a truncation warning.
2694
2695 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
2696
2697         * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
2698         local undefined weak symbol to 0.
2699         * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
2700
2701 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
2702
2703         * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
2704         is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
2705         (elf_i386_link_setup_gnu_properties): If info->shstk is set,
2706         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
2707         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
2708         info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
2709         (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
2710         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
2711
2712 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
2713
2714         * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
2715         (elf_i386_lazy_ibt_plt_entry): Likewise.
2716         (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
2717         (elf_i386_non_lazy_ibt_plt_entry): Likewise.
2718         (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
2719         (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
2720         (elf_i386_lazy_plt_layout): Likewise.
2721         (elf_i386_non_lazy_plt_layout): Likewise.
2722         (elf_i386_link_hash_entry): Add plt_second.
2723         (elf_i386_link_hash_table): Add plt_second and
2724         plt_second_eh_frame.
2725         (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
2726         (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
2727         the second PLT.  Check the second PLT.
2728         (elf_i386_relocate_section): Use the second PLT to resolve
2729         PLT reference if needed.
2730         (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
2731         needed.
2732         (elf_i386_finish_dynamic_sections): Set sh_entsize on the
2733         second PLT.  Generate unwind info for the second PLT.
2734         (elf_i386_plt_type): Add plt_second.
2735         (elf_i386_get_synthetic_symtab): Support the second PLT.
2736         (elf_i386_parse_gnu_properties): Support
2737         GNU_PROPERTY_X86_FEATURE_1_AND.
2738         (elf_i386_merge_gnu_properties): Support
2739         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
2740         on GNU_PROPERTY_X86_FEATURE_1_IBT
2741         (elf_i386_link_setup_gnu_properties): If info->ibt is set,
2742         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
2743         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
2744         is set on all relocatable inputs.
2745         * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
2746         (elf_x32_lazy_ibt_plt_entry): Likewise.
2747         (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
2748         (elf_x32_non_lazy_ibt_plt_entry): Likewise.
2749         (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
2750         (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
2751         (elf_x86_64_lazy_ibt_plt): Likewise.
2752         (elf_x32_lazy_ibt_plt): Likewise.
2753         (elf_x86_64_non_lazy_ibt_plt): Likewise.
2754         (elf_x32_non_lazy_ibt_plt): Likewise.
2755         (elf_x86_64_get_synthetic_symtab): Support the second PLT.
2756         (elf_x86_64_parse_gnu_properties): Support
2757         GNU_PROPERTY_X86_FEATURE_1_AND.
2758         (elf_x86_64_merge_gnu_properties): Support
2759         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
2760         on GNU_PROPERTY_X86_FEATURE_1_IBT
2761         (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
2762         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
2763         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
2764         is set on all relocatable inputs.
2765
2766 2017-06-22  Nick Clifton  <nickc@redhat.com>
2767
2768         PR binutils/21649
2769         * som.c (setup_sections): NUL terminate the space_strings buffer.
2770         Check that the space.name field does not index beyond the end of
2771         the space_strings buffer.
2772
2773 2017-06-21  Nick Clifton  <nickc@redhat.com>
2774
2775         PR binutils/21646
2776         * coff-sh.c (sh_reloc): Check for an out of range reloc.
2777
2778 2017-06-21  Nick Clifton  <nickc@redhat.com>
2779
2780         PR binutils/21639
2781         * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
2782         type of the size parameter.
2783         (_bfd_vms_save_counted_string): Add second parameter - the maximum
2784         length of the counted string.
2785         * vms.h (_bfd_vms_save_sized_string): Update prototype.
2786         (_bfd_vms_save_counted_string): Likewise.
2787         * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
2788         _bfd_vms_save_counted_string.
2789         (_bfd_vms_slurp_ehdr): Likewise.
2790         (_bfd_vms_slurp_egsd): Likewise.
2791         (Parse_module): Likewise.
2792
2793 2017-06-21  Alan Modra  <amodra@gmail.com>
2794
2795         * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
2796         calls before tocsave calls.
2797         (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
2798         following nop.
2799
2800 2017-06-21  Nick Clifton  <nickc@redhat.com>
2801
2802         PR binutils/21645
2803         * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
2804         bfd_get_full_section_contents returns no contents.
2805
2806 2017-06-21  Nick Clifton  <nickc@redhat.com>
2807
2808         PR binutils/21638
2809         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
2810         record.
2811
2812 2017-06-21  Nick Clifton  <nickc@redhat.com>
2813
2814         PR binutils/21637
2815         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
2816         list.
2817         (image_set_ptr): Likewise.
2818         (alpha_vms_fix_sec_rel): Likewise.
2819         (alpha_vms_slurp_relocs): Likewise.
2820
2821 2017-06-21  Nick Clifton  <nickc@redhat.com>
2822
2823         PR binutils/21633
2824         * ieee.c (ieee_slurp_sections): Check for a NULL return from
2825         read_id.
2826         (ieee_archive_p): Likewise.
2827         (ieee_object_p): Likewise.
2828
2829 2017-06-21  Nick Clifton  <nickc@redhat.com>
2830
2831         PR binutils/21640
2832         * elf.c (setup_group): Zero the group section pointer list after
2833         allocation so that loops can be caught.  Check for NULL pointers
2834         when processing a group list.
2835
2836 2017-06-20  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
2837
2838         * elf-s390.h: New file.
2839         * elf64-s390.c (struct elf_s390_link_hash_table): Add params
2840         field.
2841         (elf_s390_additional_program_headers): New function.
2842         (elf_s390_modify_segment_map): New function.
2843         (bfd_elf_s390_set_options): New function.
2844         (elf_backend_additional_program_headers)
2845         (elf_backend_modify_segment_map): Add macro definitions.
2846
2847 2017-06-19  H.J. Lu  <hongjiu.lu@intel.com>
2848
2849         PR ld/21626
2850         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
2851         the DYNAMIC bit instead of bfd_count_sections.
2852
2853 2017-06-19  Nick Clifton  <nickc@redhat.com>
2854
2855         PR binutils/21618
2856         * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
2857         length.
2858         (evax_bfd_print_eeom): Likewise.
2859         (evax_bfd_print_egsd): Check for an overlarge record length.
2860         (evax_bfd_print_etir): Likewise.
2861
2862 2017-06-19  Nick Clifton  <nickc@redhat.com>
2863
2864         PR binutils/21612
2865         * libieee.h (struct common_header_type): Add end_p field.
2866         * ieee.c (this_byte_and_next): Do not advance input_p beyond
2867         end_p.
2868         (read_id): Check for a length that exceeds the remaining bytes in
2869         the input buffer.
2870         (ieee_seek): Initialise end_p.
2871         (ieee_archive_p): Likewise.
2872         (ieee_object_p): Likewise.
2873
2874 2017-06-19  Nick Clifton  <nickc@redhat.com>
2875
2876         PR binutils/21611
2877         * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
2878         before reading the EIHS structure entries.
2879
2880 2017-06-19  Nick Clifton  <nickc@redhat.com>
2881
2882         PR binutils/21615
2883         * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
2884         gsd_size.  Check that there are enough bytes remaining to read the
2885         type and size of the next egsd.  Check that the size of the egsd
2886         does not exceed the size of the record.
2887
2888 2017-06-19  Alan Modra  <amodra@gmail.com>
2889
2890         * config.bfd: Correct targ_underscore for cris.
2891
2892 2017-06-18  Alan Modra  <amodra@gmail.com>
2893
2894         * config.bfd: Correct targ_underscore for epiphany, ip2k,
2895         m32c, mn10200, pru, rl78, rx, crisv32 and v850.
2896
2897 2017-06-16  Nick Clifton  <nickc@redhat.com>
2898
2899         * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
2900         bucketlist is empty because there are no symbols to add to the
2901         list.
2902
2903 2017-06-16  Alan Modra  <amodra@gmail.com>
2904
2905         PR ld/20022
2906         PR ld/21557
2907         PR ld/21562
2908         PR ld/21571
2909         * targets.c (struct bfd_target): Add _bfd_define_start_stop.
2910         (BFD_JUMP_TABLE_LINK): Likewise.
2911         * elf-bfd.h (bfd_elf_define_start_stop): Declare.
2912         * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
2913         (bfd_elf_define_start_stop): New function.
2914         * linker.c (bfd_generic_define_start_stop): New function.
2915         * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
2916         new field.
2917         * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
2918         * aout-target.h (MY_bfd_define_start_stop): Define.
2919         * aout-tic30.c (MY_bfd_define_start_stop): Define.
2920         * binary.c (binary_bfd_define_start_stop): Define.
2921         * bout.c (b_out_bfd_define_start_stop): Define.
2922         * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
2923         * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
2924         * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
2925         * coffcode.h (coff_bfd_define_start_stop): Define.
2926         * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
2927         * i386msdos.c (msdos_bfd_define_start_stop): Define.
2928         * i386os9k.c (os9k_bfd_define_start_stop): Define.
2929         * ieee.c (ieee_bfd_define_start_stop): Define.
2930         * ihex.c (ihex_bfd_define_start_stop): Define.
2931         * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
2932         * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
2933         * mmo.c (mmo_bfd_define_start_stop): Define.
2934         * nlm-target.h (nlm_bfd_define_start_stop): Define.
2935         * oasys.c (oasys_bfd_define_start_stop): Define.
2936         * pef.c (bfd_pef_bfd_define_start_stop): Define.
2937         * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
2938         * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
2939         * som.c (som_bfd_define_start_stop): Define.
2940         * srec.c (srec_bfd_define_start_stop): Define.
2941         * tekhex.c (tekhex_bfd_define_start_stop): Define.
2942         * versados.c (versados_bfd_define_start_stop): Define.
2943         * vms-alpha.c (vms_bfd_define_start_stop): Define.
2944         (alpha_vms_bfd_define_start_stop): Define.
2945         * xsym.c (bfd_sym_bfd_define_start_stop): Define.
2946         * bfd-in2.h: Regenerate.
2947         * libbfd.h: Regenerate.
2948
2949 2017-06-16  Jiong Wang  <jiong.wang@arm.com>
2950
2951         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
2952         SYMBOL_REFERENCES_LOCAL.
2953
2954 2017-06-15  Jiong Wang  <jiong.wang@arm.com>
2955
2956         PR ld/21532
2957         * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
2958         (elfNN_aarch64_final_link_relocate): Also propagate relocations to
2959         runtime for if there needs copy relocation elimination.
2960         (need_copy_relocation_p): New function.  Return true for symbol with
2961         pc-relative references and if it's against read-only sections.
2962         (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
2963         (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
2964         that are related with accessing external objects.
2965         (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
2966         in elfNN_aarch64_check_relocs.
2967
2968 2017-06-15  Nick Clifton  <nickc@redhat.com>
2969
2970         PR binutils/21582
2971         * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
2972         bugs.
2973         PR binutils/21581
2974         (ieee_archive_p): Likewise.
2975
2976 2017-06-15  Nick Clifton  <nickc@redhat.com>
2977
2978         PR binutils/21579
2979         * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
2980
2981 2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
2982
2983         * elf32-xtensa.c (elf_xtensa_be_plt_entry,
2984         elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
2985         keep both windowed and call0 ABI PLT definitions.
2986         (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
2987         elf_xtensa_*_plt_entry endex.
2988         (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
2989
2990 2017-06-14  Nick Clifton  <nickc@redhat.com>
2991
2992         PR binutils/21578
2993         * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
2994         flag value.
2995
2996 2017-06-14  Nick Clifton  <nickc@redhat.com>
2997
2998         PR binutils/21589
2999         * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
3000         maximum value for the ascic pointer.  Check that name processing
3001         does not read beyond this value.
3002         (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
3003         end of etir record.
3004
3005 2017-06-14  Nick Clifton  <nickc@redhat.com>
3006
3007         PR binutils/21591
3008         * versados.c (versados_mkobject): Zero the allocated tdata structure.
3009         (process_otr): Check for an invalid offset in the otr structure.
3010
3011 2017-06-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3012
3013         * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
3014
3015 2017-06-13  H.J. Lu  <hongjiu.lu@intel.com>
3016
3017         PR ld/20022
3018         PR ld/21557
3019         PR ld/21562
3020         PR ld/21571
3021         * elf-bfd.h (elf_link_hash_entry): Add start_stop.  Change the
3022         vtable field to a union.
3023         (_bfd_elf_is_start_stop): Removed.
3024         * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
3025         __start_SECNAME and __stop_SECNAME symbols.
3026         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
3027         * elflink.c (_bfd_elf_is_start_stop): Removed.
3028         (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
3029         _bfd_elf_is_start_stop.
3030         (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
3031         __stop_SECNAME symbols.  Updated.
3032         (elf_gc_smash_unused_vtentry_relocs): Likewise.
3033         (bfd_elf_gc_record_vtinherit): Likewise.
3034         (bfd_elf_gc_record_vtentry): Likewise.
3035
3036 2017-06-13  Nick Clifton  <nickc@redhat.com>
3037
3038         PR ld/21524
3039         * elflink.c (elf_link_adjust_relocs): Generate an error when
3040         encountering a reloc against a symbol removed by garbage
3041         collection.
3042
3043 2017-06-12  H.J. Lu  <hongjiu.lu@intel.com>
3044
3045         * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
3046         to merge_gnu_properties.
3047         * elf-properties.c (elf_merge_gnu_properties): Add struct
3048         bfd_link_info * and pass it to merge_gnu_properties.
3049         (elf_merge_gnu_property_list): Add struct bfd_link_info *
3050         and pass it to elf_merge_gnu_properties.
3051         (_bfd_elf_link_setup_gnu_properties): Pass info to
3052         elf_merge_gnu_property_list.
3053         * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
3054         bfd_link_info *.
3055         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
3056
3057 2017-06-11  Joe Zbiciak  <joe.zbiciak@leftturnonly.info>
3058
3059         PR 21564
3060         * binary.c (binary_set_section_contents): Scale lma by octets
3061         per byte to set filepos.
3062
3063 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3064
3065         * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
3066         dynamic sections.
3067
3068 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3069
3070         * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
3071         require TEXTREL.
3072
3073 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3074
3075         * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
3076         patched section contents for TLS IE reloc.
3077         * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
3078
3079 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3080
3081         * elf32-arc.c (elf_arc_relocate_section): Added "call" to
3082         RELOC_FOR_GLOBAL_SYMBOL macro.
3083
3084 2018-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3085
3086         * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
3087         changes.
3088
3089 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3090
3091         * config/tc-arc.c (md_undefined_symbol): Changed.
3092         * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
3093
3094 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3095
3096         * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
3097         symbols.
3098
3099 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3100
3101         * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
3102         warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
3103
3104 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
3105
3106         * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
3107         object is created.
3108
3109 2017-06-08  Richard Earnshaw  <rearnsha@arm.com>
3110
3111         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
3112         that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
3113         is non-zero.  Add clarifying comments.
3114
3115 2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
3116
3117         * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
3118         name.  Use local IFUNC symbol name string to report unsupported
3119         non-PIC call to IFUNC function.
3120         (elf_i386_relocate_section): Dump local IFUNC name with minfo
3121         when generating R_386_IRELATIVE relocation.
3122         (elf_i386_finish_dynamic_symbol): Likewise.
3123         * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
3124         IFUNC symbol name.
3125         (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
3126         when generating R_X86_64_IRELATIVE relocation.
3127         (elf_x86_64_finish_dynamic_symbol): Likewise.
3128
3129 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
3130
3131         * elf.c (setup_group): Make sure BFD sections are created for all
3132         group sections in the input file when processing SHF_GROUP
3133         sections.
3134         (bfd_section_from_shdr): Avoid duplicating logic already
3135         implemented in `setup_group'.
3136
3137 2017-06-06  Daniel Bonniot de Ruisselet  <bonniot@gmail.com>
3138
3139         PR binutils/21546
3140         * peXXigen.c (pe_print_idata): Use the address of the first thunk
3141         if the hint address is zero.
3142
3143 2017-06-06  James Clarke  <jrtc27@jrtc27.com>
3144
3145         PR ld/19579
3146         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
3147         ELF_COMMON_DEF_P for common symbols.
3148
3149 2017-06-06  Andrew Burgess  <andrew.burgess@embecosm.com>
3150
3151         * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
3152         SEC_GROUP sections as SEC_EXCLUDE.
3153         (bfd_elf_set_group_contents): Replace use of abort with an assert.
3154         (assign_section_numbers): Use resolve_section_groups flag instead
3155         of relocatable link type.
3156         (_bfd_elf_init_private_section_data): Use resolve_section_groups
3157         flag instead of checking the final_link flag for part of the
3158         checks in here.  Fix white space as a result.
3159         * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
3160         instead of relocatable link type.
3161         (bfd_elf_final_link): Likewise.
3162
3163 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
3164
3165         * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
3166         variable `bed'.
3167         * elf32-score.c (score_elf_final_link_relocate): Likewise.
3168         (s3_bfd_score_elf_check_relocs): Likewise.
3169         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
3170         (score_elf_final_link_relocate): Likewise.
3171         (s7_bfd_score_elf_check_relocs): Likewise.
3172
3173 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
3174
3175         * elflink.c (init_reloc_cookie_rels): Remove unused variable
3176         `bed'.
3177
3178 2017-06-06  Maciej W. Rozycki  <macro@imgtec.com>
3179
3180         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
3181         from `reloc_count' rather than decrementing it.
3182         * elf.c (bfd_section_from_shdr): Multiply the adjustment to
3183         `reloc_count' by `int_rels_per_ext_rel'.
3184         * elf32-score.c (score_elf_final_link_relocate): Do not multiply
3185         `reloc_count' by `int_rels_per_ext_rel' for last relocation
3186         entry determination.
3187         (s3_bfd_score_elf_check_relocs): Likewise.
3188         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
3189         (s7_bfd_score_elf_relocate_section): Likewise.
3190         (s7_bfd_score_elf_check_relocs): Likewise.
3191         * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
3192         prototype and function.
3193         (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
3194         (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
3195         triple rather than once the sum of REL and RELA relocation entry
3196         counts.
3197         (bfd_elf64_get_reloc_upper_bound): Remove macro.
3198         * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
3199         `reloc_count' by `int_rels_per_ext_rel' for internal relocation
3200         storage allocation size determination.
3201         (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
3202         size by `int_rels_per_ext_rel'.  Do not multiply `reloc_count'
3203         by `int_rels_per_ext_rel' for last relocation entry
3204         determination.
3205         (bfd_elf_final_link): Do not multiply `reloc_count' by
3206         `int_rels_per_ext_rel' for internal relocation storage
3207         allocation size determination.
3208         (init_reloc_cookie_rels): Do not multiply `reloc_count' by
3209         `int_rels_per_ext_rel' for last relocation entry determination.
3210         (elf_gc_smash_unused_vtentry_relocs): Likewise.
3211         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
3212         (_bfd_mips_elf_relocate_section): Likewise.
3213
3214 2017-06-05  Alan Modra  <amodra@gmail.com>
3215
3216         PR 21529
3217         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
3218
3219 2017-06-01  John Baldwin  <jhb@FreeBSD.org>
3220
3221         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
3222         determine structure sizes.
3223         (elfcore_grok_freebsd_prstatus): Likewise.
3224
3225 2017-06-01  Alan Modra  <amodra@gmail.com>
3226
3227         * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
3228         (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
3229         dynamic objects.
3230         (is_elfv2_localentry0): New function.
3231         (ppc64_elf_tls_setup): Default params->plt_localentry0.
3232         (plt_stub_size): Adjust size for tls_get_addr_opt stub.
3233         (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
3234         (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
3235         optimized localentry:0 stubs.
3236         (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
3237         (ppc64_elf_relocate_section): Leave nop unchanged for optimized
3238         localentry:0 stubs.
3239         (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
3240         DT_PPC64_OPT.
3241         * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
3242
3243 2017-05-30  Casey Smith  <clegg89@gmail.com>
3244
3245         PR ld/21523
3246         * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
3247         value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
3248
3249 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
3250
3251         * cpu-arc.c (arc_compatible): New function.
3252
3253 2017-05-30  Anton Kolesov  <anton.kolesov@synopsys.com>
3254
3255         * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
3256
3257 2017-05-30  H.J. Lu  <hongjiu.lu@intel.com>
3258
3259         PR binutils/21519
3260         * bfdio.c (bfd_get_file_size): New function.
3261         * bfd-in2.h: Regenerated.
3262
3263 2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>
3264
3265         * elf32-arc.c (arc_elf_merge_attributes): Add fall through
3266         comments.
3267
3268 2017-05-22  H.J. Lu  <hongjiu.lu@intel.com>
3269
3270         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
3271         dynobj instead of htab->elf.dynobj.
3272
3273 2017-05-19  Maciej W. Rozycki  <macro@imgtec.com>
3274
3275         * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
3276         and function.
3277         (mips_elf64_canonicalize_dynamic_reloc): Likewise.
3278         (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
3279         actual number of internal relocations retrieved.  Adjust
3280         function description.
3281         (bfd_elf64_canonicalize_reloc): Remove macro.
3282         (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
3283
3284 2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
3285
3286         * archures.c (bfd_mach_sparc_v9m8): Define.
3287         (bfd_mach_sparc_v8plusm8): Likewise.
3288         (bfd_mach_sparc_v9_p): Adjust to M8.
3289         (bfd_mach_sparc_64bit_p): Likewise.
3290         * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
3291         bfd_mach_sparc_v8plusm8.
3292         * bfd-in2.h: Regenerated.
3293         * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
3294         sparc:v8plusm8.
3295         * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
3296         bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
3297         capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
3298         SHA3.
3299         * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
3300         bfd_mach_sparc_v8plusm8.
3301
3302 2017-05-19  Alan Modra  <amodra@gmail.com>
3303
3304         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
3305         debug and special sections when no non-note alloc sections in an
3306         object are kept.
3307
3308 2017-05-18  Alan Modra  <amodra@gmail.com>
3309
3310         * arc-got.h: Don't compare boolean values against TRUE or FALSE.
3311         * elf-m10300.c: Likewise.
3312         * elf.c: Likewise.
3313         * elf32-arc.c: Likewise.
3314         * elf32-bfin.c: Likewise.
3315         * elf32-m68k.c: Likewise.
3316         * elf32-nds32.c: Likewise.
3317         * elf32-tilepro.c: Likewise.
3318         * elflink.c: Likewise.
3319         * elfnn-aarch64.c: Likewise.
3320         * elfnn-riscv.c: Likewise.
3321         * elfxx-tilegx.c: Likewise.
3322         * mach-o.c: Likewise.
3323         * peXXigen.c: Likewise.
3324         * vms-alpha.c: Likewise.
3325         * vms-lib.c: Likewise.
3326
3327 2017-05-17  H.J. Lu  <hongjiu.lu@intel.com>
3328
3329         PR ld/20882
3330         * elflink.c (elf_gc_mark_debug_section): New function.
3331         (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
3332         referenced by kept debug sections.
3333
3334 2017-05-16  Alan Modra  <amodra@gmail.com>
3335
3336         * elf-m10300.c: Rename occurrences of non_ir_ref.
3337         * elf32-arm.c: Likewise.
3338         * elf32-bfin.c: Likewise.
3339         * elf32-cr16.c: Likewise.
3340         * elf32-cris.c: Likewise.
3341         * elf32-d10v.c: Likewise.
3342         * elf32-dlx.c: Likewise.
3343         * elf32-fr30.c: Likewise.
3344         * elf32-frv.c: Likewise.
3345         * elf32-hppa.c: Likewise.
3346         * elf32-i370.c: Likewise.
3347         * elf32-i386.c: Likewise.
3348         * elf32-iq2000.c: Likewise.
3349         * elf32-lm32.c: Likewise.
3350         * elf32-m32c.c: Likewise.
3351         * elf32-m32r.c: Likewise.
3352         * elf32-m68hc1x.c: Likewise.
3353         * elf32-m68k.c: Likewise.
3354         * elf32-mcore.c: Likewise.
3355         * elf32-metag.c: Likewise.
3356         * elf32-microblaze.c: Likewise.
3357         * elf32-moxie.c: Likewise.
3358         * elf32-msp430.c: Likewise.
3359         * elf32-mt.c: Likewise.
3360         * elf32-nios2.c: Likewise.
3361         * elf32-or1k.c: Likewise.
3362         * elf32-ppc.c: Likewise.
3363         * elf32-rl78.c: Likewise.
3364         * elf32-s390.c: Likewise.
3365         * elf32-score.c: Likewise.
3366         * elf32-score7.c: Likewise.
3367         * elf32-sh.c: Likewise.
3368         * elf32-tic6x.c: Likewise.
3369         * elf32-tilepro.c: Likewise.
3370         * elf32-v850.c: Likewise.
3371         * elf32-vax.c: Likewise.
3372         * elf32-xstormy16.c: Likewise.
3373         * elf32-xtensa.c: Likewise.
3374         * elf64-alpha.c: Likewise.
3375         * elf64-hppa.c: Likewise.
3376         * elf64-ia64-vms.c: Likewise.
3377         * elf64-mmix.c: Likewise.
3378         * elf64-ppc.c: Likewise.
3379         * elf64-s390.c: Likewise.
3380         * elf64-sh64.c: Likewise.
3381         * elf64-x86-64.c: Likewise.
3382         * elflink.c: Likewise.
3383         * elfnn-aarch64.c: Likewise.
3384         * elfnn-ia64.c: Likewise.
3385         * elfnn-riscv.c: Likewise.
3386         * elfxx-mips.c: Likewise.
3387         * elfxx-sparc.c: Likewise.
3388         * elfxx-tilegx.c: Likewise.
3389         * linker.c: Likewise.
3390
3391 2017-05-16  Alan Modra  <amodra@gmail.com>
3392
3393         * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
3394         * elflink.c (elf_link_add_object_symbols): Update to use
3395         non_ir_ref_dynamic.
3396         (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
3397         non_ir_ref.
3398         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
3399
3400 2017-05-15  Maciej W. Rozycki  <macro@imgtec.com>
3401
3402         * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
3403
3404 2017-05-12  H.J. Lu  <hongjiu.lu@intel.com>
3405
3406         * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
3407         GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
3408         properties.
3409         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
3410
3411 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
3412
3413         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
3414         to plt_second.
3415         (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
3416         to plt_second/plt_second_eh_frame.
3417         (elf_x86_64_link_hash_newfunc): Updated.
3418         (elf_x86_64_allocate_dynrelocs): Likewise.
3419         (elf_x86_64_size_dynamic_sections): Likewise.
3420         (elf_x86_64_relocate_section): Likewise.
3421         (elf_x86_64_finish_dynamic_symbol): Likewise.
3422         (elf_x86_64_finish_dynamic_sections): Likewise.
3423         (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
3424         (elf_x86_64_get_synthetic_symtab): Updated.  Also scan the
3425         .plt.sec section.
3426         (elf_backend_setup_gnu_properties): Updated.  Create the
3427         .plt.sec section instead of the .plt.sec section.
3428
3429 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
3430
3431         * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
3432         commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
3433         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
3434
3435 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
3436
3437         * elf64-sparc.c (elf64_sparc_set_reloc): New function.
3438         (bfd_elf64_set_reloc): Define.
3439         (elf64_sparc_write_relocs): Use `canon_reloc_count'.
3440
3441 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
3442
3443         * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
3444         (struct bfd_target): New field _bfd_set_reloc.
3445         * bfd.c (bfd_set_reloc): Call backend _set_bfd.
3446         * reloc.c (_bfd_generic_set_reloc): New function.
3447         * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
3448         * nlm-target.h (nlm_set_reloc): Likewise.
3449         * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
3450         * aout-tic30.c (MY_set_reloc): Likewise.
3451         * aout-target.h (MY_set_reloc): Likewise.
3452         * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
3453         * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
3454         * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
3455         * vms-alpha.c (alpha_vms_set_reloc): Likewise.
3456         * aout-adobe.c (aout_32_set_reloc): Likewise.
3457         * bout.c (b_out_set_reloc): Likewise.
3458         * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
3459         * i386os9k.c (aout_32_set_reloc): Likewise.
3460         * ieee.c (ieee_set_reloc): Likewise.
3461         * oasys.c (oasys_set_reloc): Likewise.
3462         * som.c (som_set_reloc): Likewise.
3463         * versados.c (versados_set_reloc): Likewise.
3464         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
3465         _bfd_generic_set_reloc.
3466         (rs6000_xcoff64_aix_vec): LIkewise.
3467         * libbfd.c (_bfd_norelocs_set_reloc): New function.
3468         * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
3469         * i386msdos.c (msdos_set_reloc): Define to
3470         _bfd_norelocs_set_reloc.
3471         * elfcode.h (elf_set_reloc): Define.
3472         * bfd-in2.h: Regenerated.
3473
3474 2017-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3475
3476         PR ld/21481
3477         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
3478         for IFUNC function address.
3479
3480 2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>
3481
3482         * elf32-arc.c (FEATURE_LIST_NAME): Define.
3483         (CONFLICT_LIST): Likewise.
3484         (opcode/arc-attrs.h): Include.
3485         (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
3486         (arc_extract_features): New file.
3487         (arc_stralloc): Likewise.
3488         (arc_elf_merge_attributes): Likewise.
3489         (arc_elf_merge_private_bfd_data): Use object attributes.
3490         (bfd_arc_get_mach_from_attributes): New function.
3491         (arc_elf_object_p): Use object attributes.
3492         (arc_elf_final_write_processing): Likewise.
3493         (elf32_arc_obj_attrs_arg_type): New function.
3494         (elf32_arc_obj_attrs_handle_unknown): Likewise.
3495         (elf32_arc_section_from_shdr): Likewise.
3496         (elf_backend_obj_attrs_vendor): Define.
3497         (elf_backend_obj_attrs_section): Likewise.
3498         (elf_backend_obj_attrs_arg_type): Likewise.
3499         (elf_backend_obj_attrs_section_type): Likewise.
3500         (elf_backend_obj_attrs_handle_unknown): Likewise.
3501         (elf_backend_section_from_shdr): Likewise.
3502
3503 2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
3504
3505         PR ld/21458
3506         * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
3507         of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
3508         and the destination is a Thumb symbol.
3509
3510 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
3511
3512         * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
3513         initializer to silence GCC 4.2.
3514         * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
3515
3516 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
3517
3518         * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
3519         (LAZY_PLT_ENTRY_SIZE): This.
3520         (NON_LAZY_PLT_ENTRY_SIZE): New.
3521         (elf_x86_64_plt0_entry): Renamed to ...
3522         (elf_x86_64_lazy_plt0_entry): This.
3523         (elf_x86_64_plt_entry): Renamed to ...
3524         (elf_x86_64_lazy_plt_entry): This.
3525         (elf_x86_64_bnd_plt0_entry): Renamed to ...
3526         (elf_x86_64_lazy_bnd_plt0_entry): This.
3527         (elf_x86_64_legacy_plt_entry): Removed.
3528         (elf_x86_64_bnd_plt_entry): Renamed to ...
3529         (elf_x86_64_lazy_bnd_plt_entry): This.
3530         (elf_x86_64_legacy_plt2_entry): Renamed to ...
3531         (elf_x86_64_non_lazy_plt_entry): This.
3532         (elf_x86_64_bnd_plt2_entry): Renamed to ...
3533         (elf_x86_64_non_lazy_bnd_plt_entry): This.
3534         (elf_x86_64_eh_frame_plt): Renamed to ...
3535         (elf_x86_64_eh_frame_lazy_plt): This.
3536         (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
3537         (elf_x86_64_eh_frame_lazy_bnd_plt): This.
3538         (elf_x86_64_eh_frame_plt_got): Renamed to ...
3539         (elf_x86_64_eh_frame_non_lazy_plt): This.
3540         (elf_x86_64_lazy_plt_layout): New.
3541         (elf_x86_64_non_lazy_plt_layout): Likewise.
3542         (elf_x86_64_plt_layout): Likewise.
3543         (elf_x86_64_backend_data): Remove PLT layout information.  Add
3544         os for target system.
3545         (GET_PLT_ENTRY_SIZE): Removed.
3546         (elf_x86_64_lazy_plt): New.
3547         (elf_x86_64_non_lazy_plt): Likewise.
3548         (elf_x86_64_lazy_bnd_plt): Likewise.
3549         (elf_x86_64_non_lazy_bnd_plt): Likewise.
3550         (elf_x86-64_arch_bed): Updated.
3551         (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
3552         (elf_x86_64_create_dynamic_sections): Removed.
3553         (elf_x86_64_check_relocs): Don't check elf.dynobj.  Don't call
3554         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
3555         (elf_x86-64_adjust_dynamic_symbol): Updated.
3556         (elf_x86_64_allocate_dynrelocs): Updated.  Pass 0 as PLT header
3557         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
3558         size for PLT0 if there is no PLT0.  Get plt_entry_size from
3559         non_lazy_plt for non-lazy PLT entries.
3560         (elf_x86_64_size_dynamic_sections): Updated.  Get plt_entry_size
3561         from non_lazy_plt for non-lazy PLT entries.
3562         (elf_x86-64_relocate_section): Updated.  Properly get PLT index
3563         if there is no PLT0.
3564         (elf_x86_64_finish_dynamic_symbol): Updated.  Fill the first slot
3565         in the PLT entry with generic PLT layout.  Fill the non-lazy PLT
3566         entries with non-lazy PLT layout.  Don't fill the second and third
3567         slots in the PLT entry if there is no PLT0.
3568         (elf_x86_64_finish_dynamic_sections): Updated.  Don't fill PLT0
3569         if there is no PLT0.  Set sh_entsize on the .plt.got section.
3570         (compare_relocs): New.
3571         (elf_x86_64_plt_type): Likewise.
3572         (elf_x86_64_plt): Likewise.
3573         (elf_x86_64_nacl_plt): New. Forward declaration.
3574         (elf_x86_64_get_plt_sym_val): Removed.
3575         (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
3576         against all dynamic relocations.
3577         (elf_x86_64_link_setup_gnu_properties): New function.
3578         (elf_backend_create_dynamic_sections): Updated.
3579         (elf_backend_setup_gnu_properties): New.
3580         (elf_x86_64_nacl_plt): New.
3581         (elf_x86_64_nacl_arch_bed): Updated.
3582
3583 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
3584
3585         * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
3586         (LAZY_PLT_ENTRY_SIZE): This.
3587         (NON_LAZY_PLT_ENTRY_SIZE): New.
3588         (elf_i386_plt0_entry): Renamed to ...
3589         (elf_i386_lazy_plt0_entry): This.
3590         (elf_i386_plt_entry): Renamed to ...
3591         (elf_i386_lazy_plt_entry): This.
3592         (elf_i386_pic_plt0_entry): Renamed to ...
3593         (elf_i386_pic_lazy_plt0_entry): This.
3594         (elf_i386_pic_plt_entry): Renamed to ...
3595         (elf_i386_pic_lazy_plt_entry): This.
3596         (elf_i386_got_plt_entry): Renamed to ...
3597         (elf_i386_non_lazy_plt_entry): This.
3598         (elf_i386_pic_got_plt_entry): Renamed to ...
3599         (elf_i386_pic_non_lazy_plt_entry): This.
3600         (elf_i386_eh_frame_plt): Renamed to ...
3601         (elf_i386_eh_frame_lazy_plt): This.
3602         (elf_i386_eh_frame_plt_got): Renamed to ...
3603         (elf_i386_eh_frame_non_lazy_plt): This.
3604         (elf_i386_plt_layout): Renamed to ...
3605         (elf_i386_lazy_plt_layout): This.  Remove eh_frame_plt_got and
3606         eh_frame_plt_got_size.
3607         (elf_i386_non_lazy_plt_layout): New.
3608         (elf_i386_plt_layout): Likewise.
3609         (elf_i386_non_lazy_plt): Likewise.
3610         (GET_PLT_ENTRY_SIZE): Removed.
3611         (elf_i386_plt): Renamed to ...
3612         (elf_i386_lazy_plt): This.
3613         (elf_i386_backend_data): Remove plt.  Rename is_vxworks to os.
3614         (elf_i386_arch_bed): Updated.
3615         (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
3616         (elf_i386_create_dynamic_sections): Removed.
3617         (elf_i386_check_relocs): Don't check elf.dynobj.  Don't call
3618         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
3619         (elf_i386_adjust_dynamic_symbol): Updated.
3620         (elf_i386_allocate_dynrelocs): Updated.  Pass 0 as PLT header
3621         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
3622         size for PLT0 if there is no PLT0.
3623         (elf_i386_size_dynamic_sections): Updated.  Check whether GOT
3624         output section is discarded only if GOT isn't empty.
3625         (elf_i386_relocate_section): Updated.  Properly get PLT index
3626         if there is no PLT0.
3627         (elf_i386_finish_dynamic_symbol): Updated.  Don't fill the
3628         second and third slots in the PLT entry if there is no PLT0.
3629         (elf_i386_finish_dynamic_sections): Updated.  Don't fill PLT0
3630         if there is no PLT0.  Set sh_entsize on the .plt.got section.
3631         (elf_i386_nacl_plt): Forward declaration.
3632         (elf_i386_get_plt_sym_val): Removed.
3633         (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
3634         against all dynamic relocations.
3635         (elf_i386_link_setup_gnu_properties): New function.
3636         (elf_backend_create_dynamic_sections): Updated.
3637         (elf_backend_setup_gnu_properties): New.
3638         (elf_i386_nacl_plt): Updated.
3639         (elf_i386_nacl_arch_bed): Likewise.
3640         (elf_i386_vxworks_arch_bed): Likewise.
3641
3642 2017-05-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
3643
3644         * elflink.c (elf_output_implib): Remove executable flag from import
3645         library bfd.
3646         * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
3647         library is a relocatable object file.
3648
3649 2017-05-01  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
3650
3651         PR ld/21404
3652         * elf32-avr.c (avr_should_move_sym): New function.
3653         (avr_should_reduce_sym_size): Likewise.
3654         (avr_should_increase_sym_size): Likewise.
3655         (elf32_avr_relax_delete_bytes): Adjust symbol values
3656         and sizes by calling new functions.
3657
3658 2017-05-01  Palmer Dabbelt  <palmer@dabbelt.com>
3659
3660         * config.bfd (riscv32-*): Enable rv64.
3661
3662 2017-05-02  Alan Modra  <amodra@gmail.com>
3663
3664         PR 21384
3665         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
3666         rather than h->root.type == bfd_link_hash_new.
3667         (bfd_elf_record_link_assignment): Similarly, call
3668         bfd_elf_link_mark_dynamic_symbol when h->non_elf.
3669
3670 2017-04-29  Alan Modra  <amodra@gmail.com>
3671
3672         PR 21432
3673         * reloc.c (reloc_offset_in_range): New function.
3674         (bfd_perform_relocation, bfd_install_relocation): Use it.
3675         (_bfd_final_link_relocate): Likewise.
3676
3677 2017-04-28  H.J. Lu  <hongjiu.lu@intel.com>
3678
3679         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
3680         before using .plt.got.
3681         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
3682
3683 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3684
3685         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
3686         instead of "+=" to update 0.
3687
3688 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3689
3690         * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
3691         .plt.got section here.
3692         (elf_i386_check_relocs): Don't create the .plt.got section.
3693         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
3694         the .plt.got and .plt.bnd sections here.
3695         (elf_x86_64_check_relocs): Don't create the .plt.got nor
3696         .plt.bnd sections.
3697
3698 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3699
3700         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
3701         has_bnd_reloc.
3702         (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
3703         (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
3704         (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
3705         (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
3706         has_bnd_reloc.
3707
3708 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3709
3710         * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
3711         to return bfd *.
3712         (_bfd_elf_link_setup_gnu_properties): Return bfd *.
3713         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
3714         the first relocatable ELF input with GNU properties.
3715
3716 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
3717
3718         * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
3719         VxWorks for non-PIC.
3720
3721 2017-04-27  Alan Modra  <amodra@gmail.com>
3722
3723         * elf-bfd.h (struct elf_backend_data): Make asection param of
3724         elf_backend_eh_frame_address_size const.
3725         (_bfd_elf_eh_frame_address_size): Likewise.
3726         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
3727         * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
3728         * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
3729         * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
3730         * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
3731         (next_cie_fde_offset): Constify params.
3732         (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
3733
3734 2017-04-27  Alan Modra  <amodra@gmail.com>
3735
3736         * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
3737         (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
3738         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
3739         aug_data_len.
3740         (offset_adjust): New function.
3741         (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
3742         (adjust_eh_frame_local_symbols): Likewise.
3743         (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
3744         after changing anything.  Return true if anything changed.
3745         * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
3746         _bfd_elf_adjust_eh_frame_global_symbol for globals.
3747
3748 2017-04-27  Alan Modra  <amodra@gmail.com>
3749
3750         * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
3751         when force_local.
3752
3753 2017-04-27  Alan Modra  <amodra@gmail.com>
3754
3755         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
3756         (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
3757         (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
3758         (ppc_elf_relocate_section): Likewise.  Delete silly optimisation
3759         for undef and undefweak dyn_relocs.
3760         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
3761         (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
3762         (allocate_got, allocate_dynrelocs): Likewise.
3763         (ppc64_elf_relocate_section): Likewise.
3764
3765 2017-04-26  H.J. Lu  <hongjiu.lu@intel.com>
3766
3767         * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
3768         DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
3769         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
3770         add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
3771
3772 2017-04-26  Nick Clifton  <nickc@redhat.com>
3773
3774         PR binutils/21434
3775         * reloc.c (bfd_perform_relocation): Check for a negative address
3776         in the reloc.
3777
3778 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
3779
3780         PR ld/21334
3781         * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
3782         member.
3783         * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
3784         (elf_backend_always_renumber_dynsyms): Define.
3785         (elfNN_bed): Initialize `always_renumber_dynsyms' member.
3786         * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
3787         * elflink.c (bfd_elf_size_dynamic_sections): Also call
3788         `_bfd_elf_link_renumber_dynsyms' if the backend has requested
3789         it.
3790         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
3791
3792 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
3793
3794         * elflink.c (bfd_elf_size_dynamic_sections): Only call
3795         `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
3796         sections have been created.
3797
3798 2017-04-26  Nick Clifton  <nickc@redhat.com>
3799
3800         PR binutils/21431
3801         * compress.c (bfd_init_section_compress_status): Check the return
3802         value from bfd_malloc.
3803
3804 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
3805
3806         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
3807         no_finish_dynamic_symbol.
3808         (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
3809         0.
3810         (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
3811         weak symbol, don't make it dynamic.
3812         (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
3813         set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
3814         relocation for GOT reference.
3815         (elf_x86_64_finish_dynamic_symbol): Abort if
3816         no_finish_dynamic_symbol isn't 0.
3817
3818 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
3819
3820         PR ld/21402
3821         * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
3822         undefined weak symbol, don't make it dynamic.
3823         (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
3824         set no_finish_dynamic_symbol and generate R_386_RELATIVE
3825         relocation for R_386_GOT32.
3826
3827 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
3828
3829         PR ld/21425
3830         * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
3831
3832 2017-04-23  Alan Modra  <amodra@gmail.com>
3833
3834         PR 21414
3835         * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
3836         * elf.c (lcomm_sym): New.
3837         (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
3838         * bfd-in2.h: Regenerate.
3839
3840 2017-04-23  Alan Modra  <amodra@gmail.com>
3841
3842         PR 21412
3843         * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
3844         parameters and comment.
3845         (_bfd_elf_get_reloc_section): Delete.
3846         (_bfd_elf_plt_get_reloc_section): Declare.
3847         * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
3848         New functions.  Don't blindly skip over assumed .rel/.rela prefix.
3849         Extracted from..
3850         (_bfd_elf_get_reloc_section): ..here.  Delete.
3851         (assign_section_numbers): Call elf_get_reloc_section.
3852         * elf64-ppc.c (elf_backend_get_reloc_section): Define.
3853         * elfxx-target.h (elf_backend_get_reloc_section): Update.
3854
3855 2017-04-23  Alan Modra  <amodra@gmail.com>
3856
3857         PR 21409
3858         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
3859         no symbols.
3860
3861 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
3862
3863         PR ld/21402
3864         * elf32-i386.c (elf_i386_link_hash_entry): Add
3865         no_finish_dynamic_symbol.
3866         (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
3867         (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
3868         symbol, don't make it dynamic in PIE.
3869         (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
3870         set no_finish_dynamic_symbol and generate R_386_RELATIVE
3871         relocation for R_386_GOT32
3872         (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
3873         isn't 0.
3874
3875 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
3876
3877         PR ld/19617
3878         PR ld/21086
3879         * elflink.c (elf_link_add_object_symbols): Require
3880         --no-dynamic-linker with -E/--dynamic-list when creating
3881         dynamic sections.
3882
3883 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
3884
3885         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
3886         if forced local.
3887
3888 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
3889
3890         * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
3891         dynamic symbol sorting.
3892
3893 2017-04-20  H.J. Lu  <hongjiu.lu@intel.com>
3894
3895         PR ld/21382
3896         * elflink.c (elf_link_add_object_symbols): Preserve
3897         dynamic_ref_after_ir_def when restoring the symbol table for
3898         unneeded dynamic object.
3899
3900 2017-04-19  H.J. Lu  <hongjiu.lu@intel.com>
3901
3902         PR ld/21401
3903         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
3904         on on undefined IFUNC symbol in the second PLT.
3905
3906 2017-04-19  Wedson Almeida Filho  <wedsonaf@gmail.com>
3907
3908         * peXXigen.c (pe_print_reloc): Correct chunk_end.
3909
3910 2017-04-19  Alan Modra  <amodra@gmail.com>
3911
3912         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
3913         or make dynamic for info->dynamic_undefined_weak 0 and 1.
3914         * elf32-ppc.c:Formatting.
3915         (ensure_undefweak_dynamic): Don't make dynamic when
3916         info->dynamic_undefined_weak is zero.
3917         (allocate_dynrelocs): Discard undefweak dyn_relocs for
3918         info->dynamic_undefined_weak.  Discard undef dyn_relocs when
3919         not default visibility.  Discard undef and undefweak
3920         dyn_relocs earlier.
3921         (ppc_elf_relocate_section): Adjust to suit.
3922         * elf64-ppc.c: Formatting.
3923         (ensure_undefweak_dynamic): Don't make dynamic when
3924         info->dynamic_undefined_weak is zero.
3925         (allocate_dynrelocs): Discard undefweak dyn_relocs for
3926         info->dynamic_undefined_weak.  Discard them earlier.
3927
3928 2017-04-17  H.J. Lu  <hongjiu.lu@intel.com>
3929
3930         PR ld/21389
3931         * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
3932         before generating the version definition section.
3933
3934 2017-04-17  Alan Modra  <amodra@gmail.com>
3935
3936         * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
3937         state when a regular object file defines a symbol with
3938         incompatible type to that defined by an earlier shared lib.
3939
3940 2017-04-13  Alan Modra  <amodra@gmail.com>
3941
3942         * coffcode.h: Wrap some overly long _bfd_error_handler args.
3943         * elf.c: Likewise.
3944         * elf32-arm.c: Likewise.
3945         * elf32-i386.c: Likewise.
3946         * elf32-mep.c: Likewise.
3947         * elf64-ia64-vms.c: Likewise.
3948         * elf64-x86-64.c: Likewise.
3949         * elflink.c: Likewise.
3950         * elfnn-ia64.c: Likewise.
3951         * elfxx-mips.c: Likewise.
3952
3953 2017-04-13  Alan Modra  <amodra@gmail.com>
3954
3955         * aoutx.h: Use %B and %A in error messages throughout file.
3956         * aout-cris.c: Likewise.
3957         * archive.c: Likewise.
3958         * binary.c: Likewise.
3959         * coff-rs6000.c: Likewise.
3960         * coff-tic4x.c: Likewise.
3961         * coffcode.h: Likewise.
3962         * coffgen.c: Likewise.
3963         * cofflink.c: Likewise.
3964         * coffswap.h: Likewise.
3965         * cpu-arm.c: Likewise.
3966         * elf-eh-frame.c: Likewise.
3967         * elf-m10300.c: Likewise.
3968         * elf.c: Likewise.
3969         * elf32-arc.c: Likewise.
3970         * elf32-arm.c: Likewise.
3971         * elf32-bfin.c: Likewise.
3972         * elf32-frv.c: Likewise.
3973         * elf32-iq2000.c: Likewise.
3974         * elf32-m32c.c: Likewise.
3975         * elf32-microblaze.c: Likewise.
3976         * elf32-nds32.c: Likewise.
3977         * elf32-rl78.c: Likewise.
3978         * elf32-rx.c: Likewise.
3979         * elf32-score.c: Likewise.
3980         * elf32-score7.c: Likewise.
3981         * elf32-sh64.c: Likewise.
3982         * elf32-v850.c: Likewise.
3983         * elf32-vax.c: Likewise.
3984         * elf32-visium.c: Likewise.
3985         * elf64-ia64-vms.c: Likewise.
3986         * elf64-mmix.c: Likewise.
3987         * elf64-sh64.c: Likewise.
3988         * elfcode.h: Likewise.
3989         * elfnn-aarch64.c: Likewise.
3990         * elfnn-ia64.c: Likewise.
3991         * elfxx-mips.c: Likewise.
3992         * hpux-core.c: Likewise.
3993         * ieee.c: Likewise.
3994         * ihex.c: Likewise.
3995         * linker.c: Likewise.
3996         * merge.c: Likewise.
3997         * mmo.c: Likewise.
3998         * oasys.c: Likewise.
3999         * pdp11.c: Likewise.
4000         * peXXigen.c: Likewise.
4001         * rs6000-core.c: Likewise.
4002         * vms-alpha.c: Likewise.
4003         * xcofflink.c: Likewise.
4004
4005 2017-04-13  Alan Modra  <amodra@gmail.com>
4006
4007         * bfd.c (PRINT_TYPE): Define.
4008         (_doprnt): New function.
4009         (error_handler_internal): Use _doprnt.
4010         * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
4011         calls in their natural order, throughout file.
4012         * coff-mcore.c: Likewise.
4013         * coff-ppc.c: Likewise.
4014         * coff-tic80.c: Likewise.
4015         * cofflink.c: Likewise.
4016         * elf-s390-common.c: Likewise.
4017         * elf.c: Likewise.
4018         * elf32-arm.c: Likewise.
4019         * elf32-i386.c: Likewise.
4020         * elf32-m32r.c: Likewise.
4021         * elf32-msp430.c: Likewise.
4022         * elf32-spu.c: Likewise.
4023         * elf64-ia64-vms.c: Likewise.
4024         * elf64-sparc.c: Likewise.
4025         * elf64-x86-64.c: Likewise.
4026         * elflink.c: Likewise.
4027         * elfnn-aarch64.c: Likewise.
4028         * elfnn-ia64.c: Likewise.
4029         * elfxx-mips.c: Likewise.
4030
4031 2017-04-13  Alan Modra  <amodra@gmail.com>
4032
4033         * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
4034         branch veneers" error.  Fix double space and format message.
4035         * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
4036         * elf64-ppc.c (tocsave_find): Supply missing %B arg.
4037
4038 2017-04-13  Alan Modra  <amodra@gmail.com>
4039
4040         * bfd-in2.h: Regenerate.
4041
4042 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
4043
4044         * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
4045         extra `\n' in warning/error messages.
4046         * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
4047         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
4048
4049 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
4050
4051         * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
4052         processor-specific properties with generic ELF target vector.
4053
4054 2017-04-10  Qing Zhao  <qing.zhao@oracle.com>
4055
4056         * elf32-sparc.c (elf_backend_fixup_symbol): New.
4057         * elf64-sparc.c (elf_backend_fixup_symbol): New.
4058         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
4059         (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
4060         has_non_got_reloc.
4061         (link_hash_newfunc): Initialize has_got_reloc and
4062         has_non_got_reloc.
4063         (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
4064         section.
4065         (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
4066         has_non_got_reloc.
4067         (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
4068         has_non_got_reloc.
4069         (_bfd_sparc_elf_fixup_symbol): New function.
4070         (allocate_dynrelocs): Don't allocate space for dynamic
4071         relocations and discard relocations against resolved undefined
4072         weak symbols in executable.  Don't make resolved undefined weak
4073         symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
4074         relocation against undefined weak symbols in PIE.
4075         (_bfd_sparc_elf_relocate_section): Don't generate dynamic
4076         relocations against resolved undefined weak symbols in PIE
4077         (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
4078         without ynamic PLT/GOT relocations for resolved undefined weak
4079         symbols.
4080         Don't generate dynamic relocation against resolved undefined
4081         weak symbol in executable.
4082         (pie_finish_undefweak_symbol): New function.
4083         (_bfd_sparc_elf_finish_dynamic_sections): Call
4084         pie_finish_undefweak_symbol on all symbols in PIE.
4085         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
4086         (_bfd_sparc_elf_fixup_symbol): New function.
4087
4088 2017-04-10  Nick Clifton  <nickc@redhat.com>
4089
4090         * config.bfd: Remove ns32k from obsolete list.
4091
4092 2017-04-10  Alan Modra  <amodra@gmail.com>
4093
4094         PR 21287
4095         * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
4096         (special_sections_i): Likewise for .init_array.
4097         (special_sections_p): Likewise for .preinit_array.
4098
4099 2017-04-07  H.J. Lu  <hongjiu.lu@intel.com>
4100
4101         PR ld/19579
4102         PR ld/21306
4103         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
4104         ELF_COMMON_DEF_P for common symbols.
4105         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
4106         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
4107         * elflink.c (_bfd_elf_merge_symbol): Revert commits
4108         202ac193bbbecc96a4978d1ac3d17148253f9b01 and
4109         07492f668d2173da7a2bda3707ff0985e0f460b6.
4110
4111 2017-04-07  Pedro Alves  <palves@redhat.com>
4112
4113         * opncls.c (bfd_get_debug_link_info): Rename to...
4114         (bfd_get_debug_link_info_1): ... this.  Change type of second
4115         parameter to void pointer.  Adjust.
4116         (bfd_get_debug_link_info): Reimplement on top of
4117         bfd_get_debug_link_info_1.
4118         (separate_debug_file_exists, separate_alt_debug_file_exists):
4119         Change type of second parameter to void pointer.  Adjust.
4120         (get_func_type, check_func_type): Change type of second parameter
4121         to void pointer.
4122         (find_separate_debug_file): Add 'func_data' parameter.  Pass it to
4123         the callback functions instead of passing the address of a local.
4124         (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
4125         find_separate_debug_file.
4126         (get_alt_debug_link_info_shim): Change type of second parameter to
4127         void pointer.  Adjust.
4128         (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
4129         find_separate_debug_file.
4130         (get_build_id_name, bfd_boolean check_build_id_file): Change type
4131         of second parameter to void pointer.  Adjust.
4132         (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
4133         pointer local to find_separate_debug_file.
4134
4135 2017-04-07  Tristan Gingold  <gingold@gingold-Precision-7510>
4136
4137         * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
4138         external symbols with a definition.
4139         (_bfd_coff_gc_mark_extra_sections): Fix typo.
4140
4141 2017-04-07  Alan Modra  <amodra@gmail.com>
4142
4143         * po/SRC-POTFILES.in: Regenerate.
4144
4145 2017-04-05  Alan Modra  <amodra@gmail.com>
4146
4147         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
4148         reference counting.
4149
4150 2017-04-02  Jon Turney  <jon.turney@dronecode.org.uk>
4151
4152         (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
4153         numbers for DataDirectory entry indicies passed to
4154         add_data_entry().
4155
4156 2017-04-04  H.J. Lu  <hongjiu.lu@intel.com>
4157
4158         * elf.c (get_program_header_size): Add a GNU_MBIND segment for
4159         each GNU_MBIND section and align GNU_MBIND section to page size.
4160         (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
4161         segment for each GNU_MBIND section.
4162         (_bfd_elf_init_private_section_data): Copy sh_info from input
4163         for GNU_MBIND section.
4164
4165 2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
4166
4167         * elfnn-riscv.c (GP_NAME): Delete.
4168         (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
4169         (_bfd_riscv_relax_lui): Likewise.
4170
4171 2017-04-04  Nick Clifton  <nickc@redhat.com>
4172
4173         PR binutils/21342
4174         * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
4175         dereference.
4176         (bfd_elf_final_link): Only initialize the extended symbol index
4177         section if there are extended symbol tables to list.
4178
4179 2017-04-03  H.J. Lu  <hongjiu.lu@intel.com>
4180
4181         * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
4182         (BFD32_BACKENDS_CFILES): Add elf-properties.c.
4183         * configure.ac (elf): Add elf-properties.lo.
4184         * Makefile.in: Regenerated.
4185         * configure: Likewise.
4186         * elf-bfd.h (elf_property_kind): New.
4187         (elf_property): Likewise.
4188         (elf_property_list): Likewise.
4189         (elf_properties): Likewise.
4190         (_bfd_elf_parse_gnu_properties): Likewise.
4191         (_bfd_elf_get_property): Likewise.
4192         (_bfd_elf_link_setup_gnu_properties): Likewise.
4193         (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
4194         and setup_gnu_properties.
4195         (elf_obj_tdata): Add properties.
4196         * elf-properties.c: New file.
4197         * elf32-i386.c (elf_i386_parse_gnu_properties): New.
4198         (elf_i386_merge_gnu_properties): Likewise.
4199         (elf_backend_parse_gnu_properties): Likewise.
4200         (elf_backend_merge_gnu_properties): Likewise.
4201         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
4202         (elf_x86_64_merge_gnu_properties): Likewise.
4203         (elf_backend_parse_gnu_properties): Likewise.
4204         (elf_backend_merge_gnu_properties): Likewise.
4205         * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
4206         (elf_backend_parse_gnu_properties): Likewise.
4207         (elf_backend_setup_gnu_properties): Likewise.
4208         (elfNN_bed): Add elf_backend_parse_gnu_properties,
4209         elf_backend_merge_gnu_properties and
4210         elf_backend_setup_gnu_properties.
4211
4212 2017-03-30  Pip Cet  <pipcet@gmail.com>
4213
4214         * elf32-wasm32.c: Add relocation code, two relocs.
4215         * reloc.c: Add wasm32 relocations.
4216         * libbfd.h: Regenerate.
4217         * bfd-in2.h: Regenerate.
4218         * bfd/po/bfd.pot: Regenerate.
4219
4220 2017-03-29  Nick Clifton  <nickc@redhat.com>
4221
4222         PR binutils/18025
4223         * coff-bfd.h (struct coff_section_data): Add new fields:
4224         saved_bias and bias.
4225         * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
4226         computed for PE binaries.
4227         * dwarf2.c (scan_unit_for_symbols): Only warn once about each
4228         missing abbrev.
4229
4230 2017-03-28  Hans-Peter Nilsson  <hp@axis.com>
4231
4232         PR ld/16044
4233         * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
4234         to handle a local symbol with a hash-symbol-entry; without PLT.
4235         Add BFD_ASSERT for an incidental case with GOT entry present.
4236         (cris_elf_check_relocs): Increment PLT refcount only if the symbol
4237         isn't forced-or-set local.
4238
4239 2017-03-27  Pip Cet  <pipcet@gmail.com>
4240
4241         * wasm-module.c: New file to support WebAssembly modules.
4242         * wasm-module.h: New file to support WebAssembly modules.
4243         * doc/webassembly.texi: Start documenting wasm-module.c.
4244         * config.bfd: Add wasm_vec.
4245         * targets.c: Likewise.
4246         * configure.ac: Likewise.
4247         * Makefile.am: Add entries for wasm-module.c.
4248         * Makefile.in: Regenerate.
4249         * configure: Regenerate.
4250         * po/SRC-POTFILES.in: Regenerate.
4251
4252 2017-03-27  Pip Cet  <pipcet@gmail.com>
4253
4254         * cpu-wasm32.c: New file to support wasm32 architecture.
4255         * elf32-wasm32.c: New file to support wasm32 architecture.
4256         * Makefile.am: Add wasm32 architecture.
4257         * archures.c: Likewise.
4258         * config.bfd: Likewise.
4259         * configure.ac: Likewise.
4260         * targets.c: Likewise.
4261         * Makefile.in: Regenerate.
4262         * bfd-in2.h: Regenerate.
4263         * configure: Regenerate.
4264         * po/SRC-POTFILES.in: Regenerate.
4265
4266 2017-03-20  Alan Modra  <amodra@gmail.com>
4267
4268         PR 21266
4269         * elf64-ppc.c (compare_symbols): Stabilize sort.
4270
4271 2017-03-18  Alan Modra  <amodra@gmail.com>
4272
4273         * elf64-ppc.c (struct ppc_link_hash_table): Add
4274         local_ifunc_resolver and maybe_local_ifunc_resolver.
4275         (ppc_build_one_stub): Set flags on emitting dynamic
4276         relocation to ifunc.
4277         (ppc64_elf_relocate_section): Likewise.
4278         (ppc64_elf_finish_dynamic_symbol): Likewise.
4279         (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
4280         local dynamic relocs to ifuncs.
4281         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
4282         local_ifunc_resolver and maybe_local_ifunc_resolver.
4283         (ppc_elf_relocate_section): Set flag on emitting dynamic
4284         relocation to ifuncs.
4285         (ppc_elf_finish_dynamic_symbol): Likewise.
4286         (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
4287         dynamic relocs to ifuncs.
4288
4289 2017-03-13  Nick Clifton  <nickc@redhat.com>
4290
4291         PR binutils/21202
4292         * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
4293         BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
4294         (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
4295         BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
4296         * bfd-in2.h: Regenerate.
4297         * libbfd.h: Regenerate.
4298         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
4299         names.
4300         (IS_AARCH64_TLSDESC_RELOC): Likewise.
4301         (elfNN_aarch64_howto_table): Likewise.
4302         (aarch64_tls_transition_without_check): Likewise.
4303         (aarch64_reloc_got_type): Likewise.
4304         (elfNN_aarch64_final_link_relocate): Likewise.
4305         (elfNN_aarch64_tls_relax): Likewise.
4306         (elfNN_aarch64_relocate_section): Likewise.
4307         (elfNN_aarch64_gc_sweep_hook): Likewise.
4308         (elfNN_aarch64_check_relocs): Likewise.
4309         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
4310         (_bfd_aarch64_elf_resolve_relocation): Likewise.
4311
4312 2017-03-11  Alan Modra  <amodra@gmail.com>
4313
4314         * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
4315         parameter is in fact used.  Whitespace fixes.
4316         * elf64-ppc.c: Likewise.
4317
4318 2017-03-09  Sam Thursfield  <sam.thursfield@codethink.co.uk>
4319
4320         * rs6000-core.c (CORE_NEW): Simplify macro when
4321         AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
4322
4323 2017-03-07  Alan Modra  <amodra@gmail.com>
4324
4325         PR 21224
4326         PR 20519
4327         * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
4328         dyn_relocs check.
4329
4330 2017-03-05  Alan Modra  <amodra@gmail.com>
4331
4332         * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
4333         * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
4334         (next_cie_fde_offset): New function.
4335         (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
4336         (_bfd_elf_discard_section_eh_frame): Align zero terminator to
4337         four bytes.  Align CIEs to four or eight bytes depending on
4338         per_encoding_aligned8.  Align FDEs according to their encoding.
4339         Pad last FDE to output section alignment.
4340         (_bfd_elf_write_section_eh_frame): Adjust to suit.  Remove
4341         assertion.
4342         * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
4343         (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
4344         (ppc64_elf_finish_dynamic_sections): Adjust to suit.
4345
4346 2017-03-02  Martin Bickel  <binutils@ineranves.de>
4347
4348         PR ld/21212
4349         * elf.c (rewrite_elf_program_header): Do not issue a warning for
4350         empty segments which have a zero filesz, but a non-zero memsz.
4351
4352 2017-03-02  Alan Modra  <amodra@gmail.com>
4353
4354         * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
4355
4356 2017-02-28  Alan Modra  <amodra@gmail.com>
4357
4358         * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
4359         (ppc64_elf_relocate_section): Likewise.
4360
4361 2017-02-28  Alan Modra  <amodra@gmail.com>
4362
4363         PR 20995
4364         * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
4365         rather than elf32_nios2_hash_table or elf_hash_table.
4366         (create_got_section): Likewise.
4367         (nios2_elf32_finish_dynamic_symbol): Likewise.
4368         (nios2_elf32_adjust_dynamic_symbol): Likewise.
4369         (nios2_elf32_size_dynamic_sections): Likewise.
4370         (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
4371         vars.  Use htab equivalents directly instead.  Don't create
4372         all dynamic sections on needing just the GOT.  Use a goto
4373         rather than a fall-through with reloc test.  Ensure
4374         htab->dynobj is set when making dynamic sreloc section.
4375         (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
4376         equivalent directly instead.  Don't segfault on looking for
4377         .dynamic when dynamic sections have not been created.  Don't
4378         segfault on .got.plt being discarded.
4379         (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
4380         Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
4381         fixme and another not so relevant comment.
4382         (nios2_elf_add_symbol_hook): Delete dynobj var.  If not
4383         already set, set hash table dynobj on creating .sbss.
4384
4385 2017-02-28  Alan Modra  <amodra@gmail.com>
4386
4387         * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
4388         * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
4389         (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
4390         (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
4391         (ppc64_elf_relocate_section): Likewise.
4392         * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
4393         (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
4394         (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
4395         * libbfd.h: Regenerate.
4396         * bfd-in2.h: Regenerate.
4397
4398 2017-02-28  Alan Modra  <amodra@gmail.com>
4399
4400         * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
4401         dynamic .data.rel.ro read-only.
4402         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
4403         rather than section flags when deciding where copy reloc goes.
4404         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
4405         * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
4406         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
4407         * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
4408         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
4409         * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
4410         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
4411         * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
4412         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
4413         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
4414         * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
4415         * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
4416         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
4417         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
4418         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
4419         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
4420         * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
4421         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
4422         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
4423
4424 2017-02-28  Maciej W. Rozycki  <macro@imgtec.com>
4425
4426         * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
4427         `jalr $0, $25' instruction encoding.
4428
4429 2017-02-27  Nick Clifton  <nickc@redhat.com>
4430
4431         PR ld/21180
4432         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
4433         generating a seg-fault when encountering a symbol that has been
4434         deleted by garbage collection.
4435
4436 2017-02-25  Alan Modra  <amodra@gmail.com>
4437
4438         * elf32-arc.c (struct dynamic_sections): Delete.
4439         (enum dyn_section_types): Delete.
4440         (dyn_section_names): Delete.
4441         (arc_create_dynamic_sections): Delete.
4442         (elf_arc_finish_dynamic_sections): Don't call the above.  Don't
4443         segfault on discarded .rela.plt section.
4444         (elf_arc_size_dynamic_sections): Formatting.  Don't call
4445         arc_create_dynamic_sections.  Don't allocate memory for sections
4446         handled by the generic linker.  Correct code finding relocs in
4447         read-only sections.  Set SEC_EXCLUDE on zero size .got,
4448         .got.plt, and .dynbss sections.  Do set .interp for pies.
4449
4450 2017-02-24  Andrew Waterman  <andrew@sifive.com>
4451
4452         * elfnn-riscv.c (GP_NAME): New macro.
4453         (riscv_global_pointer_value): Use it.
4454         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
4455         output section, consider only that section's alignment.
4456
4457 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
4458
4459         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
4460         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
4461         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
4462         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
4463
4464 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
4465
4466         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
4467         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
4468         or misaligned.
4469
4470 2017-02-23  Alan Modra  <amodra@gmail.com>
4471
4472         PR 20744
4473         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
4474         16D relocations.
4475         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
4476         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
4477         relocs.
4478
4479 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
4480
4481         PR ld/20828
4482         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
4483         processing ahead of the call to `elf_gc_sweep_symbol'.
4484
4485 2017-02-22  Nick Clifton  <nickc@redhat.com>
4486
4487         PR binutils/21193
4488         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
4489         created section 4-byte alignment.
4490
4491 2017-02-22  Alan Modra  <amodra@gmail.com>
4492
4493         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
4494         on .got or .plt output section being discarded by script.
4495         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
4496         vxworks splt temp.
4497
4498 2017-02-21  Alan Modra  <amodra@gmail.com>
4499
4500         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
4501         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
4502
4503 2017-02-20  Alan Modra  <amodra@gmail.com>
4504
4505         PR 21181
4506         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
4507         if DT_RELSZ/DT_RELASZ is zero.
4508
4509 2017-02-17  Nick Clifton  <nickc@redhat.com>
4510
4511         * compress.c (bfd_get_full_section_contents): Remember to reduce
4512         compressed size by the sizeof the compression header when
4513         decompressing the contents.
4514
4515 2017-02-17  Pedro Alves  <palves@redhat.com>
4516
4517         * srec.c (Chunk): Rename to ...
4518         (_bfd_srec_len): ... this.
4519         (S3Forced): Rename to ...
4520         (_bfd_srec_forceS3): ... this.
4521         * objcopy.c: Adjust all references.
4522
4523 2017-02-17  Pedro Alves  <palves@redhat.com>
4524
4525         * archive.c (bsd_write_armap): Rename to ...
4526         (_bfd_bsd_write_armap): ... this.
4527         (coff_write_armap): Rename to ...
4528         (_bfd_coff_write_armap): ... this.
4529         * libbfd-in.h (bsd_write_armap): Rename to ...
4530         (_bfd_bsd_write_armap): ... this.
4531         (coff_write_armap): Rename to ...
4532         (_bfd_coff_write_armap): ... this.
4533         * aout-target.h, aout-tic30.c: Adjust all users.
4534         * libbfd.h: Regenerate.
4535
4536 2017-02-17  Pedro Alves  <palves@redhat.com>
4537
4538         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
4539         (warn_deprecated): Rename to ...
4540         (_bfd_warn_deprecated): ... this.
4541         * libbfd.c (warn_deprecated): Rename to ...
4542         (_bfd_warn_deprecated): ... this.
4543         * bfd-in2.h: Regenerate.
4544
4545 2017-02-17  Pedro Alves  <palves@redhat.com>
4546
4547         * bfdio.c (real_ftell): Rename to ...
4548         (_bfd_real_ftell): ... this.
4549         (real_fseek): Rename to ...
4550         (_bfd_real_fseek): ... this.
4551         (real_fopen): Rename to ...
4552         (_bfd_real_fopen): ... this.
4553         * libbfd-in.h (real_ftell): Rename to ...
4554         (_bfd_real_ftell): ... this.
4555         (real_fseek): Rename to ...
4556         (_bfd_real_fseek): ... this.
4557         (real_fopen): Rename to ...
4558         (_bfd_real_fopen): ... this.
4559         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
4560         * libbfd.h: Regenerate.
4561
4562 2017-02-17  Pedro Alves  <palves@redhat.com>
4563
4564         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
4565         * libbfd.c (read_unsigned_leb128): Rename to ...
4566         (_bfd_read_unsigned_leb128): ... this.
4567         (read_signed_leb128): Rename to ...
4568         (_bfd_read_signed_leb128): ... this.
4569         (safe_read_leb128): Rename to ...
4570         (_bfd_safe_read_leb128): ... this.
4571         * libbfd-in.h (read_unsigned_leb128): Rename to ...
4572         (_bfd_read_unsigned_leb128): ... this.
4573         (read_signed_leb128): Rename to ...
4574         (_bfd_read_signed_leb128): ... this.
4575         (safe_read_leb128): Rename to ...
4576         (_bfd_safe_read_leb128): ... this.
4577         * libbfd.h: Renegerate.
4578
4579 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
4580
4581         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
4582         before trying to fine matching file and line information.
4583
4584 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
4585
4586         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
4587         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
4588         not match current bfd, then reload debug information.  Record bfd
4589         we're loading debug info for in the stash.  If we have debug
4590         informatin in the cache then perform section placement before
4591         returning.
4592
4593 2017-02-16  Alan Modra  <amodra@gmail.com>
4594
4595         PR 21000
4596         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
4597         * elfxx-target.h (elf_backend_no_page_alias): Define.
4598         (elfNN_bed): Init new field.
4599         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
4600         ensure PT_LOAD segment starts on a new page.
4601         * elf32-hppa.c (elf_backend_no_page_alias): Define.
4602
4603 2017-02-16  Alan Modra  <amodra@gmail.com>
4604
4605         PR 21132
4606         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
4607         if pic.
4608
4609 2017-02-16  Jiong Wang <jiong.wang@arm.com>
4610
4611         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
4612         * bfd-in2.h: Regenerated.
4613
4614 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
4615
4616         PR ld/21168
4617         * elf32-i386.c (elf_i386_relocate_section): Allow
4618         "lea foo@GOT, %reg" in PIC.
4619
4620 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
4621
4622         PR ld/20244
4623         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
4624         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
4625         error against local IFUNC symbol without a base register for
4626         PIC.
4627
4628 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
4629
4630         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
4631         `%P: %H:' with `info->callbacks->einfo'.
4632         (ppc_elf_relocate_section): Likewise.
4633         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
4634         (ppc64_elf_edit_toc): Likewise.
4635         (ppc64_elf_relocate_section): Likewise.
4636
4637 2017-02-14  Alan Modra  <amodra@gmail.com>
4638
4639         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
4640         --gc-keep-exported, and test versioned field of sym rather than
4641         looking for @ in name.
4642
4643 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
4644
4645         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
4646         __global_pointer$.
4647
4648 2017-02-13  Nick Clifton  <nickc@redhat.com>
4649
4650         PR binutils/21151
4651         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
4652         unit length field.
4653
4654 2017-02-07  Andrew Waterman  <andrew@sifive.com>
4655
4656         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
4657         entry size if PLT header is written.
4658
4659 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
4660
4661         Fix sparc64 dynamic relocation processing to use the dynamic
4662         symbol count.
4663         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
4664         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
4665         should be used.
4666
4667 2017-02-03  Nick Clifton  <nickc@redhat.com>
4668
4669         PR 21096
4670         * coffcode.h (coff_write_object_contents): Enlarge size of
4671         s_name_buf in order to avoid compile time warning about possible
4672         integer truncation.
4673         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
4674         32-bits of insn value before printing into buffer.
4675
4676 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
4677
4678         * elfxx-mips.c (mips_elf_hash_sort_data): Add
4679         `max_local_dynindx'.
4680         (mips_elf_sort_hash_table): Handle it.
4681         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
4682         symbols bump up `max_local_dynindx' rather than
4683         `max_non_got_dynindx'.
4684
4685 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
4686
4687         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
4688         `min_got_dynindx', `max_unref_got_dynindx' and
4689         `max_non_got_dynindx' members to the `bfd_size_type' data type.
4690         (mips_elf_sort_hash_table): Adjust accordingly.
4691
4692 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
4693
4694         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
4695         to access the hash table.
4696
4697 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
4698
4699         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
4700         non-NULL `htab' to the beginning.
4701
4702 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
4703
4704         * elflink.c (elf_gc_sweep): Wrap overlong line.
4705
4706 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
4707
4708         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
4709         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
4710         * elfxx-mips.c (mips_elf_link_hash_table): Add
4711         `ignore_branch_isa' member.
4712         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
4713         in branch relocation calculation as an error if
4714         `ignore_branch_isa' has been set.
4715         (_bfd_mips_elf_insn32): Rename to...
4716         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
4717         parameter to `insn32' and add an `ignore_branch_isa' parameter.
4718         Handle the new parameter.
4719
4720 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
4721
4722         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
4723         local variable dynobj.
4724
4725         PR ld/20995
4726         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
4727         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
4728         executable from read-only sections into sdynrelro.
4729         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
4730         dynamic relocs in sdynrelro.
4731         (elf_backend_want_dynrelro): Define.
4732
4733 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
4734
4735         * config.bfd (*-*-rtemsaout*): Mark as removed.
4736
4737 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
4738
4739         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
4740         (arm-*-rtems*): Move to (arm*-*-eabi*).
4741         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
4742         (m68-*-rtems*): Move to (m68*-*-elf*).
4743
4744 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
4745
4746         * config.bfd (*-*-rtemscoff*): Mark as removed.
4747
4748 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
4749
4750         PR ld/20828
4751         * elflink.c (bfd_elf_record_link_assignment): Revert last
4752         change and don't ever clear `forced_local'.  Set `mark'
4753         unconditionally.
4754         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
4755         file.
4756         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
4757         (bfd_elf_size_dynamic_sections): ... here.
4758         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
4759         and set `mark' instead in `__tls_get_addr_opt' processing.
4760         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
4761
4762 2017-01-24  Alan Modra  <amodra@gmail.com>
4763
4764         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
4765         where dynamic relocs are preferable.  Allow ifunc too.
4766         (ensure_undefweak_dynamic): New function.
4767         (allocate_dynrelocs): Use it here.  Move plt handling last and
4768         don't make symbols dynamic, simplifying loop.  Only make undef
4769         weak symbols with GOT entries dynamic.  Correct condition
4770         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
4771         comments.  Remove goto.
4772         (ppc_elf_relocate_section): Correct test for using dynamic
4773         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
4774         to suit.  Set up explicit tls_index entries and implicit GOT
4775         tls_index entries resolvable at link time for
4776         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
4777         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
4778         (ensure_undefweak_dynamic): New function.
4779         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
4780         with GOT entries dynamic.  Remove unnecessary test of
4781         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
4782         (ppc64_elf_relocate_section): Correct test for using dynamic
4783         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
4784         to suit.  Set up explicit tls_index entries and implicit GOT
4785         tls_index entries resolvable at link time for __tls_get_addr_opt.
4786         Simplify expression to clear mem for prelink.
4787
4788 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
4789
4790         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
4791
4792 2017-01-20  Jiong Wang <jiong.wang@arm.com>
4793
4794         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
4795         (elf_backend_hash_symbol): Define.
4796
4797 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
4798
4799         PR ld/20828
4800         * elflink.c (bfd_elf_record_link_assignment): Clear any
4801         `forced_local' marking for DSO symbols that are not being
4802         provided.
4803
4804 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
4805
4806         * elfnn-riscv.c (riscv_elf_object_p): New function.
4807
4808 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
4809
4810         PR ld/21038
4811         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
4812         plt_bnd_eh_frame.
4813         (elf_x86_64_check_relocs): Create .eh_frame section for the
4814         .plt.bnd section.
4815         (elf_x86_64_size_dynamic_sections): Allocate and initialize
4816         .eh_frame section for the .plt.bnd section.
4817         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
4818         for the .plt.bnd section.
4819
4820 2017-01-12  Nick Clifton  <nickc@redhat.com>
4821
4822         PR binutils/20876
4823         * opncls.c (find_separate_debug_file): Add include_dirs
4824         parameter.  Only include the directory part of the bfd's filename
4825         in search paths if include_dirs is true.  Add a couple of extra
4826         locations for looking for debug files.
4827         ( bfd_follow_gnu_debuglink): Update invocation of
4828         find_separate_debug_file.
4829         (bfd_follow_gnu_debugaltlink): Likewise.
4830         (get_build_id): New function: Finds the build-id of the given bfd.
4831         (get_build_id_name): New function: Computes the name of the
4832         separate debug info file for a bfd, based upon its build-id.
4833         (check_build_id_file): New function: Checks to see if a separate
4834         debug info file exists at the given location, and that its
4835         build-id matches that of the original bfd.
4836         (bfd_follow_build_id_debuglink): New function: Finds a separate
4837         debug info file for a given bfd by using the build-id method.
4838         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
4839         method of locating a separate debug info file before using the
4840         debuglink method.
4841         * bfd-in2.h: Regenerate.
4842
4843 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
4844
4845         PR ld/21038
4846         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
4847         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
4848         elf_x86_64_eh_frame_plt_got.
4849         (elf_x86_64_size_dynamic_sections): Get unwind info from
4850         elf_x86_64_bnd_arch_bed for the BND PLT.
4851
4852 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
4853
4854         * config.bfd: Add entries for i686-redox and x86_64-redox.
4855
4856 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4857
4858         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
4859         to 4 bytes.
4860         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
4861         .eh_frame section to 4 bytes for x32.
4862         (elf_x86_64_check_relocs): Likewise.
4863
4864 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4865
4866         PR ld/20830
4867         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
4868         (PLT_GOT_FDE_LENGTH): Likewise.
4869         (elf_i386_plt_layout): Add eh_frame_plt_got and
4870         eh_frame_plt_got_size.
4871         (elf_i386_plt): Updated.
4872         (elf_i386_link_hash_table): Add plt_got_eh_frame.
4873         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
4874         (elf_i386_size_dynamic_sections): Allocate and initialize
4875         .eh_frame section for .plt.got.
4876         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
4877         .plt.got.
4878         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
4879         eh_frame_plt_got_size.
4880         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
4881         (PLT_GOT_FDE_LENGTH): Likewise.
4882         (elf_x86_64_backend_data): Add eh_frame_plt_got and
4883         eh_frame_plt_got_size.
4884         (elf_x86_64_arch_bed): Updated.
4885         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
4886         eh_frame_plt_got_size.
4887         (elf_x86_64_nacl_arch_bed): Likewise.
4888         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
4889         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
4890         (elf_x86_64_size_dynamic_sections): Allocate and initialize
4891         .eh_frame section for .plt.got.
4892         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
4893         for .plt.got.
4894
4895 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
4896
4897         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
4898         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
4899
4900 2017-01-09  Nick Clifton  <nickc@redhat.com>
4901
4902         * dwarf2.c (lookup_address_in_function_table): Return early if
4903         there are no functions in the given comp unit, or if the high
4904         address of the last function in the comp unit is less than the
4905         desired address.
4906
4907 2017-01-09  Nick Clifton  <nickc@redhat.com>
4908
4909         PR binutils/21013
4910         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
4911         message if there are too many symbols to load.
4912
4913 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
4914
4915         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
4916         if relocs are cached.
4917
4918 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
4919
4920         PR ld/21017
4921         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
4922         for R_MICROBLAZE_GOTOFF_64.
4923
4924 2017-01-03  Nick Clifton  <nickc@redhat.com>
4925
4926         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
4927         warning about using a possibly uninitialised variable.
4928
4929 2017-01-02  Alan Modra  <amodra@gmail.com>
4930
4931         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
4932         (allocate_plt_static, allocate_dynrelocs): Use it.
4933
4934 2017-01-02  Alan Modra  <amodra@gmail.com>
4935
4936         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
4937         .PARISC.unwind section.
4938
4939 2017-01-02  Alan Modra  <amodra@gmail.com>
4940
4941         PR ld/20989
4942         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
4943         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
4944         indirect to GOT pointer relative code edit.
4945
4946 2017-01-02  Alan Modra  <amodra@gmail.com>
4947
4948         Update year range in copyright notice of all files.
4949
4950 For older changes see ChangeLog-2016
4951 \f
4952 Copyright (C) 2017 Free Software Foundation, Inc.
4953
4954 Copying and distribution of this file, with or without modification,
4955 are permitted in any medium without royalty provided the copyright
4956 notice and this notice are preserved.
4957
4958 Local Variables:
4959 mode: change-log
4960 left-margin: 8
4961 fill-column: 74
4962 version-control: never
4963 End: