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