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