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