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