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