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