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