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