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