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