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