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