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