1a3cc5106e5a1f0413b1e16425fe6477862359e9
[external/binutils.git] / bfd / ChangeLog
1 2017-08-31  Alan Modra  <amodra@gmail.com>
2
3         * po/SRC-POTFILES.in: Regenerate.
4
5 2017-08-31  Alan Modra  <amodra@gmail.com>
6
7         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Don't exit early
8         for a section containing just a terminator.  Allow multiple
9         terminators at end of section.
10         * elflink.c (bfd_elf_discard_info): Iterate over .eh_frame
11         sections when not adding alignment.  Assert on terminator in
12         the middle of FDEs.
13
14 2017-08-31  Alan Modra  <amodra@gmail.com>
15
16         PR 21441
17         PR 22048
18         * elflink.c (bfd_elf_discard_info): Don't pad embedded zero
19         terminators.
20
21 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
22
23         * configure.ac (bfd_backends): Add elf64.lo together with
24         elfxx-x86.lo for 64-bit BFD.
25         * configure: Regenerated.
26
27 2017-08-31  James Bowman  <james.bowman@ftdichip.com>
28
29         * elf32-ft32.c (ft32_elf_howto_table): Use complain_overflow_dont
30         for R_FT32_18.
31
32 2017-08-31  Alan Modra  <amodra@gmail.com>
33
34         PR binutils/22032
35         * opncls.c (bfd_close_all_done): Don't call bfd_cache_close
36         before _close_and_cleanup.  Call iovec->bclose after.
37         (bfd_close): Remove code common to, and call, bfd_close_all_done.
38
39 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
40
41         * elf32-i386.c (elf_i386_plt_type): Removed.
42         (elf_i386_plt): Likewise.
43         (elf_i386_get_synthetic_symtab): Updated.   Call
44         _bfd_x86_elf_get_synthetic_symtab.
45         * elf64-x86-64.c (elf_x86_64_plt_type): Removed.
46         (elf_x86_64_plt): Likewise.
47         (elf_x86_64_get_synthetic_symtab): Updated.  Call
48         _bfd_x86_elf_get_synthetic_symtab.
49         * elfxx-x86.c (elf_i386_get_plt_got_vma): New function.
50         (elf_x86_64_get_plt_got_vma): Likewise.
51         (elf_i386_valid_plt_reloc_p): Likewise.
52         (elf_x86_64_valid_plt_reloc_p): Likewise.
53         (_bfd_x86_elf_get_synthetic_symtab): Likewise.
54         * elfxx-x86.h (elf_x86_plt_type): New.
55         (elf_x86_plt): Likewise.
56         (_bfd_x86_elf_get_synthetic_symtab): Likewise.
57
58 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
59
60         * elfxx-x86.c (_bfd_x86_elf_link_hash_table_create): Check
61         target_id instead of elf_machine_code.
62
63 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
64
65         * elf32-i386.c (ELF_DYNAMIC_INTERPRETER): Removed.
66         (elf_i386_lazy_plt_layout): Likewise.
67         (elf_i386_non_lazy_plt_layout): Likewise.
68         (elf_i386_plt_layout): Likewise.
69         (elf_i386_link_hash_table): Likewise.
70         (elf_i386_next_tls_desc_index): Likewise.
71         (elf_i386_srelplt2): Likewise.
72         (elf_i386_plt): Likewise.
73         (elf_i386_lazy_plt): Likewise.
74         (elf_i386_non_lazy_plt): Likewise.
75         (elf_i386_link_hash_table_create): Likewise.
76         (bfd_elf32_bfd_link_hash_table_create): Likewise.
77         (elf_i386_lazy_plt): Updated.
78         (elf_i386_non_lazy_plt): Likewise.
79         (elf_i386_lazy_ibt_plt): Likewise.
80         (elf_i386_non_lazy_ibt_plt): Likewise.
81         (elf_i386_allocate_dynrelocs): Likewise.
82         (elf_i386_size_dynamic_sections): Likewise.
83         (elf_i386_relocate_section): Likewise.
84         (elf_i386_finish_dynamic_symbol): Likewise.
85         (elf_i386_finish_dynamic_sections): Likewise.
86         (elf_i386_get_synthetic_symtab): Likewise.
87         (elf_i386_link_setup_gnu_properties): Likewise.
88         (elf_i386_nacl_plt): Likewise.
89         * elf64-x86-64.c (ABI_64_P): Removed.
90         (ELF64_DYNAMIC_INTERPRETER): Likewise.
91         (ELF32_DYNAMIC_INTERPRETER): Likewise.
92         (elf_x86_64_lazy_plt_layout): Likewise.
93         (elf_x86_64_non_lazy_plt_layout): Likewise.
94         (elf_x86_64_plt_layout): Likewise.
95         (elf_x86_64_link_hash_table): Likewise.
96         (elf_x86_64_plt): Likewise.
97         (elf_x86_64_lazy_plt): Likewise.
98         (elf_x86_64_non_lazy_plt): Likewise.
99         (elf_x86_64_link_hash_table_create): Likewise.
100         (bfd_elf64_bfd_link_hash_table_create): Likewise.
101         (bfd_elf32_bfd_link_hash_table_create): Likewise.
102         (elf_x86_64_lazy_plt): Updated.
103         (elf_x86_64_non_lazy_plt): Likewise.
104         (elf_x86_64_lazy_bnd_plt): Likewise.
105         (elf_x86_64_non_lazy_bnd_plt): Likewise.
106         (elf_x86_64_lazy_ibt_plt): Likewise.
107         (elf_x32_lazy_ibt_plt): Likewise.
108         (elf_x86_64_non_lazy_ibt_plt): Likewise.
109         (elf_x32_non_lazy_ibt_plt): Likewise.
110         (elf_x86_64_allocate_dynrelocs): Likewise.
111         (elf_x86_64_size_dynamic_sections): Likewise.
112         (elf_x86_64_relocate_section): Likewise.
113         (elf_x86_64_finish_dynamic_symbol): Likewise.
114         (elf_x86_64_finish_dynamic_sections): Likewise.
115         (elf_x86_64_get_synthetic_symtab): Likewise.
116         (elf_x86_64_link_setup_gnu_properties): Likewise.
117         (elf_x86_64_nacl_plt): Likewise.
118         * elfxx-x86.c: Include "objalloc.h", "elf/i386.h" and
119         "elf/x86-64.h".
120         (ELF32_DYNAMIC_INTERPRETER): New.
121         (ELF64_DYNAMIC_INTERPRETER): Likewise.
122         (ELFX32_DYNAMIC_INTERPRETER): Likewise.
123         (_bfd_x86_elf_link_hash_table_create): Likewise.
124         (_bfd_x86_elf_link_hash_table_free): Renamed to ...
125         (elf_x86_link_hash_table_free): This.  Make it static.
126         * elfxx-x86.h: Don't include "objalloc.h".
127         (ABI_64_P): New.
128         (elf_x86_lazy_plt_layout): Likewise.
129         (elf_x86_non_lazy_plt_layout): Likewise.
130         (elf_x86_plt_layout): Likewise.
131         (_bfd_x86_elf_link_hash_table_create): Likewise.
132         (bfd_elf64_bfd_link_hash_table_create): Likewise.
133         (bfd_elf32_bfd_link_hash_table_create): Likewise.
134         (elf_x86_link_hash_table): Add plt, lazy_plt, non_lazy_plt,
135         srelplt2 and next_tls_desc_index.
136         (_bfd_x86_elf_link_hash_table_free): Removed.
137
138 2017-08-30  Maciej W. Rozycki  <macro@imgtec.com>
139
140         * elfxx-mips.c (mips_elf_perform_relocation): Correct microMIPS
141         branch offset interpretation.
142
143 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
144
145         PR binutils/22032
146         * opncls.c (bfd_close_all_done): Call _close_and_cleanup.
147
148 2017-08-30  H.J. Lu  <hongjiu.lu@intel.com>
149
150         * elf64-x86-64.c (elf_x86_64_next_tls_desc_index): Removed.
151         (elf_x86_64_srelplt2): Likewise.
152
153 2017-08-30  Alan Modra  <amodra@gmail.com>
154
155         * elf64-ppc.c (struct ppc_link_hash_table): Add do_tls_opt.
156         (ppc64_elf_tls_optimize): Set it.
157         (ppc64_elf_relocate_section): Nop addis on TPREL16_HA, and convert
158         insn on TPREL16_LO and TPREL16_LO_DS relocs to use r13 when
159         addis would add zero.
160         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add do_tls_opt.
161         (ppc_elf_tls_optimize): Set it.
162         (ppc_elf_relocate_section): Nop addis on TPREL16_HA, and convert
163         insn on TPREL16_LO relocs to use r2 when addis would add zero.
164
165 2017-08-30  Alan Modra  <amodra@gmail.com>
166
167         * elf64-ppc.c (ppc64_elf_relocate_section): When optimizing
168         __tls_get_addr call sequences to LE, don't move the addi down
169         to the nop.  Replace the bl with addi and leave the nop alone.
170
171 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
172
173         * elf32-i386.c (elf_i386_pie_finish_undefweak_symbol):
174         Re-indent.
175         * elf64-x86-64.c (elf_x86_64_finish_local_dynamic_symbol):
176         Likewise.
177         (elf_x86_64_pie_finish_undefweak_symbol): Likewise.
178
179 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
180
181         * Makefile.am (BFD32_BACKENDS): Add elfxx-x86.lo.
182         (BFD64_BACKENDS): Likewise.
183         (BFD32_BACKENDS_CFILES): Add elfxx-x86.c.
184         (BFD64_BACKENDS_CFILES): Likewise.
185         * Makefile.in: Regenerated.
186         * configure.ac (bfd_backends): Add elfxx-x86.lo together with
187         elf32-i386.lo and elf64-x86-64.lo.
188         * configure: Regenerated.
189         * elf32-i386.c: Include "elfxx-x86.h" instead of "sysdep.h",
190         "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
191         "objalloc.h" and "hashtab.h".
192         (ELIMINATE_COPY_RELOCS): Removed.
193         (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
194         (SYMBOL_NO_COPYRELOC): Likewise.
195         (elf_i386_link_hash_entry): Likewise.
196         (GOT_UNKNOWN): Likewise.
197         (GOT_NORMAL): Likewise.
198         (GOT_TLS_GD): Likewise.
199         (elf_i386_hash_entry): Likewise.
200         (elf_i386_obj_tdata): Likewise.
201         (elf_i386_tdata): Likewise.
202         (elf_i386_local_got_tls_type): Likewise.
203         (elf_i386_local_tlsdesc_gotent): Likewise.
204         (elf_i386_hash_table): Likewise.
205         (elf_i386_link_hash_newfunc): Likewise.
206         (elf_i386_local_htab_hash): Likewise.
207         (elf_i386_local_htab_eq): Likewise.
208         (elf_i386_get_local_sym_hash): Likewise.
209         (elf_i386_link_hash_table_free): Likewise.
210         (elf_i386_copy_indirect_symbol): Likewise.
211         (elf_i386_fixup_symbol): Likewise.
212         (elf_i386_readonly_dynrelocs): Likewise.
213         (elf_i386_always_size_sections): Likewise.
214         (elf_i386_set_tls_module_base): Likewise.
215         (elf_i386_dtpoff_base): Likewise.
216         (compare_relocs): Likewise.
217         (elf_i386_hash_symbol): Likewise.
218         (elf_i386_parse_gnu_properties): Likewise.
219         (elf_i386_merge_gnu_properties): Likewise.
220         (elf_i386_link_check_relocs): Likewise.
221         (elf_i386_merge_symbol_attribute): Likewise.
222         (bfd_elf32_bfd_link_check_relocs): Likewise.
223         (elf_backend_copy_indirect_symbol): Likewise.
224         (elf_backend_always_size_sections): Likewise.
225         (elf_backend_omit_section_dynsym): Likewise.
226         (elf_backend_hash_symbol): Likewise.
227         (elf_backend_fixup_symbol): Likewise.
228         (elf_backend_parse_gnu_properties): Likewise.
229         (elf_backend_merge_gnu_properties): Likewise.
230         (elf_backend_merge_symbol_attribute): Likewise.
231         (elf_i386_mkobject): Updated.
232         (elf_i386_link_hash_table_create): Likewise.
233         (elf_i386_check_tls_transition): Likewise.
234         (elf_i386_tls_transition): Likewise.
235         (elf_i386_convert_load_reloc): Likewise.
236         (elf_i386_check_relocs): Likewise.
237         (elf_i386_adjust_dynamic_symbol): Likewise.
238         (elf_i386_allocate_dynrelocs): Likewise.
239         (elf_i386_convert_load): Likewise.
240         (elf_i386_size_dynamic_sections): Likewise.
241         (elf_i386_relocate_section): Likewise.
242         (elf_i386_finish_dynamic_symbol ): Likewise.
243         (elf_i386_finish_dynamic_sections): Likewise.
244         (elf_i386_output_arch_local_syms): Likewise.
245         (elf_i386_get_synthetic_symtab): Likewise.
246         (elf_i386_link_setup_gnu_properties): Likewise.
247         (elf_i386_link_hash_table): Use elf_x86_link_hash_table, instead
248         of elf_link_hash_table, as base.
249         (elf_i386_next_tls_desc_index): New.
250         (elf_i386_srelplt2): Likewise.
251         (elf_i386_plt): Likewise.
252         (elf_i386_lazy_plt): Likewise.
253         (elf_i386_non_lazy_plt): Likewise.
254         * elf32-x86-64.c: Include "elfxx-x86.h" instead of "sysdep.h",
255         "bfd.h", "bfdlink.h", "libbfd.h", "elf-bfd.h", "bfd_stdint.h",
256         "objalloc.h" and "hashtab.h".
257         (ELIMINATE_COPY_RELOCS): Removed.
258         (UNDEFINED_WEAK_RESOLVED_TO_ZERO):Likewise.
259         (SYMBOL_NO_COPYRELOC): Likewise.
260         (elf_x86_64_link_hash_entry): Likewise.
261         (GOT_UNKNOWN): Likewise.
262         (GOT_NORMAL): Likewise.
263         (GOT_TLS_GD): Likewise.
264         (elf_x86_64_hash_entry): Likewise.
265         (elf_x86_64_obj_tdata): Likewise.
266         (elf_x86_64_tdata): Likewise.
267         (elf_x86_64_local_got_tls_type): Likewise.
268         (elf_x86_64_local_tlsdesc_gotent): Likewise.
269         (elf_x86_64_hash_table): Likewise.
270         (elf_x86_64_link_hash_newfunc): Likewise.
271         (elf_x86_64_local_htab_hash): Likewise.
272         (elf_x86_64_local_htab_eq): Likewise.
273         (elf_x86_64_get_local_sym_hash): Likewise.
274         (elf_x86_64_link_hash_table_free): Likewise.
275         (elf_x86_64_copy_indirect_symbol): Likewise.
276         (elf_x86_64_fixup_symbol): Likewise.
277         (elf_x86_64_readonly_dynrelocs): Likewise.
278         (elf_x86_64_always_size_sections): Likewise.
279         (elf_x86_64_set_tls_module_base): Likewise.
280         (elf_x86_64_dtpoff_base): Likewise.
281         (compare_relocs): Likewise.
282         (elf_x86_64_merge_symbol_attribute): Likewise.
283         (elf_x86_64_hash_symbol): Likewise.
284         (elf_x86_64_parse_gnu_properties): Likewise.
285         (elf_x86_64_merge_gnu_properties): Likewise.
286         (elf_x86_64_link_check_relocs): Likewise.
287         (elf_backend_copy_indirect_symbol): Likewise.
288         (elf_backend_always_size_sections): Likewise.
289         (bfd_elf64_bfd_link_check_relocs): Likewise.
290         (elf_backend_merge_symbol_attribute): Likewise.
291         (elf_backend_hash_symbol): Likewise.
292         (elf_backend_omit_section_dynsym): Likewise.
293         (elf_backend_fixup_symbol): Likewise.
294         (elf_backend_parse_gnu_properties): Likewise.
295         (elf_backend_merge_gnu_properties): Likewise.
296         (bfd_elf32_bfd_link_check_relocs): Likewise.
297         (elf_x86_64_mkobject): Updated.
298         (elf_x86_64_link_hash_table_create): Likewise.
299         (elf_x86_64_check_tls_transition): Likewise.
300         (elf_x86_64_tls_transition): Likewise.
301         (elf_x86_64_convert_load_reloc): Likewise.
302         (elf_x86_64_check_relocs): Likewise.
303         (elf_x86_64_adjust_dynamic_symbol): Likewise.
304         (elf_x86_64_allocate_dynrelocs): Likewise.
305         (elf_x86_64_convert_load): Likewise.
306         (elf_x86_64_size_dynamic_sections): Likewise.
307         (elf_x86_64_relocate_section): Likewise.
308         (elf_x86_64_finish_dynamic_symbol ): Likewise.
309         (elf_x86_64_finish_dynamic_sections): Likewise.
310         (elf_x86_64_output_arch_local_syms): Likewise.
311         (elf_x86_64_get_synthetic_symtab): Likewise.
312         (elf_x86_64_link_setup_gnu_properties): Likewise.
313         (elf_x86_64_link_hash_table): Use elf_x86_link_hash_table,
314         instead of elf_link_hash_table, as base.
315         (elf_x86_64_next_tls_desc_index): New.
316         (elf_x86_64_srelplt2): Likewise.
317         (elf_x86_64_plt): Likewise.
318         (elf_x86_64_lazy_plt): Likewise.
319         (elf_x86_64_non_lazy_plt): Likewise.
320         * elfxx-x86.c: New file.
321         * elfxx-x86.h: Likewise.
322
323 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
324
325         * elf32-i386.c (elf_i386_get_synthetic_symtab): Simplify bad
326         return.
327         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
328
329 2017-08-29  H.J. Lu  <hongjiu.lu@intel.com>
330
331         * elf32-i386.c (elf_i386_get_synthetic_symtab): Check valid PLT
332         sections before checking dynamic relocations and free invalid
333         PLT section contents.
334         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
335
336 2017-08-28  H.J. Lu  <hongjiu.lu@intel.com>
337
338         * elf-bfd.h (_bfd_elf_ifunc_get_synthetic_symtab): Removed.
339         * elf-ifunc.c (_bfd_elf_ifunc_get_synthetic_symtab): Likewise.
340
341 2017-08-28  H.J. Lu  <hongjiu.lu@intel.com>
342
343         PR binutils/22018
344         * elf32-i386.c (elf_i386_get_synthetic_symtab): Check for valid
345         PLT section size.
346         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
347
348 2017-08-27  H.J. Lu  <hongjiu.lu@intel.com>
349
350         * elf32-i386.c (elf_i386_link_hash_newfunc): Initialize
351         def_protected.
352         * elf64-x86-64.c (elf_x86_64_link_hash_newfunc): Likewise.
353
354 2017-08-26  H.J. Lu  <hongjiu.lu@intel.com>
355
356         PR ld/21997
357         * elf-bfd.h (elf_obj_tdata): Use ENUM_BITFIELD on object_id,
358         dyn_lib_class and has_gnu_symbols.  Change bad_symtab to bitfield.
359         Add a has_no_copy_on_protected bitfield.
360         (elf_has_no_copy_on_protected): New.
361         * elf-properties.c (_bfd_elf_parse_gnu_properties): Set
362         elf_has_no_copy_on_protected for GNU_PROPERTY_NO_COPY_ON_PROTECTED.
363         (elf_merge_gnu_property_list): Likewise.
364         (_bfd_elf_link_setup_gnu_properties): Set extern_protected_data
365         to FALSE for elf_has_no_copy_on_protected.
366         * elf32-i386.c (SYMBOL_NO_COPYRELOC): New.
367         (elf_i386_link_hash_entry): Add def_protected.
368         (elf_i386_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
369         when checking info->nocopyreloc.
370         (elf_i386_link_setup_gnu_properties): Don't set
371         extern_protected_data here.
372         (elf_i386_merge_symbol_attribute): New function.
373         (elf_backend_merge_symbol_attribute): New.
374         * elf64-x86-64.c (SYMBOL_NO_COPYRELOC): New.
375         (elf_x86_64_link_hash_entry): Add def_protected.
376         (elf_x86_64_need_pic): Report protected symbol for def_protected.
377         (elf_x86_64_adjust_dynamic_symbol): Also check SYMBOL_NO_COPYRELOC
378         when checking info->nocopyreloc.
379         (elf_x86_64_relocate_section): Also check for R_X86_64_PC32
380         relocation run-time overflow and unresolvable R_X86_64_32S
381         relocation against protected data symbol defined in shared object
382         with GNU_PROPERTY_NO_COPY_ON_PROTECTED.
383         (elf_x86_64_link_setup_gnu_properties): Don't set
384         extern_protected_data here.
385         (elf_x86_64_merge_symbol_attribute): New function.
386         (elf_backend_merge_symbol_attribute): New.
387
388 2017-08-26  Alan Modra  <amodra@gmail.com>
389
390         * elf32-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
391         (ppc_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
392         (ppc_elf_relocate_section): Comment fix.
393         * elf64-ppc.c (must_be_dyn_reloc): Use bfd_link_dll.  Comment.
394         (ppc64_elf_check_relocs): Only set DF_STATIC_TLS in shared libs.
395         Support dynamic relocs for TPREL16 when non-pic too.
396         (dec_dynrel_count): Adjust TPREL16 handling as per check_relocs.
397         (ppc64_elf_relocate_section): Support dynamic relocs for TPREL16
398         when non-pic too.
399
400 2017-08-25  H.J. Lu  <hongjiu.lu@intel.com>
401
402         * elf32-i386.c (elf_i386_link_hash_entry): Remove redundant
403         "symbol" in comments.
404         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Likewise.
405
406 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
407
408         PR ld/22001
409         * elf64-x86-64.c (elf_x86_64_relocate_section): Check for
410         R_X86_64_PC32 relocation run-time overflow and unresolvable
411         R_X86_64_32S relocation with -z nocopyreloc.
412
413 2017-08-24  H.J. Lu  <hongjiu.lu@intel.com>
414
415         * elf32-i386.c (elf_i386_check_relocs): Revert the last change.
416         Undefined symbols may not have a type.
417         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
418
419 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
420
421         * elf64-x86-64.c (elf_x86_64_need_pic): Add an argument for
422         bfd_link_info.  Report shared, PIE or PDE object based on
423         bfd_link_info.
424         (elf_x86_64_check_relocs): Update elf_x86_64_need_pic call.
425         (elf_x86_64_relocate_section): Likewise.
426
427 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
428
429         * elf32-i386.c (elf_i386_check_relocs): Increment PLT count only
430         for function symbols.
431         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
432
433 2017-08-23  H.J. Lu  <hongjiu.lu@intel.com>
434
435         * elf32-i386.c (elf_i386_link_setup_gnu_properties): Set
436         extern_protected_data to FALSE if GNU_PROPERTY_NO_COPY_ON_PROTECTED
437         is set on any input relocatable file.
438         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
439
440 2017-08-23  Alan Modra  <amodra@gmail.com>
441
442         PR 21988
443         * elf64-ppc.c (ensure_undef_dynamic): Rename from
444         ensure_undefweak_dynamic.  Handle undefined too.
445         * elf32-ppc.c (ensure_undef_dynamic): Likewise.
446         * elf32-hppa.c (ensure_undef_dynamic): Likewise.
447         (allocate_dynrelocs): Discard undefined non-default visibility
448         relocs first.  Make undefined syms dynamic.  Tidy goto.
449
450 2017-08-21  Alan Modra  <amodra@gmail.com>
451             H.J. Lu  <hongjiu.lu@intel.com>
452
453         PR ld/21964
454         * elf-bfd.h (SYMBOLIC_BIND): Return TRUE for __start/__stop symbols.
455         * elflink.c (bfd_elf_define_start_stop): Rewrite.
456
457 2017-08-21  Hans-Peter Nilsson  <hp@bitrange.com>
458
459         PR ld/20125
460         * elf64-mmix.c (mmix_elf_relax_section): Correct handling of
461         undefined weak symbols.
462
463 2017-08-18  Nick Clifton  <nickc@redhat.com>
464
465         PR binutils/21962
466         * tekhex.c (getsym): Fix check for source pointer walking off the
467         end of the input buffer.
468
469 2017-08-17  Szabolcs Nagy  <szabolcs.nagy@arm.com>
470
471         PR ld/18808
472         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Skip IFUNC
473         relocations in debug sections, change abort to _bfd_error_handler.
474
475 2017-08-14  Nick Clifton  <nickc@redhat.com>
476
477         PR 21957
478         * elf.c (setup_group): Check for an empty or very small group
479         section.
480         * po/bfd.pot: Regenerate.
481
482 2017-08-14  Alan Modra  <amodra@gmail.com>
483
484         PR 21441
485         * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't add
486         alignment padding here.
487         * elflink.c (bfd_elf_discard_info): Add .eh_frame padding here
488         in a reverse pass over sections.
489
490 2017-08-11  H.J. Lu  <hongjiu.lu@intel.com>
491
492         PR binutils/21943
493         * elf32-i386.c (elf_i386_get_synthetic_symtab): Allocate space
494         for @plt suffixes first.
495         * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
496
497 2017-08-08  Nick Clifton  <nickc@redhat.com>
498
499         PR 21916
500         * elf-attrs.c (_bfd_elf_parse_attributes): Complain about very
501         small section lengths.
502         * elf.c (_bfd_elf_setup_sections): Skip empty entries in the group
503         table.
504         (elfcore_grok_freebsd_prstatus): Add checks to make sure that
505         there is enough data present in the note.
506
507 2017-08-08  Alan Modra  <amodra@gmail.com>
508
509         PR 21017
510         * elf32-microblaze.c (microblaze_elf_check_relocs): Don't bump
511         got.refcount for GOTOFF relocs, just create .got section.
512
513 2017-08-07  H.J. Lu  <hongjiu.lu@intel.com>
514
515         * elflink.c (elf_link_add_object_symbols): Move common symbol
516         check after bed->common_definition.
517
518 2017-08-07  Alan Modra  <amodra@gmail.com>
519
520         PR 21910
521         * elflink.c (bfd_elf_final_link): Don't segfault when sections
522         needed to define various dynamic tags have been discarded.
523
524 2017-08-07  Nick Clifton  <nickc@redhat.com>
525
526         PR 21884
527         * elf32-i386.c (elf_i386_link_setup_gnu_properties): If the dynobj
528         has not been set then use the bfd returned by
529         _bfd_elf_link_setup_gnu_properties.  If that is null then search
530         through all the input bfds selecting the first normal, ELF format
531         one.
532         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Likewise.
533
534 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
535
536         * elf32-i386.c (elf_i386_link_hash_entry): Change tls_get_addr
537         to 1 bit.
538         (elf_i386_link_hash_newfunc): Initialize tls_get_addr to 0.
539         (elf_i386_check_tls_transition): Check tls_get_addr directly.
540         (elf_i386_convert_load_reloc): Update tls_get_addr check.
541         (elf_i386_link_check_relocs): New function.
542         (bfd_elf32_bfd_link_check_relocs): New.
543         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Change tls_get_addr
544         to 1 bit.
545         (elf_x86_64_link_hash_newfunc): Initialize tls_get_addr to 0.
546         (elf_x86_64_check_tls_transition): Check tls_get_addr directly.
547         (elf_x86_64_convert_load_reloc): Update tls_get_addr check.
548         (elf_x86_64_link_check_relocs): New function.
549         (bfd_elf64_bfd_link_check_relocs): New.
550         (bfd_elf32_bfd_link_check_relocs): Likewise.
551
552 2017-08-06  H.J. Lu  <hongjiu.lu@intel.com>
553
554         PR ld/21903:
555         * elflink.c (elf_link_add_object_symbols): Treat common symbol
556         as undefined for --no-define-common.
557
558 2017-08-05  Alan Modra  <amodra@gmail.com>
559
560         * elf32-hppa.c (elf32_hppa_set_gp): Don't require an
561         hppa_link_hash_table.
562
563 2017-08-02  Max Filippov  <jcmvbkbc@gmail.com>
564
565         * xtensa-isa.c (xtensa_isa_init): Don't update lookup table
566         entries for sysregs with negative indices.
567
568 2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
569
570         * elf32-s390.c (elf_s390_finish_dynamic_sections): Skip if it
571         isn't the S/390 specific elf data.
572         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
573
574 2017-07-31  Kuan-Lin Chen  <rufus@andestech.com>
575
576         * elfxx-riscv.c (riscv_elf_add_sub_reloc): New function.
577         * (howto_table) [R_RISCV_ADD8]: Use riscv_elf_add_sub_reloc.
578         [R_RISCV_ADD16]: Likewise.
579         [R_RISCV_ADD32]: Likewise.
580         [R_RISCV_ADD64]: Likewise.
581         [R_RISCV_SUB6]: Likewise.
582         [R_RISCV_SUB8]: Likewise.
583         [R_RISCV_SUB16]: Likewise.
584         [R_RISCV_SUB32]: Likewise.
585         [R_RISCV_SUB64]: Likewise.
586
587 2017-07-31  Alan Modra  <amodra@gmail.com>
588
589         * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
590         without ld.so checks.
591
592 2017-07-29  Alan Modra  <amodra@gmail.com>
593
594         PR 21847
595         * elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry.
596         (ppc64_elf_merge_symbol): Set non_zero_localentry.
597         (is_elfv2_localentry0): Test non_zero_localentry.
598         (ppc64_elf_tls_setup): Default to --no-plt-localentry.
599
600 2017-07-28  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
601
602         * elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
603         pointer check for htab->elf.irelplt.
604         * elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.
605
606 2017-07-27  Nick Clifton  <nickc@redhat.com>
607
608         PR 21840
609         * mach-o.c (bfd_mach_o_read_symtab_strtab): Fail if the symtab
610         size is -1.
611         * nlmcode.h (nlm_swap_auxiliary_headers_in): Replace assertion
612         with error return.
613         * section.c (bfd_make_section_with_flags): Fail if the name or bfd
614         are NULL.
615         * vms-alpha.c (bfd_make_section_with_flags): Correct computation
616         of end pointer.
617         (evax_bfd_print_emh): Check for invalid string lengths.
618
619 2017-07-25  Nick Clifton  <nickc@redhat.com>
620
621         * po/fr.po: Updated French translation.
622
623 2017-07-25  Benjamin Green  <bengreen5mx@gmail.com>
624
625         PR 21824
626         * elf32-msp430.c (msp430_elf_relax_section): Allow conversion of
627         16-bit absolute branches into 10-bit pc-relative branches on the
628         MSP430 as well as the MSP430X.
629
630 2017-07-25  Alan Modra  <amodra@gmail.com>
631
632         * elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl.
633         (stub_eh_frame_size): New function.
634         (ppc_size_one_stub): Set group tls_get_addr_opt_bctrl.
635         (group_sections): Init group tls_get_addr_opt_bctrl.
636         (ppc64_elf_size_stubs): Update sizing and initialization of
637         .eh_frame.  Iteration over stubs via group list.
638         (ppc64_elf_build_stubs): Iterate over stubs via group list.
639         (ppc64_elf_finish_dynamic_sections): Update finalization of
640         .eh_frame.
641
642 2017-07-24  Nick Clifton  <nickc@redhat.com>
643
644         PR 21813
645         * mach-o.c (bfd_mach_o_canonicalize_relocs): Pass the base address
646         of the relocs to the canonicalize_one_reloc routine.
647         * mach-o.h (struct bfd_mach_o_backend_data): Update the prototype
648         for the _bfd_mach_o_canonicalize_one_reloc field.
649         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add
650         res_base parameter.  Use to check for corrupt pair relocs.
651         * mach-o-aarch64.c (bfd_mach_o_arm64_canonicalize_one_reloc):
652         Likewise.
653         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc):
654         Likewise.
655         * mach-o-x86-64.c (bfd_mach_o_x86_64_canonicalize_one_reloc):
656         Likewise.
657
658         * vms-alpha.c (_bfd_vms_slurp_eihd): Make sure that there is
659         enough data in the record before attempting to parse it.
660         (_bfd_vms_slurp_eeom): Likewise.
661
662         (_bfd_vms_slurp_egsd): Check for an invalid section index.
663         (image_set_ptr): Likewise.
664         (alpha_vms_slurp_relocs): Likewise.
665
666         (alpha_vms_object_p): Check for a truncated record.
667
668 2017-07-24  Nick Clifton  <nickc@redhat.com>
669
670         PR 21803
671         * reloc.c (_bfd_unrecognized_reloc): New function.  Reports
672         an unrecognized reloc and sets the bfd_error value.
673         * libbfd.h: Regenerate.
674         * elf32-arm.c (elf32_arm_final_link_relocate): Use the new
675         function.
676         * elf32-i386.c (elf_i386_relocate_section): Likewise.
677         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
678         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
679         * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Likewise.
680         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
681
682 2017-07-23  Alan Modra  <amodra@gmail.com>
683
684         * elf64-ppc.c (ppc64_elf_size_stubs): Correct advance to
685         restore of LR.
686
687 2017-07-19  Szabolcs Nagy  <szabolcs.nagy@arm.com>
688
689         PR ld/18841
690         * elfnn-aarch64.c (elfNN_aarch64_reloc_type_class): Return
691         reloc_class_ifunc for ifunc symbols.
692
693 2017-07-19  Nick Clifton  <nickc@redhat.com>
694
695         PR 21787
696         * archive.c (bfd_generic_archive_p): If the bfd does not have the
697         correct magic bytes at the start, set the error to wrong format
698         and clear the format selector before returning NULL.
699
700 2017-07-19  Nick Clifton  <nickc@redhat.com>
701
702         PR 21786
703         * coff-rs6000.c (_bfd_strntol): New function.
704         (_bfd_strntoll): New function.
705         (GET_VALUE_IN_FIELD): New macro.
706         (EQ_VALUE_IN_FIELD): new macro.
707         (_bfd_xcoff_slurp_armap): Use new macros.
708         (_bfd_xcoff_archive_p): Likewise.
709         (_bfd_xcoff_read_ar_hdr): Likewise.
710         (_bfd_xcoff_openr_next_archived_file): Likewise.
711         (_bfd_xcoff_stat_arch_elt): Likewise.
712         * coff64-rs6000.c (_bfd_strntol): New function.
713         (_bfd_strntoll): New function.
714         (GET_VALUE_IN_FIELD): New macro.
715         (xcoff64_slurp_armap): Use new macros.
716
717 2017-07-19  Claudiu Zissulescu  <claziss@synopsys.com>
718             John Eric Martin  <John.Martin@emmicro-us.com>
719
720         * bfd-in2.h: Regenerate.
721         * libbfd.h: Regenerate.
722         * elf32-arc.c (JLI): Define.
723         * reloc.c: Add JLI relocations.
724
725 2017-07-18  Nick Clifton  <nickc@redhat.com>
726
727         PR 21775
728         * coff-sh.c: Fix spelling typos.
729         * compress.c: Likewise.
730         * cpu-pdp11.c: Likewise.
731         * ecofflink.c: Likewise.
732         * elf-m10300.c: Likewise.
733         * elf.c: Likewise.
734         * elf32-arm.c: Likewise.
735         * elf32-m68k.c: Likewise.
736         * elf32-nds32.c: Likewise.
737         * elf32-ppc.c: Likewise.
738         * elf32-sh.c: Likewise.
739         * elf32-v850.c: Likewise.
740         * elf64-ppc.c: Likewise.
741         * elf64-x86-64.c: Likewise.
742         * elflink.c: Likewise.
743         * elfnn-aarch64.c: Likewise.
744         * elfxx-mips.c: Likewise.
745         * som.c: Likewise.
746         * sunos.c: Likewise.
747         * vms-alpha.c: Likewise.
748         * xcofflink.c: Likewise.
749
750 2017-07-18  Nick Clifton  <nickc@redhat.com>
751
752         PR binutils/21781
753         * coffcode.h (handle_COMDAT): Replace abort with an error message
754         and return.
755
756 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
757
758         PR ld/21782
759         * elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check
760         to shared library.
761
762 2017-07-17  H.J. Lu  <hongjiu.lu@intel.com>
763
764         * elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
765
766 2017-07-16  Alan Modra  <amodra@gmail.com>
767
768         * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
769         __tls_index GOT entries when using __tls_get_addr_opt stub.
770         * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
771
772 2017-07-12  Alan Modra  <amodra@gmail.com>
773
774         * po/es.po: Update from translationproject.org/latest/bfd/.
775         * po/fi.po: Likewise.
776         * po/fr.po: Likewise.
777         * po/id.po: Likewise.
778         * po/ja.po: Likewise.
779         * po/ro.po: Likewise.
780         * po/ru.po: Likewise.
781         * po/sr.po: Likewise.
782         * po/sv.po: Likewise.
783         * po/tr.po: Likewise.
784         * po/uk.po: Likewise.
785         * po/vi.po: Likewise.
786         * po/zh_CN.po: Likewise.
787         * po/hr.po: New file from translationproject.org.
788         * configure.ac (ALL_LINGUAS): Add hr.  Sort.
789         * configure: Regenerate.
790
791 2017-07-12  Nick Clifton  <nickc@redhat.com>
792
793         Fix compile time warnings using gcc 7.1.1.
794         * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
795         plt_name buffer.
796         (elf_xtensa_get_gotplt_section): Increase length of got_name
797         buffer.
798         * mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
799         default return of FALSE.
800         * mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
801         default return of FALSE.
802
803 2017-07-12  Alan Modra  <amodra@gmail.com>
804
805         * binary.c (binary_set_section_contents): Don't print filepos in
806         error message.
807         (coff_write_object_contents): Cast size_t for error message.
808         (coff_slurp_line_table): Don't use bfd_vma symndx.
809         (coff_slurp_reloc_table): Remove unneeded cast.
810         * dwarf2.c (read_section): Cast bfd_int64_t to long long for
811         error message.
812         (find_abstract_instance_name): Likewise.
813         * elf32-arm.c (arm_type_of_stub): Correct error arg order.
814         (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
815         (elf32_arm_check_relocs): Make r_symndx an int.
816         * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
817         format string.
818         * elf32-metag.c (elf_metag_relocate_section): Delete extra error
819         message arg.
820         * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
821         error message.
822         * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
823         * elf32-s390.c (elf_s390_check_relocs): Likewise.
824         * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
825         * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
826         * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
827         * elf64-s390.c (elf_s390_check_relocs): Likewise.
828         * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
829         * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
830         * elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
831         * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
832         * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
833         * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
834         and use %lu for error message.
835         * elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
836         * mmo.c (mmo_scan): Make stab_loc a file_ptr.  Cast expression for
837         error message.
838
839         * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
840         in error message.
841         (elf32_arm_final_link_relocate): Likewise.
842         * coff-arm.c (bfd_arm_process_before_allocation): Likewise.
843         * coffcode.h (styp_to_sec_flags): Likewise.
844         * cofflink.c (_bfd_coff_write_global_sym): Likewise.
845         * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
846         * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
847         * elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
848         (elf32_bfin_merge_private_bfd_data): Likewise.
849         * elf32-cris.c (cris_elf_relocate_section): Likewise.
850         * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
851         * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
852         (i370_elf_relocate_section): Likewise.
853         * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
854         * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
855         * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
856         * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
857         * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
858         * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
859         * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
860         * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
861         (_bfd_mips_elf_merge_private_bfd_data): Likewise.
862         * ieee.c (ieee_write_id, read_id): Likewise.
863         * mach-o.c (bfd_mach_o_write_contents): Likewise.
864         (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
865         (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
866         (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
867         * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
868         * stabs.c (_bfd_link_section_stabs): Likewise.
869
870         * coff-arm.c (coff_arm_relocate_section): Use L modifier in error
871         format.
872         * coff-mcore.c (coff_mcore_relocate_section): Likewise.
873         * coff-ppc.c (coff_ppc_relocate_section): Likewise.
874         * coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
875         * coff-sh.c (sh_relax_section): Likewise.
876         (sh_relax_delete_bytes, sh_swap_insns): Likewise.
877         * coff-tic80.c (coff_tic80_relocate_section): Likewise.
878         * coffcode.h (coff_slurp_reloc_table): Likewise.
879         * coffgen.c (_bfd_coff_get_external_symbols): Likewise.
880         (_bfd_coff_read_string_table): Likewise.
881         * cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
882         * compress.c (bfd_get_full_section_contents): Likewise.
883         * dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
884         * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
885         * elf.c (bfd_elf_string_from_elf_section): Likewise.
886         * elf32-arc.c (arc_special_overflow_checks): Likewise.
887         * elf32-arm.c (elf32_arm_tls_relax): Likewise.
888         (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
889         (elf32_arm_write_section): Likewise.
890         * elf32-bfin.c (bfin_relocate_section): Likewise.
891         (bfinfdpic_relocate_section): Likewise.
892         * elf32-hppa.c (hppa_build_one_stub): Likewise.
893         (final_link_relocate, elf32_hppa_relocate_section): Likewise.
894         * elf32-i386.c (elf_i386_tls_transition): Likewise.
895         (elf_i386_relocate_section): Likewise.
896         * elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
897         * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
898         * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
899         * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
900         * elf32-metag.c (elf_metag_relocate_section): Likewise.
901         * elf32-nds32.c (unrecognized_reloc_msg): Likewise.
902         (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
903         (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
904         (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
905         (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
906         (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
907         (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
908         (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
909         (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
910         * elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
911         * elf32-rx.c (UNSAFE_FOR_PID): Likewise.
912         * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
913         * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
914         * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
915         * elf32-sh.c (sh_elf_relax_section): Likewise.
916         (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
917         (sh_elf_relocate_section): Likewise.
918         * elf32-sh64.c (shmedia_prepare_reloc): Likewise.
919         * elf32-spu.c (spu_elf_relocate_section): Likewise.
920         * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
921         * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
922         * elf32-v850.c (v850_elf_relax_section): Likewise.
923         * elf32-vax.c (elf_vax_check_relocs): Likewise.
924         (elf_vax_relocate_section): Likewise.
925         * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
926         (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
927         (compute_text_actions, compute_ebb_proposed_actions): Likewise.
928         (do_fix_for_relocatable_link): Likewise.
929         * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
930         (elf64_alpha_relax_with_lituse): Likewise.
931         * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
932         (elf_hppa_final_link_relocate): Likewise.
933         * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
934         (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
935         (elf64_vms_link_add_object_symbols): Likewise.
936         * elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
937         (mmix_final_link_relocate): Likewise.
938         * elf64-s390.c (invalid_tls_insn): Likewise.
939         (elf_s390_relocate_section): Likewise.
940         * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
941         * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
942         (elf_x86_64_relocate_section): Likewise.
943         * elfcode.h (elf_slurp_symbol_table): Likewise.
944         * elfcore.h (elf_core_file_p): Likewise.
945         * elflink.c (elf_link_read_relocs_from_section): Likewise.
946         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
947         (elfNN_aarch64_relocate_section): Likewise.
948         * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
949         (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
950         * elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
951         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
952         (_bfd_mips_elf_relocate_section): Likewise.
953         (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
954         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
955         * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
956         * ieee.c (ieee_slurp_external_symbols): Likewise.
957         * ihex.c (ihex_write_object_content): Likewise.
958         * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
959         * merge.c (_bfd_merged_section_offset): Likewise.
960         * mmo.c (mmo_write_loc_chunk): Likewise.
961         (mmo_write_object_contents): Likewise.
962         * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
963         * stabs.c (_bfd_link_section_stabs): Likewise.
964         * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
965
966 2017-07-11  Alan Modra  <amodra@gmail.com>
967
968         * elf32-ppc.c (ppc_elf_relocate_section): Fix typo.
969
970 2017-07-11  Alan Modra  <amodra@gmail.com>
971
972         * elf32-ppc.c (ppc_elf_relocate_section): Emit "unexpected
973         instruction" error using _bfd_error_handler, not einfo.
974
975 2017-07-10  Nick Clifton  <nickc@redhat.com>
976
977         * coffcode.h (coff_slurp_symbol_table): Do not include an entry
978         for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.
979
980 2017-07-07  John Baldwin  <jhb@FreeBSD.org>
981
982         * elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO.
983
984 2017-07-07  Alan Modra  <amodra@gmail.com>
985
986         * coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.
987
988 2017-07-07  Alan Modra  <amodra@gmail.com>
989
990         * bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
991         as long long.  Move code replacing "ll" with "I64", and simplify.
992
993 2017-07-06  H.J. Lu  <hongjiu.lu@intel.com>
994
995         * bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
996         to 1.
997
998 2017-07-05  H.J. Lu  <hongjiu.lu@intel.com>
999
1000         * dwarf2.c (line_info_add_include_dir_stub): Replace time with
1001         xtime.
1002         (line_info_add_file_name): Likewise.
1003         (decode_line_info): Likewise.
1004
1005 2017-07-04  Tristan Gingold  <gingold@adacore.com>
1006
1007         * version.m4: Bump version to 2.29.51
1008         * configure: Regenerate.
1009
1010 2017-07-04  Jiong Wang  <jiong.wang@arm.com>
1011
1012         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
1013         sanity check at the head of this function.
1014
1015 2017-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>
1016
1017         * dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
1018         dwarf_line_str_size.
1019         (struct attr_abbrev): Add field implicit_const.
1020         (dwarf_debug_sections): Add .debug_line_str.
1021         (enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
1022         (dwarf_debug_section_assert): Add static assertion.
1023         (read_indirect_line_string): New.
1024         (read_abbrevs): Support DW_FORM_implicit_const.
1025         (is_str_attr): Support DW_FORM_line_strp.
1026         (read_attribute_value): Support DW_FORM_line_strp and
1027         DW_FORM_implicit_const.
1028         (read_attribute): Support DW_FORM_implicit_const.
1029         (line_info_add_include_dir, line_info_add_include_dir_stub):
1030         (line_info_add_file_name, read_formatted_entries): New.
1031         (decode_line_info, parse_comp_unit): Support DWARF 5.
1032         (_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.
1033
1034 2017-07-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
1035
1036         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
1037         abort statement that was put for symbols that are not dynamic.
1038
1039 2017-07-03  Tristan Gingold  <gingold@adacore.com>
1040
1041         * po/bfd.pot: Regenerate
1042
1043 2017-07-03  Alan Modra  <amodra@gmail.com>
1044
1045         * bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
1046         __MSVCRT__.  Support "L" modifier for bfd_vma.  Formatting.
1047         * elf.c (setup_group): Use "Lx" to print sh_size.
1048         (_bfd_elf_setup_sections): Remove unnecessary cast and print
1049         unknown section type in hex.
1050         (copy_special_section_fields): Style fix.
1051         (bfd_section_from_shdr): Correct format for sh_link.  Use a
1052         common error message for all the variants of unrecognized
1053         section types.
1054         (assign_file_positions_for_load_sections): Use "Lx" for lma
1055         adjust error message.
1056         (assign_file_positions_for_non_load_sections): Formatting.
1057         (rewrite_elf_program_header): Formatting.  Use "Lx" for
1058         bfd_vma values in error messages.
1059         * elfcode.h (elf_slurp_reloc_table_from_section): Cast
1060         ELF_R_SYM value to type expected by format.
1061         * elflink.c (elf_link_read_relocs_from_section): Use "Lx"
1062         in error messages.
1063         (elf_link_add_object_symbols): Use "Lu" for symbol sizes.
1064         (elf_link_input_bfd): Use "Lx" for r_info.
1065         (bfd_elf_gc_record_vtinherit): Use "Lx" for offset.
1066
1067 2017-07-03  Alan Modra  <amodra@gmail.com>
1068
1069         * bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
1070         * coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
1071         Microsoft C library variant of long long format specifier.
1072         (PRINT20): Cast value to bfd_uint64_t not long long.
1073         * coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
1074         * coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
1075         long long.  Don't cast to bfd_vma.
1076         * elf32-score.c (score3_bfd_getl48): Likewise.
1077         * vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.
1078
1079 2017-07-03  Alan Modra  <amodra@gmail.com>
1080
1081         * elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
1082         print d_tag.
1083         (bfd_elf_print_symbol): Don't cast symbol->flags.
1084         (_bfd_elf_symbol_from_bfd_symbol): Likewise.
1085         * elf32-ppc.c (ppc_elf_begin_write_processing): Correct
1086         _bfd_error_handler argument order.
1087         (ppc_elf_merge_private_bfd_data): Don't cast flags.
1088
1089 2017-07-03  Alan Modra  <amodra@gmail.com>
1090
1091         * configure.ac: Invoke AC_CHECK_TYPES for long long.  Invoke
1092         AC_TYPE_LONG_DOUBLE.
1093         * configure: Regenerate.
1094         * config.in: Regenerate.
1095
1096 2017-06-29  Andrew Waterman  <andrew@sifive.com>
1097
1098         * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
1099         relocs.
1100
1101 2017-06-29  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>
1102
1103         * elfxx-sparc.c (allocate_dynrelocs): Don't make a symbol dynamic
1104         unless it is undefined weak.
1105         * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Set the flag
1106         relative_reloc to direct non-dynamic symbols to R_SPARC_RELATIVE
1107         relocation.
1108         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): If symbol
1109         is not dynamic in PIC, abort.
1110
1111 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
1112
1113         PR ld/21402
1114         * elfnn-aarch64.c (elfNN_aarch64_allocate_dynrelocs): Only make
1115         undefined weak symbols into dynamic.
1116         (elfNN_aarch64_final_link_relocate): Generate runtime RELATIVE
1117         relocation for non-dynamic symbols.
1118         (elfNN_aarch64_finish_dynamic_symbol): Add sanity check.
1119
1120 2017-06-29  Jiong Wang  <jiong.wang@arm.com>
1121
1122         * elfnn-aarch64.c (aarch64_relocation_aginst_gp_p): New function.
1123         (elfNN_aarch64_final_link_relocate): Delete duplicated code for
1124         BFD_RELOC_AARCH64_LD64_GOTOFF_LO15, BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC,
1125         BFD_RELOC_AARCH64_MOVW_GOTOFF_G1.
1126         * elfxx-aarch64.c (_bfd_aarch64_elf_resolve_relocation): Optimize the
1127         support for them.
1128
1129 2017-06-29  Andreas Arnez  <arnez@linux.vnet.ibm.com>
1130
1131         * elf-bfd.h (elfcore_write_s390_gs_cb): Add prototype.
1132         (elfcore_write_s390_gs_bc): Likewise.
1133         * elf.c (elfcore_grok_s390_gs_cb): New function.
1134         (elfcore_grok_s390_gs_bc): New function.
1135         (elfcore_grok_note): Call them.
1136         (elfcore_write_s390_gs_cb): New function.
1137         (elfcore_write_s390_gs_bc): New function.
1138         (elfcore_write_register_note): Call them.
1139
1140 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
1141
1142         * libbfd.c (_bfd_generic_get_section_contents): Don't call
1143         bfd_get_file_size.  Check archive element size.
1144         (_bfd_generic_get_section_contents_in_window): Likewise.
1145
1146 2017-06-28  H.J. Lu  <hongjiu.lu@intel.com>
1147
1148         * bfd-in2.h: Regenerated.
1149         * bfdio.c (bfd_get_size): Change return type to ufile_ptr.
1150         (bfd_get_file_size): Likewise.
1151
1152 2017-06-28  Maciej W. Rozycki  <macro@imgtec.com>
1153             Matthew Fortune  <matthew.fortune@imgtec.com>
1154
1155         * archures.c (bfd_mach_mips_interaptiv_mr2): New macro.
1156         * cpu-mips.c (I_interaptiv_mr2): New enum value.
1157         (arch_info_struct): Add "mips:interaptiv-mr2" entry.
1158         * elfxx-mips.c (_bfd_elf_mips_mach) <E_MIPS_MACH_IAMR2>: New
1159         case.
1160         (mips_set_isa_flags) <bfd_mach_mips_interaptiv_mr2>: Likewise.
1161         (bfd_mips_isa_ext) <bfd_mach_mips_interaptiv_mr2>: Likewise.
1162         (print_mips_isa_ext) <AFL_EXT_INTERAPTIV_MR2>: Likewise.
1163         (mips_mach_extensions): Add `bfd_mach_mipsisa32r3' and
1164         `bfd_mach_mips_interaptiv_mr2' entries.
1165         * bfd-in2.h: Regenerate.
1166
1167 2017-06-27  Nick Clifton  <nickc@redhat.com>
1168
1169         * tekhex.c (pass_over): Revert accidental conversion of a local
1170         array to a static array.
1171
1172 2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
1173
1174         PR ld/13402
1175         * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
1176         reloc addend if necessary. Adjust diff only if
1177         shrinked_insn_address < end_address.
1178
1179 2017-06-27  Alan Modra  <amodra@gmail.com>
1180
1181         PR binutils/21665
1182         * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
1183         (_bfd_generic_get_section_contents_in_window): Likewise.
1184
1185 2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>
1186
1187         * elfnn-riscv.c (perform_relocation): Support the new
1188         R_RISCV_32_PCREL relocation.
1189         (riscv_elf_relocate_section): Likewise.
1190         * elfxx-riscv.c (howto_table): Likewise.
1191         (riscv_reloc_map): Likewise.
1192         * bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
1193         * libbfd.h: Regenerate.
1194
1195 2017-06-27  Alan Modra  <amodra@gmail.com>
1196
1197         PR binutils/21665
1198         * libbfd.c (_bfd_generic_get_section_contents): Delete abort.
1199         Use unsigned file pointer type, and remove cast.
1200         * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
1201         Add "count", not "sz".
1202
1203 2017-06-26  Pedro Alves  <palves@redhat.com>
1204
1205         PR binutils/21665
1206         * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
1207         "sz".
1208
1209 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
1210
1211         PR binutils/21665
1212         * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
1213         a missing line.
1214
1215 2017-06-26  Maciej W. Rozycki  <macro@imgtec.com>
1216
1217         * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
1218         * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
1219         E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
1220         (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
1221         `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
1222
1223 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
1224
1225         PR binutils/21665
1226         * compress.c (bfd_get_full_section_contents): Don't check the
1227         file size here.
1228         * libbfd.c (_bfd_generic_get_section_contents): Check for and
1229         reject a section whose size + offset is greater than the size
1230         of the entire file.
1231         (_bfd_generic_get_section_contents_in_window): Likewise.
1232
1233 2017-06-26  Nick Clifton  <nickc@redhat.com>
1234
1235         PR binutils/21670
1236         * tekhex.c (getvalue): Check for the source pointer exceeding the
1237         end pointer before the first byte is read.
1238
1239 2017-06-26  Nick Clifton  <nickc@redhat.com>
1240
1241         PR binutils/21665
1242         * opncls.c (get_build_id): Check that the section is big enough
1243         to contain the whole note.
1244         * compress.c (bfd_get_full_section_contents): Check for and reject
1245         a section whose size is greater than the size of the entire file.
1246         * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
1247         contain a notes section.
1248
1249 2017-06-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1250
1251         * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
1252         pointer checks.
1253         (elf_s390_modify_segment_map): Likewise.
1254         (bfd_elf_s390_set_options): Lisewise.
1255
1256 2017-06-26  Alan Modra  <amodra@gmail.com>
1257
1258         * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
1259         a --just-syms bfd.
1260         (_bfd_elf_size_group_sections): Skip --just-syms bfds.
1261         (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
1262         .preinit_array on --just-syms bfds.
1263         (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
1264         (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
1265         (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
1266
1267 2017-06-25  Sergei Trofimovich  <slyfox@gentoo.org>
1268
1269         * elf.c (find_link): Bounds check "hint".
1270
1271 2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1272
1273         * elf32-arm.c (using_thumb_only): Update list of architectures in
1274         BFD_ASSERT for which the logic is valid.
1275         (using_thumb2_bl): Likewise.
1276         (using_thumb2): Likewise and return true for ARMv8-R.
1277         (arch_has_arm_nop): Likewise.
1278         (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
1279         merging logic.  Update commentis for value 15 of v8m_baseline,
1280         v8m_mainline and v4t_plus_v6_m arrays.  Use v8r array to decide
1281         merging of value 15 of Tag_CPU_arch.
1282
1283 2017-06-23  Jiong Wang  <jiong.wang@arm.com>
1284
1285         * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
1286         BFD_RELOC_AARCH64_ADR_GOT_PAGE
1287         * bfd-in2.h: Regenerate.
1288
1289 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1290
1291         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
1292         the error_alignment label forward.  Properly align program
1293         property note section.
1294
1295 2017-06-22  Eric Christopher  <echristo@gmail.com>
1296
1297         * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
1298         abs to fix a truncation warning.
1299
1300 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1301
1302         * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
1303         local undefined weak symbol to 0.
1304         * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
1305
1306 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1307
1308         * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
1309         is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
1310         (elf_i386_link_setup_gnu_properties): If info->shstk is set,
1311         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
1312         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
1313         info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
1314         (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
1315         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
1316
1317 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
1318
1319         * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
1320         (elf_i386_lazy_ibt_plt_entry): Likewise.
1321         (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
1322         (elf_i386_non_lazy_ibt_plt_entry): Likewise.
1323         (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
1324         (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
1325         (elf_i386_lazy_plt_layout): Likewise.
1326         (elf_i386_non_lazy_plt_layout): Likewise.
1327         (elf_i386_link_hash_entry): Add plt_second.
1328         (elf_i386_link_hash_table): Add plt_second and
1329         plt_second_eh_frame.
1330         (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
1331         (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
1332         the second PLT.  Check the second PLT.
1333         (elf_i386_relocate_section): Use the second PLT to resolve
1334         PLT reference if needed.
1335         (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
1336         needed.
1337         (elf_i386_finish_dynamic_sections): Set sh_entsize on the
1338         second PLT.  Generate unwind info for the second PLT.
1339         (elf_i386_plt_type): Add plt_second.
1340         (elf_i386_get_synthetic_symtab): Support the second PLT.
1341         (elf_i386_parse_gnu_properties): Support
1342         GNU_PROPERTY_X86_FEATURE_1_AND.
1343         (elf_i386_merge_gnu_properties): Support
1344         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
1345         on GNU_PROPERTY_X86_FEATURE_1_IBT
1346         (elf_i386_link_setup_gnu_properties): If info->ibt is set,
1347         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
1348         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
1349         is set on all relocatable inputs.
1350         * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
1351         (elf_x32_lazy_ibt_plt_entry): Likewise.
1352         (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
1353         (elf_x32_non_lazy_ibt_plt_entry): Likewise.
1354         (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
1355         (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
1356         (elf_x86_64_lazy_ibt_plt): Likewise.
1357         (elf_x32_lazy_ibt_plt): Likewise.
1358         (elf_x86_64_non_lazy_ibt_plt): Likewise.
1359         (elf_x32_non_lazy_ibt_plt): Likewise.
1360         (elf_x86_64_get_synthetic_symtab): Support the second PLT.
1361         (elf_x86_64_parse_gnu_properties): Support
1362         GNU_PROPERTY_X86_FEATURE_1_AND.
1363         (elf_x86_64_merge_gnu_properties): Support
1364         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
1365         on GNU_PROPERTY_X86_FEATURE_1_IBT
1366         (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
1367         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
1368         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
1369         is set on all relocatable inputs.
1370
1371 2017-06-22  Nick Clifton  <nickc@redhat.com>
1372
1373         PR binutils/21649
1374         * som.c (setup_sections): NUL terminate the space_strings buffer.
1375         Check that the space.name field does not index beyond the end of
1376         the space_strings buffer.
1377
1378 2017-06-21  Nick Clifton  <nickc@redhat.com>
1379
1380         PR binutils/21646
1381         * coff-sh.c (sh_reloc): Check for an out of range reloc.
1382
1383 2017-06-21  Nick Clifton  <nickc@redhat.com>
1384
1385         PR binutils/21639
1386         * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
1387         type of the size parameter.
1388         (_bfd_vms_save_counted_string): Add second parameter - the maximum
1389         length of the counted string.
1390         * vms.h (_bfd_vms_save_sized_string): Update prototype.
1391         (_bfd_vms_save_counted_string): Likewise.
1392         * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
1393         _bfd_vms_save_counted_string.
1394         (_bfd_vms_slurp_ehdr): Likewise.
1395         (_bfd_vms_slurp_egsd): Likewise.
1396         (Parse_module): Likewise.
1397
1398 2017-06-21  Alan Modra  <amodra@gmail.com>
1399
1400         * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
1401         calls before tocsave calls.
1402         (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
1403         following nop.
1404
1405 2017-06-21  Nick Clifton  <nickc@redhat.com>
1406
1407         PR binutils/21645
1408         * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
1409         bfd_get_full_section_contents returns no contents.
1410
1411 2017-06-21  Nick Clifton  <nickc@redhat.com>
1412
1413         PR binutils/21638
1414         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
1415         record.
1416
1417 2017-06-21  Nick Clifton  <nickc@redhat.com>
1418
1419         PR binutils/21637
1420         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
1421         list.
1422         (image_set_ptr): Likewise.
1423         (alpha_vms_fix_sec_rel): Likewise.
1424         (alpha_vms_slurp_relocs): Likewise.
1425
1426 2017-06-21  Nick Clifton  <nickc@redhat.com>
1427
1428         PR binutils/21633
1429         * ieee.c (ieee_slurp_sections): Check for a NULL return from
1430         read_id.
1431         (ieee_archive_p): Likewise.
1432         (ieee_object_p): Likewise.
1433
1434 2017-06-21  Nick Clifton  <nickc@redhat.com>
1435
1436         PR binutils/21640
1437         * elf.c (setup_group): Zero the group section pointer list after
1438         allocation so that loops can be caught.  Check for NULL pointers
1439         when processing a group list.
1440
1441 2017-06-20  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
1442
1443         * elf-s390.h: New file.
1444         * elf64-s390.c (struct elf_s390_link_hash_table): Add params
1445         field.
1446         (elf_s390_additional_program_headers): New function.
1447         (elf_s390_modify_segment_map): New function.
1448         (bfd_elf_s390_set_options): New function.
1449         (elf_backend_additional_program_headers)
1450         (elf_backend_modify_segment_map): Add macro definitions.
1451
1452 2017-06-19  H.J. Lu  <hongjiu.lu@intel.com>
1453
1454         PR ld/21626
1455         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
1456         the DYNAMIC bit instead of bfd_count_sections.
1457
1458 2017-06-19  Nick Clifton  <nickc@redhat.com>
1459
1460         PR binutils/21618
1461         * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
1462         length.
1463         (evax_bfd_print_eeom): Likewise.
1464         (evax_bfd_print_egsd): Check for an overlarge record length.
1465         (evax_bfd_print_etir): Likewise.
1466
1467 2017-06-19  Nick Clifton  <nickc@redhat.com>
1468
1469         PR binutils/21612
1470         * libieee.h (struct common_header_type): Add end_p field.
1471         * ieee.c (this_byte_and_next): Do not advance input_p beyond
1472         end_p.
1473         (read_id): Check for a length that exceeds the remaining bytes in
1474         the input buffer.
1475         (ieee_seek): Initialise end_p.
1476         (ieee_archive_p): Likewise.
1477         (ieee_object_p): Likewise.
1478
1479 2017-06-19  Nick Clifton  <nickc@redhat.com>
1480
1481         PR binutils/21611
1482         * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
1483         before reading the EIHS structure entries.
1484
1485 2017-06-19  Nick Clifton  <nickc@redhat.com>
1486
1487         PR binutils/21615
1488         * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
1489         gsd_size.  Check that there are enough bytes remaining to read the
1490         type and size of the next egsd.  Check that the size of the egsd
1491         does not exceed the size of the record.
1492
1493 2017-06-19  Alan Modra  <amodra@gmail.com>
1494
1495         * config.bfd: Correct targ_underscore for cris.
1496
1497 2017-06-18  Alan Modra  <amodra@gmail.com>
1498
1499         * config.bfd: Correct targ_underscore for epiphany, ip2k,
1500         m32c, mn10200, pru, rl78, rx, crisv32 and v850.
1501
1502 2017-06-16  Nick Clifton  <nickc@redhat.com>
1503
1504         * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
1505         bucketlist is empty because there are no symbols to add to the
1506         list.
1507
1508 2017-06-16  Alan Modra  <amodra@gmail.com>
1509
1510         PR ld/20022
1511         PR ld/21557
1512         PR ld/21562
1513         PR ld/21571
1514         * targets.c (struct bfd_target): Add _bfd_define_start_stop.
1515         (BFD_JUMP_TABLE_LINK): Likewise.
1516         * elf-bfd.h (bfd_elf_define_start_stop): Declare.
1517         * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
1518         (bfd_elf_define_start_stop): New function.
1519         * linker.c (bfd_generic_define_start_stop): New function.
1520         * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
1521         new field.
1522         * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
1523         * aout-target.h (MY_bfd_define_start_stop): Define.
1524         * aout-tic30.c (MY_bfd_define_start_stop): Define.
1525         * binary.c (binary_bfd_define_start_stop): Define.
1526         * bout.c (b_out_bfd_define_start_stop): Define.
1527         * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
1528         * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
1529         * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
1530         * coffcode.h (coff_bfd_define_start_stop): Define.
1531         * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
1532         * i386msdos.c (msdos_bfd_define_start_stop): Define.
1533         * i386os9k.c (os9k_bfd_define_start_stop): Define.
1534         * ieee.c (ieee_bfd_define_start_stop): Define.
1535         * ihex.c (ihex_bfd_define_start_stop): Define.
1536         * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
1537         * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
1538         * mmo.c (mmo_bfd_define_start_stop): Define.
1539         * nlm-target.h (nlm_bfd_define_start_stop): Define.
1540         * oasys.c (oasys_bfd_define_start_stop): Define.
1541         * pef.c (bfd_pef_bfd_define_start_stop): Define.
1542         * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
1543         * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
1544         * som.c (som_bfd_define_start_stop): Define.
1545         * srec.c (srec_bfd_define_start_stop): Define.
1546         * tekhex.c (tekhex_bfd_define_start_stop): Define.
1547         * versados.c (versados_bfd_define_start_stop): Define.
1548         * vms-alpha.c (vms_bfd_define_start_stop): Define.
1549         (alpha_vms_bfd_define_start_stop): Define.
1550         * xsym.c (bfd_sym_bfd_define_start_stop): Define.
1551         * bfd-in2.h: Regenerate.
1552         * libbfd.h: Regenerate.
1553
1554 2017-06-16  Jiong Wang  <jiong.wang@arm.com>
1555
1556         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
1557         SYMBOL_REFERENCES_LOCAL.
1558
1559 2017-06-15  Jiong Wang  <jiong.wang@arm.com>
1560
1561         PR ld/21532
1562         * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
1563         (elfNN_aarch64_final_link_relocate): Also propagate relocations to
1564         runtime for if there needs copy relocation elimination.
1565         (need_copy_relocation_p): New function.  Return true for symbol with
1566         pc-relative references and if it's against read-only sections.
1567         (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
1568         (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
1569         that are related with accessing external objects.
1570         (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
1571         in elfNN_aarch64_check_relocs.
1572
1573 2017-06-15  Nick Clifton  <nickc@redhat.com>
1574
1575         PR binutils/21582
1576         * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
1577         bugs.
1578         PR binutils/21581
1579         (ieee_archive_p): Likewise.
1580
1581 2017-06-15  Nick Clifton  <nickc@redhat.com>
1582
1583         PR binutils/21579
1584         * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
1585
1586 2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
1587
1588         * elf32-xtensa.c (elf_xtensa_be_plt_entry,
1589         elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
1590         keep both windowed and call0 ABI PLT definitions.
1591         (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
1592         elf_xtensa_*_plt_entry endex.
1593         (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
1594
1595 2017-06-14  Nick Clifton  <nickc@redhat.com>
1596
1597         PR binutils/21578
1598         * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
1599         flag value.
1600
1601 2017-06-14  Nick Clifton  <nickc@redhat.com>
1602
1603         PR binutils/21589
1604         * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
1605         maximum value for the ascic pointer.  Check that name processing
1606         does not read beyond this value.
1607         (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
1608         end of etir record.
1609
1610 2017-06-14  Nick Clifton  <nickc@redhat.com>
1611
1612         PR binutils/21591
1613         * versados.c (versados_mkobject): Zero the allocated tdata structure.
1614         (process_otr): Check for an invalid offset in the otr structure.
1615
1616 2017-06-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
1617
1618         * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
1619
1620 2017-06-13  H.J. Lu  <hongjiu.lu@intel.com>
1621
1622         PR ld/20022
1623         PR ld/21557
1624         PR ld/21562
1625         PR ld/21571
1626         * elf-bfd.h (elf_link_hash_entry): Add start_stop.  Change the
1627         vtable field to a union.
1628         (_bfd_elf_is_start_stop): Removed.
1629         * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
1630         __start_SECNAME and __stop_SECNAME symbols.
1631         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
1632         * elflink.c (_bfd_elf_is_start_stop): Removed.
1633         (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
1634         _bfd_elf_is_start_stop.
1635         (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
1636         __stop_SECNAME symbols.  Updated.
1637         (elf_gc_smash_unused_vtentry_relocs): Likewise.
1638         (bfd_elf_gc_record_vtinherit): Likewise.
1639         (bfd_elf_gc_record_vtentry): Likewise.
1640
1641 2017-06-13  Nick Clifton  <nickc@redhat.com>
1642
1643         PR ld/21524
1644         * elflink.c (elf_link_adjust_relocs): Generate an error when
1645         encountering a reloc against a symbol removed by garbage
1646         collection.
1647
1648 2017-06-12  H.J. Lu  <hongjiu.lu@intel.com>
1649
1650         * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
1651         to merge_gnu_properties.
1652         * elf-properties.c (elf_merge_gnu_properties): Add struct
1653         bfd_link_info * and pass it to merge_gnu_properties.
1654         (elf_merge_gnu_property_list): Add struct bfd_link_info *
1655         and pass it to elf_merge_gnu_properties.
1656         (_bfd_elf_link_setup_gnu_properties): Pass info to
1657         elf_merge_gnu_property_list.
1658         * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
1659         bfd_link_info *.
1660         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
1661
1662 2017-06-11  Joe Zbiciak  <joe.zbiciak@leftturnonly.info>
1663
1664         PR 21564
1665         * binary.c (binary_set_section_contents): Scale lma by octets
1666         per byte to set filepos.
1667
1668 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1669
1670         * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
1671         dynamic sections.
1672
1673 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1674
1675         * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
1676         require TEXTREL.
1677
1678 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1679
1680         * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
1681         patched section contents for TLS IE reloc.
1682         * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
1683
1684 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1685
1686         * elf32-arc.c (elf_arc_relocate_section): Added "call" to
1687         RELOC_FOR_GLOBAL_SYMBOL macro.
1688
1689 2018-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1690
1691         * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
1692         changes.
1693
1694 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1695
1696         * config/tc-arc.c (md_undefined_symbol): Changed.
1697         * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
1698
1699 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1700
1701         * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
1702         symbols.
1703
1704 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1705
1706         * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
1707         warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
1708
1709 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
1710
1711         * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
1712         object is created.
1713
1714 2017-06-08  Richard Earnshaw  <rearnsha@arm.com>
1715
1716         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
1717         that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
1718         is non-zero.  Add clarifying comments.
1719
1720 2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
1721
1722         * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
1723         name.  Use local IFUNC symbol name string to report unsupported
1724         non-PIC call to IFUNC function.
1725         (elf_i386_relocate_section): Dump local IFUNC name with minfo
1726         when generating R_386_IRELATIVE relocation.
1727         (elf_i386_finish_dynamic_symbol): Likewise.
1728         * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
1729         IFUNC symbol name.
1730         (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
1731         when generating R_X86_64_IRELATIVE relocation.
1732         (elf_x86_64_finish_dynamic_symbol): Likewise.
1733
1734 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1735
1736         * elf.c (setup_group): Make sure BFD sections are created for all
1737         group sections in the input file when processing SHF_GROUP
1738         sections.
1739         (bfd_section_from_shdr): Avoid duplicating logic already
1740         implemented in `setup_group'.
1741
1742 2017-06-06  Daniel Bonniot de Ruisselet  <bonniot@gmail.com>
1743
1744         PR binutils/21546
1745         * peXXigen.c (pe_print_idata): Use the address of the first thunk
1746         if the hint address is zero.
1747
1748 2017-06-06  James Clarke  <jrtc27@jrtc27.com>
1749
1750         PR ld/19579
1751         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
1752         ELF_COMMON_DEF_P for common symbols.
1753
1754 2017-06-06  Andrew Burgess  <andrew.burgess@embecosm.com>
1755
1756         * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
1757         SEC_GROUP sections as SEC_EXCLUDE.
1758         (bfd_elf_set_group_contents): Replace use of abort with an assert.
1759         (assign_section_numbers): Use resolve_section_groups flag instead
1760         of relocatable link type.
1761         (_bfd_elf_init_private_section_data): Use resolve_section_groups
1762         flag instead of checking the final_link flag for part of the
1763         checks in here.  Fix white space as a result.
1764         * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
1765         instead of relocatable link type.
1766         (bfd_elf_final_link): Likewise.
1767
1768 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1769
1770         * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
1771         variable `bed'.
1772         * elf32-score.c (score_elf_final_link_relocate): Likewise.
1773         (s3_bfd_score_elf_check_relocs): Likewise.
1774         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
1775         (score_elf_final_link_relocate): Likewise.
1776         (s7_bfd_score_elf_check_relocs): Likewise.
1777
1778 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
1779
1780         * elflink.c (init_reloc_cookie_rels): Remove unused variable
1781         `bed'.
1782
1783 2017-06-06  Maciej W. Rozycki  <macro@imgtec.com>
1784
1785         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
1786         from `reloc_count' rather than decrementing it.
1787         * elf.c (bfd_section_from_shdr): Multiply the adjustment to
1788         `reloc_count' by `int_rels_per_ext_rel'.
1789         * elf32-score.c (score_elf_final_link_relocate): Do not multiply
1790         `reloc_count' by `int_rels_per_ext_rel' for last relocation
1791         entry determination.
1792         (s3_bfd_score_elf_check_relocs): Likewise.
1793         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
1794         (s7_bfd_score_elf_relocate_section): Likewise.
1795         (s7_bfd_score_elf_check_relocs): Likewise.
1796         * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
1797         prototype and function.
1798         (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
1799         (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
1800         triple rather than once the sum of REL and RELA relocation entry
1801         counts.
1802         (bfd_elf64_get_reloc_upper_bound): Remove macro.
1803         * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
1804         `reloc_count' by `int_rels_per_ext_rel' for internal relocation
1805         storage allocation size determination.
1806         (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
1807         size by `int_rels_per_ext_rel'.  Do not multiply `reloc_count'
1808         by `int_rels_per_ext_rel' for last relocation entry
1809         determination.
1810         (bfd_elf_final_link): Do not multiply `reloc_count' by
1811         `int_rels_per_ext_rel' for internal relocation storage
1812         allocation size determination.
1813         (init_reloc_cookie_rels): Do not multiply `reloc_count' by
1814         `int_rels_per_ext_rel' for last relocation entry determination.
1815         (elf_gc_smash_unused_vtentry_relocs): Likewise.
1816         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
1817         (_bfd_mips_elf_relocate_section): Likewise.
1818
1819 2017-06-05  Alan Modra  <amodra@gmail.com>
1820
1821         PR 21529
1822         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
1823
1824 2017-06-01  John Baldwin  <jhb@FreeBSD.org>
1825
1826         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
1827         determine structure sizes.
1828         (elfcore_grok_freebsd_prstatus): Likewise.
1829
1830 2017-06-01  Alan Modra  <amodra@gmail.com>
1831
1832         * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
1833         (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
1834         dynamic objects.
1835         (is_elfv2_localentry0): New function.
1836         (ppc64_elf_tls_setup): Default params->plt_localentry0.
1837         (plt_stub_size): Adjust size for tls_get_addr_opt stub.
1838         (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
1839         (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
1840         optimized localentry:0 stubs.
1841         (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
1842         (ppc64_elf_relocate_section): Leave nop unchanged for optimized
1843         localentry:0 stubs.
1844         (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
1845         DT_PPC64_OPT.
1846         * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
1847
1848 2017-05-30  Casey Smith  <clegg89@gmail.com>
1849
1850         PR ld/21523
1851         * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
1852         value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
1853
1854 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
1855
1856         * cpu-arc.c (arc_compatible): New function.
1857
1858 2017-05-30  Anton Kolesov  <anton.kolesov@synopsys.com>
1859
1860         * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
1861
1862 2017-05-30  H.J. Lu  <hongjiu.lu@intel.com>
1863
1864         PR binutils/21519
1865         * bfdio.c (bfd_get_file_size): New function.
1866         * bfd-in2.h: Regenerated.
1867
1868 2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>
1869
1870         * elf32-arc.c (arc_elf_merge_attributes): Add fall through
1871         comments.
1872
1873 2017-05-22  H.J. Lu  <hongjiu.lu@intel.com>
1874
1875         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
1876         dynobj instead of htab->elf.dynobj.
1877
1878 2017-05-19  Maciej W. Rozycki  <macro@imgtec.com>
1879
1880         * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
1881         and function.
1882         (mips_elf64_canonicalize_dynamic_reloc): Likewise.
1883         (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
1884         actual number of internal relocations retrieved.  Adjust
1885         function description.
1886         (bfd_elf64_canonicalize_reloc): Remove macro.
1887         (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
1888
1889 2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
1890
1891         * archures.c (bfd_mach_sparc_v9m8): Define.
1892         (bfd_mach_sparc_v8plusm8): Likewise.
1893         (bfd_mach_sparc_v9_p): Adjust to M8.
1894         (bfd_mach_sparc_64bit_p): Likewise.
1895         * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
1896         bfd_mach_sparc_v8plusm8.
1897         * bfd-in2.h: Regenerated.
1898         * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
1899         sparc:v8plusm8.
1900         * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
1901         bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
1902         capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
1903         SHA3.
1904         * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
1905         bfd_mach_sparc_v8plusm8.
1906
1907 2017-05-19  Alan Modra  <amodra@gmail.com>
1908
1909         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
1910         debug and special sections when no non-note alloc sections in an
1911         object are kept.
1912
1913 2017-05-18  Alan Modra  <amodra@gmail.com>
1914
1915         * arc-got.h: Don't compare boolean values against TRUE or FALSE.
1916         * elf-m10300.c: Likewise.
1917         * elf.c: Likewise.
1918         * elf32-arc.c: Likewise.
1919         * elf32-bfin.c: Likewise.
1920         * elf32-m68k.c: Likewise.
1921         * elf32-nds32.c: Likewise.
1922         * elf32-tilepro.c: Likewise.
1923         * elflink.c: Likewise.
1924         * elfnn-aarch64.c: Likewise.
1925         * elfnn-riscv.c: Likewise.
1926         * elfxx-tilegx.c: Likewise.
1927         * mach-o.c: Likewise.
1928         * peXXigen.c: Likewise.
1929         * vms-alpha.c: Likewise.
1930         * vms-lib.c: Likewise.
1931
1932 2017-05-17  H.J. Lu  <hongjiu.lu@intel.com>
1933
1934         PR ld/20882
1935         * elflink.c (elf_gc_mark_debug_section): New function.
1936         (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
1937         referenced by kept debug sections.
1938
1939 2017-05-16  Alan Modra  <amodra@gmail.com>
1940
1941         * elf-m10300.c: Rename occurrences of non_ir_ref.
1942         * elf32-arm.c: Likewise.
1943         * elf32-bfin.c: Likewise.
1944         * elf32-cr16.c: Likewise.
1945         * elf32-cris.c: Likewise.
1946         * elf32-d10v.c: Likewise.
1947         * elf32-dlx.c: Likewise.
1948         * elf32-fr30.c: Likewise.
1949         * elf32-frv.c: Likewise.
1950         * elf32-hppa.c: Likewise.
1951         * elf32-i370.c: Likewise.
1952         * elf32-i386.c: Likewise.
1953         * elf32-iq2000.c: Likewise.
1954         * elf32-lm32.c: Likewise.
1955         * elf32-m32c.c: Likewise.
1956         * elf32-m32r.c: Likewise.
1957         * elf32-m68hc1x.c: Likewise.
1958         * elf32-m68k.c: Likewise.
1959         * elf32-mcore.c: Likewise.
1960         * elf32-metag.c: Likewise.
1961         * elf32-microblaze.c: Likewise.
1962         * elf32-moxie.c: Likewise.
1963         * elf32-msp430.c: Likewise.
1964         * elf32-mt.c: Likewise.
1965         * elf32-nios2.c: Likewise.
1966         * elf32-or1k.c: Likewise.
1967         * elf32-ppc.c: Likewise.
1968         * elf32-rl78.c: Likewise.
1969         * elf32-s390.c: Likewise.
1970         * elf32-score.c: Likewise.
1971         * elf32-score7.c: Likewise.
1972         * elf32-sh.c: Likewise.
1973         * elf32-tic6x.c: Likewise.
1974         * elf32-tilepro.c: Likewise.
1975         * elf32-v850.c: Likewise.
1976         * elf32-vax.c: Likewise.
1977         * elf32-xstormy16.c: Likewise.
1978         * elf32-xtensa.c: Likewise.
1979         * elf64-alpha.c: Likewise.
1980         * elf64-hppa.c: Likewise.
1981         * elf64-ia64-vms.c: Likewise.
1982         * elf64-mmix.c: Likewise.
1983         * elf64-ppc.c: Likewise.
1984         * elf64-s390.c: Likewise.
1985         * elf64-sh64.c: Likewise.
1986         * elf64-x86-64.c: Likewise.
1987         * elflink.c: Likewise.
1988         * elfnn-aarch64.c: Likewise.
1989         * elfnn-ia64.c: Likewise.
1990         * elfnn-riscv.c: Likewise.
1991         * elfxx-mips.c: Likewise.
1992         * elfxx-sparc.c: Likewise.
1993         * elfxx-tilegx.c: Likewise.
1994         * linker.c: Likewise.
1995
1996 2017-05-16  Alan Modra  <amodra@gmail.com>
1997
1998         * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
1999         * elflink.c (elf_link_add_object_symbols): Update to use
2000         non_ir_ref_dynamic.
2001         (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
2002         non_ir_ref.
2003         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
2004
2005 2017-05-15  Maciej W. Rozycki  <macro@imgtec.com>
2006
2007         * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
2008
2009 2017-05-12  H.J. Lu  <hongjiu.lu@intel.com>
2010
2011         * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
2012         GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
2013         properties.
2014         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2015
2016 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
2017
2018         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
2019         to plt_second.
2020         (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
2021         to plt_second/plt_second_eh_frame.
2022         (elf_x86_64_link_hash_newfunc): Updated.
2023         (elf_x86_64_allocate_dynrelocs): Likewise.
2024         (elf_x86_64_size_dynamic_sections): Likewise.
2025         (elf_x86_64_relocate_section): Likewise.
2026         (elf_x86_64_finish_dynamic_symbol): Likewise.
2027         (elf_x86_64_finish_dynamic_sections): Likewise.
2028         (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
2029         (elf_x86_64_get_synthetic_symtab): Updated.  Also scan the
2030         .plt.sec section.
2031         (elf_backend_setup_gnu_properties): Updated.  Create the
2032         .plt.sec section instead of the .plt.sec section.
2033
2034 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
2035
2036         * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
2037         commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
2038         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
2039
2040 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
2041
2042         * elf64-sparc.c (elf64_sparc_set_reloc): New function.
2043         (bfd_elf64_set_reloc): Define.
2044         (elf64_sparc_write_relocs): Use `canon_reloc_count'.
2045
2046 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
2047
2048         * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
2049         (struct bfd_target): New field _bfd_set_reloc.
2050         * bfd.c (bfd_set_reloc): Call backend _set_bfd.
2051         * reloc.c (_bfd_generic_set_reloc): New function.
2052         * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
2053         * nlm-target.h (nlm_set_reloc): Likewise.
2054         * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
2055         * aout-tic30.c (MY_set_reloc): Likewise.
2056         * aout-target.h (MY_set_reloc): Likewise.
2057         * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
2058         * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
2059         * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
2060         * vms-alpha.c (alpha_vms_set_reloc): Likewise.
2061         * aout-adobe.c (aout_32_set_reloc): Likewise.
2062         * bout.c (b_out_set_reloc): Likewise.
2063         * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
2064         * i386os9k.c (aout_32_set_reloc): Likewise.
2065         * ieee.c (ieee_set_reloc): Likewise.
2066         * oasys.c (oasys_set_reloc): Likewise.
2067         * som.c (som_set_reloc): Likewise.
2068         * versados.c (versados_set_reloc): Likewise.
2069         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
2070         _bfd_generic_set_reloc.
2071         (rs6000_xcoff64_aix_vec): LIkewise.
2072         * libbfd.c (_bfd_norelocs_set_reloc): New function.
2073         * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
2074         * i386msdos.c (msdos_set_reloc): Define to
2075         _bfd_norelocs_set_reloc.
2076         * elfcode.h (elf_set_reloc): Define.
2077         * bfd-in2.h: Regenerated.
2078
2079 2017-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2080
2081         PR ld/21481
2082         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
2083         for IFUNC function address.
2084
2085 2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>
2086
2087         * elf32-arc.c (FEATURE_LIST_NAME): Define.
2088         (CONFLICT_LIST): Likewise.
2089         (opcode/arc-attrs.h): Include.
2090         (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
2091         (arc_extract_features): New file.
2092         (arc_stralloc): Likewise.
2093         (arc_elf_merge_attributes): Likewise.
2094         (arc_elf_merge_private_bfd_data): Use object attributes.
2095         (bfd_arc_get_mach_from_attributes): New function.
2096         (arc_elf_object_p): Use object attributes.
2097         (arc_elf_final_write_processing): Likewise.
2098         (elf32_arc_obj_attrs_arg_type): New function.
2099         (elf32_arc_obj_attrs_handle_unknown): Likewise.
2100         (elf32_arc_section_from_shdr): Likewise.
2101         (elf_backend_obj_attrs_vendor): Define.
2102         (elf_backend_obj_attrs_section): Likewise.
2103         (elf_backend_obj_attrs_arg_type): Likewise.
2104         (elf_backend_obj_attrs_section_type): Likewise.
2105         (elf_backend_obj_attrs_handle_unknown): Likewise.
2106         (elf_backend_section_from_shdr): Likewise.
2107
2108 2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
2109
2110         PR ld/21458
2111         * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
2112         of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
2113         and the destination is a Thumb symbol.
2114
2115 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
2116
2117         * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
2118         initializer to silence GCC 4.2.
2119         * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
2120
2121 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
2122
2123         * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
2124         (LAZY_PLT_ENTRY_SIZE): This.
2125         (NON_LAZY_PLT_ENTRY_SIZE): New.
2126         (elf_x86_64_plt0_entry): Renamed to ...
2127         (elf_x86_64_lazy_plt0_entry): This.
2128         (elf_x86_64_plt_entry): Renamed to ...
2129         (elf_x86_64_lazy_plt_entry): This.
2130         (elf_x86_64_bnd_plt0_entry): Renamed to ...
2131         (elf_x86_64_lazy_bnd_plt0_entry): This.
2132         (elf_x86_64_legacy_plt_entry): Removed.
2133         (elf_x86_64_bnd_plt_entry): Renamed to ...
2134         (elf_x86_64_lazy_bnd_plt_entry): This.
2135         (elf_x86_64_legacy_plt2_entry): Renamed to ...
2136         (elf_x86_64_non_lazy_plt_entry): This.
2137         (elf_x86_64_bnd_plt2_entry): Renamed to ...
2138         (elf_x86_64_non_lazy_bnd_plt_entry): This.
2139         (elf_x86_64_eh_frame_plt): Renamed to ...
2140         (elf_x86_64_eh_frame_lazy_plt): This.
2141         (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
2142         (elf_x86_64_eh_frame_lazy_bnd_plt): This.
2143         (elf_x86_64_eh_frame_plt_got): Renamed to ...
2144         (elf_x86_64_eh_frame_non_lazy_plt): This.
2145         (elf_x86_64_lazy_plt_layout): New.
2146         (elf_x86_64_non_lazy_plt_layout): Likewise.
2147         (elf_x86_64_plt_layout): Likewise.
2148         (elf_x86_64_backend_data): Remove PLT layout information.  Add
2149         os for target system.
2150         (GET_PLT_ENTRY_SIZE): Removed.
2151         (elf_x86_64_lazy_plt): New.
2152         (elf_x86_64_non_lazy_plt): Likewise.
2153         (elf_x86_64_lazy_bnd_plt): Likewise.
2154         (elf_x86_64_non_lazy_bnd_plt): Likewise.
2155         (elf_x86-64_arch_bed): Updated.
2156         (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
2157         (elf_x86_64_create_dynamic_sections): Removed.
2158         (elf_x86_64_check_relocs): Don't check elf.dynobj.  Don't call
2159         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
2160         (elf_x86-64_adjust_dynamic_symbol): Updated.
2161         (elf_x86_64_allocate_dynrelocs): Updated.  Pass 0 as PLT header
2162         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
2163         size for PLT0 if there is no PLT0.  Get plt_entry_size from
2164         non_lazy_plt for non-lazy PLT entries.
2165         (elf_x86_64_size_dynamic_sections): Updated.  Get plt_entry_size
2166         from non_lazy_plt for non-lazy PLT entries.
2167         (elf_x86-64_relocate_section): Updated.  Properly get PLT index
2168         if there is no PLT0.
2169         (elf_x86_64_finish_dynamic_symbol): Updated.  Fill the first slot
2170         in the PLT entry with generic PLT layout.  Fill the non-lazy PLT
2171         entries with non-lazy PLT layout.  Don't fill the second and third
2172         slots in the PLT entry if there is no PLT0.
2173         (elf_x86_64_finish_dynamic_sections): Updated.  Don't fill PLT0
2174         if there is no PLT0.  Set sh_entsize on the .plt.got section.
2175         (compare_relocs): New.
2176         (elf_x86_64_plt_type): Likewise.
2177         (elf_x86_64_plt): Likewise.
2178         (elf_x86_64_nacl_plt): New. Forward declaration.
2179         (elf_x86_64_get_plt_sym_val): Removed.
2180         (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
2181         against all dynamic relocations.
2182         (elf_x86_64_link_setup_gnu_properties): New function.
2183         (elf_backend_create_dynamic_sections): Updated.
2184         (elf_backend_setup_gnu_properties): New.
2185         (elf_x86_64_nacl_plt): New.
2186         (elf_x86_64_nacl_arch_bed): Updated.
2187
2188 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
2189
2190         * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
2191         (LAZY_PLT_ENTRY_SIZE): This.
2192         (NON_LAZY_PLT_ENTRY_SIZE): New.
2193         (elf_i386_plt0_entry): Renamed to ...
2194         (elf_i386_lazy_plt0_entry): This.
2195         (elf_i386_plt_entry): Renamed to ...
2196         (elf_i386_lazy_plt_entry): This.
2197         (elf_i386_pic_plt0_entry): Renamed to ...
2198         (elf_i386_pic_lazy_plt0_entry): This.
2199         (elf_i386_pic_plt_entry): Renamed to ...
2200         (elf_i386_pic_lazy_plt_entry): This.
2201         (elf_i386_got_plt_entry): Renamed to ...
2202         (elf_i386_non_lazy_plt_entry): This.
2203         (elf_i386_pic_got_plt_entry): Renamed to ...
2204         (elf_i386_pic_non_lazy_plt_entry): This.
2205         (elf_i386_eh_frame_plt): Renamed to ...
2206         (elf_i386_eh_frame_lazy_plt): This.
2207         (elf_i386_eh_frame_plt_got): Renamed to ...
2208         (elf_i386_eh_frame_non_lazy_plt): This.
2209         (elf_i386_plt_layout): Renamed to ...
2210         (elf_i386_lazy_plt_layout): This.  Remove eh_frame_plt_got and
2211         eh_frame_plt_got_size.
2212         (elf_i386_non_lazy_plt_layout): New.
2213         (elf_i386_plt_layout): Likewise.
2214         (elf_i386_non_lazy_plt): Likewise.
2215         (GET_PLT_ENTRY_SIZE): Removed.
2216         (elf_i386_plt): Renamed to ...
2217         (elf_i386_lazy_plt): This.
2218         (elf_i386_backend_data): Remove plt.  Rename is_vxworks to os.
2219         (elf_i386_arch_bed): Updated.
2220         (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
2221         (elf_i386_create_dynamic_sections): Removed.
2222         (elf_i386_check_relocs): Don't check elf.dynobj.  Don't call
2223         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
2224         (elf_i386_adjust_dynamic_symbol): Updated.
2225         (elf_i386_allocate_dynrelocs): Updated.  Pass 0 as PLT header
2226         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
2227         size for PLT0 if there is no PLT0.
2228         (elf_i386_size_dynamic_sections): Updated.  Check whether GOT
2229         output section is discarded only if GOT isn't empty.
2230         (elf_i386_relocate_section): Updated.  Properly get PLT index
2231         if there is no PLT0.
2232         (elf_i386_finish_dynamic_symbol): Updated.  Don't fill the
2233         second and third slots in the PLT entry if there is no PLT0.
2234         (elf_i386_finish_dynamic_sections): Updated.  Don't fill PLT0
2235         if there is no PLT0.  Set sh_entsize on the .plt.got section.
2236         (elf_i386_nacl_plt): Forward declaration.
2237         (elf_i386_get_plt_sym_val): Removed.
2238         (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
2239         against all dynamic relocations.
2240         (elf_i386_link_setup_gnu_properties): New function.
2241         (elf_backend_create_dynamic_sections): Updated.
2242         (elf_backend_setup_gnu_properties): New.
2243         (elf_i386_nacl_plt): Updated.
2244         (elf_i386_nacl_arch_bed): Likewise.
2245         (elf_i386_vxworks_arch_bed): Likewise.
2246
2247 2017-05-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
2248
2249         * elflink.c (elf_output_implib): Remove executable flag from import
2250         library bfd.
2251         * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
2252         library is a relocatable object file.
2253
2254 2017-05-01  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
2255
2256         PR ld/21404
2257         * elf32-avr.c (avr_should_move_sym): New function.
2258         (avr_should_reduce_sym_size): Likewise.
2259         (avr_should_increase_sym_size): Likewise.
2260         (elf32_avr_relax_delete_bytes): Adjust symbol values
2261         and sizes by calling new functions.
2262
2263 2017-05-01  Palmer Dabbelt  <palmer@dabbelt.com>
2264
2265         * config.bfd (riscv32-*): Enable rv64.
2266
2267 2017-05-02  Alan Modra  <amodra@gmail.com>
2268
2269         PR 21384
2270         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
2271         rather than h->root.type == bfd_link_hash_new.
2272         (bfd_elf_record_link_assignment): Similarly, call
2273         bfd_elf_link_mark_dynamic_symbol when h->non_elf.
2274
2275 2017-04-29  Alan Modra  <amodra@gmail.com>
2276
2277         PR 21432
2278         * reloc.c (reloc_offset_in_range): New function.
2279         (bfd_perform_relocation, bfd_install_relocation): Use it.
2280         (_bfd_final_link_relocate): Likewise.
2281
2282 2017-04-28  H.J. Lu  <hongjiu.lu@intel.com>
2283
2284         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
2285         before using .plt.got.
2286         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
2287
2288 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2289
2290         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
2291         instead of "+=" to update 0.
2292
2293 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2294
2295         * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
2296         .plt.got section here.
2297         (elf_i386_check_relocs): Don't create the .plt.got section.
2298         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
2299         the .plt.got and .plt.bnd sections here.
2300         (elf_x86_64_check_relocs): Don't create the .plt.got nor
2301         .plt.bnd sections.
2302
2303 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2304
2305         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
2306         has_bnd_reloc.
2307         (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
2308         (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
2309         (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
2310         (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
2311         has_bnd_reloc.
2312
2313 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2314
2315         * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
2316         to return bfd *.
2317         (_bfd_elf_link_setup_gnu_properties): Return bfd *.
2318         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
2319         the first relocatable ELF input with GNU properties.
2320
2321 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
2322
2323         * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
2324         VxWorks for non-PIC.
2325
2326 2017-04-27  Alan Modra  <amodra@gmail.com>
2327
2328         * elf-bfd.h (struct elf_backend_data): Make asection param of
2329         elf_backend_eh_frame_address_size const.
2330         (_bfd_elf_eh_frame_address_size): Likewise.
2331         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
2332         * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
2333         * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
2334         * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
2335         * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
2336         (next_cie_fde_offset): Constify params.
2337         (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
2338
2339 2017-04-27  Alan Modra  <amodra@gmail.com>
2340
2341         * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
2342         (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
2343         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
2344         aug_data_len.
2345         (offset_adjust): New function.
2346         (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
2347         (adjust_eh_frame_local_symbols): Likewise.
2348         (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
2349         after changing anything.  Return true if anything changed.
2350         * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
2351         _bfd_elf_adjust_eh_frame_global_symbol for globals.
2352
2353 2017-04-27  Alan Modra  <amodra@gmail.com>
2354
2355         * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
2356         when force_local.
2357
2358 2017-04-27  Alan Modra  <amodra@gmail.com>
2359
2360         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
2361         (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
2362         (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
2363         (ppc_elf_relocate_section): Likewise.  Delete silly optimisation
2364         for undef and undefweak dyn_relocs.
2365         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
2366         (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
2367         (allocate_got, allocate_dynrelocs): Likewise.
2368         (ppc64_elf_relocate_section): Likewise.
2369
2370 2017-04-26  H.J. Lu  <hongjiu.lu@intel.com>
2371
2372         * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
2373         DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
2374         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
2375         add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
2376
2377 2017-04-26  Nick Clifton  <nickc@redhat.com>
2378
2379         PR binutils/21434
2380         * reloc.c (bfd_perform_relocation): Check for a negative address
2381         in the reloc.
2382
2383 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
2384
2385         PR ld/21334
2386         * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
2387         member.
2388         * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
2389         (elf_backend_always_renumber_dynsyms): Define.
2390         (elfNN_bed): Initialize `always_renumber_dynsyms' member.
2391         * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
2392         * elflink.c (bfd_elf_size_dynamic_sections): Also call
2393         `_bfd_elf_link_renumber_dynsyms' if the backend has requested
2394         it.
2395         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
2396
2397 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
2398
2399         * elflink.c (bfd_elf_size_dynamic_sections): Only call
2400         `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
2401         sections have been created.
2402
2403 2017-04-26  Nick Clifton  <nickc@redhat.com>
2404
2405         PR binutils/21431
2406         * compress.c (bfd_init_section_compress_status): Check the return
2407         value from bfd_malloc.
2408
2409 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2410
2411         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
2412         no_finish_dynamic_symbol.
2413         (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
2414         0.
2415         (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
2416         weak symbol, don't make it dynamic.
2417         (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
2418         set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
2419         relocation for GOT reference.
2420         (elf_x86_64_finish_dynamic_symbol): Abort if
2421         no_finish_dynamic_symbol isn't 0.
2422
2423 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2424
2425         PR ld/21402
2426         * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
2427         undefined weak symbol, don't make it dynamic.
2428         (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
2429         set no_finish_dynamic_symbol and generate R_386_RELATIVE
2430         relocation for R_386_GOT32.
2431
2432 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
2433
2434         PR ld/21425
2435         * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
2436
2437 2017-04-23  Alan Modra  <amodra@gmail.com>
2438
2439         PR 21414
2440         * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
2441         * elf.c (lcomm_sym): New.
2442         (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
2443         * bfd-in2.h: Regenerate.
2444
2445 2017-04-23  Alan Modra  <amodra@gmail.com>
2446
2447         PR 21412
2448         * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
2449         parameters and comment.
2450         (_bfd_elf_get_reloc_section): Delete.
2451         (_bfd_elf_plt_get_reloc_section): Declare.
2452         * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
2453         New functions.  Don't blindly skip over assumed .rel/.rela prefix.
2454         Extracted from..
2455         (_bfd_elf_get_reloc_section): ..here.  Delete.
2456         (assign_section_numbers): Call elf_get_reloc_section.
2457         * elf64-ppc.c (elf_backend_get_reloc_section): Define.
2458         * elfxx-target.h (elf_backend_get_reloc_section): Update.
2459
2460 2017-04-23  Alan Modra  <amodra@gmail.com>
2461
2462         PR 21409
2463         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
2464         no symbols.
2465
2466 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
2467
2468         PR ld/21402
2469         * elf32-i386.c (elf_i386_link_hash_entry): Add
2470         no_finish_dynamic_symbol.
2471         (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
2472         (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
2473         symbol, don't make it dynamic in PIE.
2474         (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
2475         set no_finish_dynamic_symbol and generate R_386_RELATIVE
2476         relocation for R_386_GOT32
2477         (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
2478         isn't 0.
2479
2480 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
2481
2482         PR ld/19617
2483         PR ld/21086
2484         * elflink.c (elf_link_add_object_symbols): Require
2485         --no-dynamic-linker with -E/--dynamic-list when creating
2486         dynamic sections.
2487
2488 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
2489
2490         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
2491         if forced local.
2492
2493 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
2494
2495         * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
2496         dynamic symbol sorting.
2497
2498 2017-04-20  H.J. Lu  <hongjiu.lu@intel.com>
2499
2500         PR ld/21382
2501         * elflink.c (elf_link_add_object_symbols): Preserve
2502         dynamic_ref_after_ir_def when restoring the symbol table for
2503         unneeded dynamic object.
2504
2505 2017-04-19  H.J. Lu  <hongjiu.lu@intel.com>
2506
2507         PR ld/21401
2508         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
2509         on on undefined IFUNC symbol in the second PLT.
2510
2511 2017-04-19  Wedson Almeida Filho  <wedsonaf@gmail.com>
2512
2513         * peXXigen.c (pe_print_reloc): Correct chunk_end.
2514
2515 2017-04-19  Alan Modra  <amodra@gmail.com>
2516
2517         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
2518         or make dynamic for info->dynamic_undefined_weak 0 and 1.
2519         * elf32-ppc.c:Formatting.
2520         (ensure_undefweak_dynamic): Don't make dynamic when
2521         info->dynamic_undefined_weak is zero.
2522         (allocate_dynrelocs): Discard undefweak dyn_relocs for
2523         info->dynamic_undefined_weak.  Discard undef dyn_relocs when
2524         not default visibility.  Discard undef and undefweak
2525         dyn_relocs earlier.
2526         (ppc_elf_relocate_section): Adjust to suit.
2527         * elf64-ppc.c: Formatting.
2528         (ensure_undefweak_dynamic): Don't make dynamic when
2529         info->dynamic_undefined_weak is zero.
2530         (allocate_dynrelocs): Discard undefweak dyn_relocs for
2531         info->dynamic_undefined_weak.  Discard them earlier.
2532
2533 2017-04-17  H.J. Lu  <hongjiu.lu@intel.com>
2534
2535         PR ld/21389
2536         * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
2537         before generating the version definition section.
2538
2539 2017-04-17  Alan Modra  <amodra@gmail.com>
2540
2541         * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
2542         state when a regular object file defines a symbol with
2543         incompatible type to that defined by an earlier shared lib.
2544
2545 2017-04-13  Alan Modra  <amodra@gmail.com>
2546
2547         * coffcode.h: Wrap some overly long _bfd_error_handler args.
2548         * elf.c: Likewise.
2549         * elf32-arm.c: Likewise.
2550         * elf32-i386.c: Likewise.
2551         * elf32-mep.c: Likewise.
2552         * elf64-ia64-vms.c: Likewise.
2553         * elf64-x86-64.c: Likewise.
2554         * elflink.c: Likewise.
2555         * elfnn-ia64.c: Likewise.
2556         * elfxx-mips.c: Likewise.
2557
2558 2017-04-13  Alan Modra  <amodra@gmail.com>
2559
2560         * aoutx.h: Use %B and %A in error messages throughout file.
2561         * aout-cris.c: Likewise.
2562         * archive.c: Likewise.
2563         * binary.c: Likewise.
2564         * coff-rs6000.c: Likewise.
2565         * coff-tic4x.c: Likewise.
2566         * coffcode.h: Likewise.
2567         * coffgen.c: Likewise.
2568         * cofflink.c: Likewise.
2569         * coffswap.h: Likewise.
2570         * cpu-arm.c: Likewise.
2571         * elf-eh-frame.c: Likewise.
2572         * elf-m10300.c: Likewise.
2573         * elf.c: Likewise.
2574         * elf32-arc.c: Likewise.
2575         * elf32-arm.c: Likewise.
2576         * elf32-bfin.c: Likewise.
2577         * elf32-frv.c: Likewise.
2578         * elf32-iq2000.c: Likewise.
2579         * elf32-m32c.c: Likewise.
2580         * elf32-microblaze.c: Likewise.
2581         * elf32-nds32.c: Likewise.
2582         * elf32-rl78.c: Likewise.
2583         * elf32-rx.c: Likewise.
2584         * elf32-score.c: Likewise.
2585         * elf32-score7.c: Likewise.
2586         * elf32-sh64.c: Likewise.
2587         * elf32-v850.c: Likewise.
2588         * elf32-vax.c: Likewise.
2589         * elf32-visium.c: Likewise.
2590         * elf64-ia64-vms.c: Likewise.
2591         * elf64-mmix.c: Likewise.
2592         * elf64-sh64.c: Likewise.
2593         * elfcode.h: Likewise.
2594         * elfnn-aarch64.c: Likewise.
2595         * elfnn-ia64.c: Likewise.
2596         * elfxx-mips.c: Likewise.
2597         * hpux-core.c: Likewise.
2598         * ieee.c: Likewise.
2599         * ihex.c: Likewise.
2600         * linker.c: Likewise.
2601         * merge.c: Likewise.
2602         * mmo.c: Likewise.
2603         * oasys.c: Likewise.
2604         * pdp11.c: Likewise.
2605         * peXXigen.c: Likewise.
2606         * rs6000-core.c: Likewise.
2607         * vms-alpha.c: Likewise.
2608         * xcofflink.c: Likewise.
2609
2610 2017-04-13  Alan Modra  <amodra@gmail.com>
2611
2612         * bfd.c (PRINT_TYPE): Define.
2613         (_doprnt): New function.
2614         (error_handler_internal): Use _doprnt.
2615         * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
2616         calls in their natural order, throughout file.
2617         * coff-mcore.c: Likewise.
2618         * coff-ppc.c: Likewise.
2619         * coff-tic80.c: Likewise.
2620         * cofflink.c: Likewise.
2621         * elf-s390-common.c: Likewise.
2622         * elf.c: Likewise.
2623         * elf32-arm.c: Likewise.
2624         * elf32-i386.c: Likewise.
2625         * elf32-m32r.c: Likewise.
2626         * elf32-msp430.c: Likewise.
2627         * elf32-spu.c: Likewise.
2628         * elf64-ia64-vms.c: Likewise.
2629         * elf64-sparc.c: Likewise.
2630         * elf64-x86-64.c: Likewise.
2631         * elflink.c: Likewise.
2632         * elfnn-aarch64.c: Likewise.
2633         * elfnn-ia64.c: Likewise.
2634         * elfxx-mips.c: Likewise.
2635
2636 2017-04-13  Alan Modra  <amodra@gmail.com>
2637
2638         * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
2639         branch veneers" error.  Fix double space and format message.
2640         * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
2641         * elf64-ppc.c (tocsave_find): Supply missing %B arg.
2642
2643 2017-04-13  Alan Modra  <amodra@gmail.com>
2644
2645         * bfd-in2.h: Regenerate.
2646
2647 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
2648
2649         * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
2650         extra `\n' in warning/error messages.
2651         * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
2652         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2653
2654 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
2655
2656         * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
2657         processor-specific properties with generic ELF target vector.
2658
2659 2017-04-10  Qing Zhao  <qing.zhao@oracle.com>
2660
2661         * elf32-sparc.c (elf_backend_fixup_symbol): New.
2662         * elf64-sparc.c (elf_backend_fixup_symbol): New.
2663         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
2664         (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
2665         has_non_got_reloc.
2666         (link_hash_newfunc): Initialize has_got_reloc and
2667         has_non_got_reloc.
2668         (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
2669         section.
2670         (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
2671         has_non_got_reloc.
2672         (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
2673         has_non_got_reloc.
2674         (_bfd_sparc_elf_fixup_symbol): New function.
2675         (allocate_dynrelocs): Don't allocate space for dynamic
2676         relocations and discard relocations against resolved undefined
2677         weak symbols in executable.  Don't make resolved undefined weak
2678         symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
2679         relocation against undefined weak symbols in PIE.
2680         (_bfd_sparc_elf_relocate_section): Don't generate dynamic
2681         relocations against resolved undefined weak symbols in PIE
2682         (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
2683         without ynamic PLT/GOT relocations for resolved undefined weak
2684         symbols.
2685         Don't generate dynamic relocation against resolved undefined
2686         weak symbol in executable.
2687         (pie_finish_undefweak_symbol): New function.
2688         (_bfd_sparc_elf_finish_dynamic_sections): Call
2689         pie_finish_undefweak_symbol on all symbols in PIE.
2690         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
2691         (_bfd_sparc_elf_fixup_symbol): New function.
2692
2693 2017-04-10  Nick Clifton  <nickc@redhat.com>
2694
2695         * config.bfd: Remove ns32k from obsolete list.
2696
2697 2017-04-10  Alan Modra  <amodra@gmail.com>
2698
2699         PR 21287
2700         * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
2701         (special_sections_i): Likewise for .init_array.
2702         (special_sections_p): Likewise for .preinit_array.
2703
2704 2017-04-07  H.J. Lu  <hongjiu.lu@intel.com>
2705
2706         PR ld/19579
2707         PR ld/21306
2708         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
2709         ELF_COMMON_DEF_P for common symbols.
2710         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
2711         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
2712         * elflink.c (_bfd_elf_merge_symbol): Revert commits
2713         202ac193bbbecc96a4978d1ac3d17148253f9b01 and
2714         07492f668d2173da7a2bda3707ff0985e0f460b6.
2715
2716 2017-04-07  Pedro Alves  <palves@redhat.com>
2717
2718         * opncls.c (bfd_get_debug_link_info): Rename to...
2719         (bfd_get_debug_link_info_1): ... this.  Change type of second
2720         parameter to void pointer.  Adjust.
2721         (bfd_get_debug_link_info): Reimplement on top of
2722         bfd_get_debug_link_info_1.
2723         (separate_debug_file_exists, separate_alt_debug_file_exists):
2724         Change type of second parameter to void pointer.  Adjust.
2725         (get_func_type, check_func_type): Change type of second parameter
2726         to void pointer.
2727         (find_separate_debug_file): Add 'func_data' parameter.  Pass it to
2728         the callback functions instead of passing the address of a local.
2729         (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
2730         find_separate_debug_file.
2731         (get_alt_debug_link_info_shim): Change type of second parameter to
2732         void pointer.  Adjust.
2733         (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
2734         find_separate_debug_file.
2735         (get_build_id_name, bfd_boolean check_build_id_file): Change type
2736         of second parameter to void pointer.  Adjust.
2737         (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
2738         pointer local to find_separate_debug_file.
2739
2740 2017-04-07  Tristan Gingold  <gingold@gingold-Precision-7510>
2741
2742         * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
2743         external symbols with a definition.
2744         (_bfd_coff_gc_mark_extra_sections): Fix typo.
2745
2746 2017-04-07  Alan Modra  <amodra@gmail.com>
2747
2748         * po/SRC-POTFILES.in: Regenerate.
2749
2750 2017-04-05  Alan Modra  <amodra@gmail.com>
2751
2752         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
2753         reference counting.
2754
2755 2017-04-02  Jon Turney  <jon.turney@dronecode.org.uk>
2756
2757         (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
2758         numbers for DataDirectory entry indicies passed to
2759         add_data_entry().
2760
2761 2017-04-04  H.J. Lu  <hongjiu.lu@intel.com>
2762
2763         * elf.c (get_program_header_size): Add a GNU_MBIND segment for
2764         each GNU_MBIND section and align GNU_MBIND section to page size.
2765         (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
2766         segment for each GNU_MBIND section.
2767         (_bfd_elf_init_private_section_data): Copy sh_info from input
2768         for GNU_MBIND section.
2769
2770 2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
2771
2772         * elfnn-riscv.c (GP_NAME): Delete.
2773         (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
2774         (_bfd_riscv_relax_lui): Likewise.
2775
2776 2017-04-04  Nick Clifton  <nickc@redhat.com>
2777
2778         PR binutils/21342
2779         * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
2780         dereference.
2781         (bfd_elf_final_link): Only initialize the extended symbol index
2782         section if there are extended symbol tables to list.
2783
2784 2017-04-03  H.J. Lu  <hongjiu.lu@intel.com>
2785
2786         * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
2787         (BFD32_BACKENDS_CFILES): Add elf-properties.c.
2788         * configure.ac (elf): Add elf-properties.lo.
2789         * Makefile.in: Regenerated.
2790         * configure: Likewise.
2791         * elf-bfd.h (elf_property_kind): New.
2792         (elf_property): Likewise.
2793         (elf_property_list): Likewise.
2794         (elf_properties): Likewise.
2795         (_bfd_elf_parse_gnu_properties): Likewise.
2796         (_bfd_elf_get_property): Likewise.
2797         (_bfd_elf_link_setup_gnu_properties): Likewise.
2798         (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
2799         and setup_gnu_properties.
2800         (elf_obj_tdata): Add properties.
2801         * elf-properties.c: New file.
2802         * elf32-i386.c (elf_i386_parse_gnu_properties): New.
2803         (elf_i386_merge_gnu_properties): Likewise.
2804         (elf_backend_parse_gnu_properties): Likewise.
2805         (elf_backend_merge_gnu_properties): Likewise.
2806         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
2807         (elf_x86_64_merge_gnu_properties): Likewise.
2808         (elf_backend_parse_gnu_properties): Likewise.
2809         (elf_backend_merge_gnu_properties): Likewise.
2810         * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
2811         (elf_backend_parse_gnu_properties): Likewise.
2812         (elf_backend_setup_gnu_properties): Likewise.
2813         (elfNN_bed): Add elf_backend_parse_gnu_properties,
2814         elf_backend_merge_gnu_properties and
2815         elf_backend_setup_gnu_properties.
2816
2817 2017-03-30  Pip Cet  <pipcet@gmail.com>
2818
2819         * elf32-wasm32.c: Add relocation code, two relocs.
2820         * reloc.c: Add wasm32 relocations.
2821         * libbfd.h: Regenerate.
2822         * bfd-in2.h: Regenerate.
2823         * bfd/po/bfd.pot: Regenerate.
2824
2825 2017-03-29  Nick Clifton  <nickc@redhat.com>
2826
2827         PR binutils/18025
2828         * coff-bfd.h (struct coff_section_data): Add new fields:
2829         saved_bias and bias.
2830         * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
2831         computed for PE binaries.
2832         * dwarf2.c (scan_unit_for_symbols): Only warn once about each
2833         missing abbrev.
2834
2835 2017-03-28  Hans-Peter Nilsson  <hp@axis.com>
2836
2837         PR ld/16044
2838         * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
2839         to handle a local symbol with a hash-symbol-entry; without PLT.
2840         Add BFD_ASSERT for an incidental case with GOT entry present.
2841         (cris_elf_check_relocs): Increment PLT refcount only if the symbol
2842         isn't forced-or-set local.
2843
2844 2017-03-27  Pip Cet  <pipcet@gmail.com>
2845
2846         * wasm-module.c: New file to support WebAssembly modules.
2847         * wasm-module.h: New file to support WebAssembly modules.
2848         * doc/webassembly.texi: Start documenting wasm-module.c.
2849         * config.bfd: Add wasm_vec.
2850         * targets.c: Likewise.
2851         * configure.ac: Likewise.
2852         * Makefile.am: Add entries for wasm-module.c.
2853         * Makefile.in: Regenerate.
2854         * configure: Regenerate.
2855         * po/SRC-POTFILES.in: Regenerate.
2856
2857 2017-03-27  Pip Cet  <pipcet@gmail.com>
2858
2859         * cpu-wasm32.c: New file to support wasm32 architecture.
2860         * elf32-wasm32.c: New file to support wasm32 architecture.
2861         * Makefile.am: Add wasm32 architecture.
2862         * archures.c: Likewise.
2863         * config.bfd: Likewise.
2864         * configure.ac: Likewise.
2865         * targets.c: Likewise.
2866         * Makefile.in: Regenerate.
2867         * bfd-in2.h: Regenerate.
2868         * configure: Regenerate.
2869         * po/SRC-POTFILES.in: Regenerate.
2870
2871 2017-03-20  Alan Modra  <amodra@gmail.com>
2872
2873         PR 21266
2874         * elf64-ppc.c (compare_symbols): Stabilize sort.
2875
2876 2017-03-18  Alan Modra  <amodra@gmail.com>
2877
2878         * elf64-ppc.c (struct ppc_link_hash_table): Add
2879         local_ifunc_resolver and maybe_local_ifunc_resolver.
2880         (ppc_build_one_stub): Set flags on emitting dynamic
2881         relocation to ifunc.
2882         (ppc64_elf_relocate_section): Likewise.
2883         (ppc64_elf_finish_dynamic_symbol): Likewise.
2884         (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
2885         local dynamic relocs to ifuncs.
2886         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
2887         local_ifunc_resolver and maybe_local_ifunc_resolver.
2888         (ppc_elf_relocate_section): Set flag on emitting dynamic
2889         relocation to ifuncs.
2890         (ppc_elf_finish_dynamic_symbol): Likewise.
2891         (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
2892         dynamic relocs to ifuncs.
2893
2894 2017-03-13  Nick Clifton  <nickc@redhat.com>
2895
2896         PR binutils/21202
2897         * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
2898         BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
2899         (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
2900         BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
2901         * bfd-in2.h: Regenerate.
2902         * libbfd.h: Regenerate.
2903         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
2904         names.
2905         (IS_AARCH64_TLSDESC_RELOC): Likewise.
2906         (elfNN_aarch64_howto_table): Likewise.
2907         (aarch64_tls_transition_without_check): Likewise.
2908         (aarch64_reloc_got_type): Likewise.
2909         (elfNN_aarch64_final_link_relocate): Likewise.
2910         (elfNN_aarch64_tls_relax): Likewise.
2911         (elfNN_aarch64_relocate_section): Likewise.
2912         (elfNN_aarch64_gc_sweep_hook): Likewise.
2913         (elfNN_aarch64_check_relocs): Likewise.
2914         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
2915         (_bfd_aarch64_elf_resolve_relocation): Likewise.
2916
2917 2017-03-11  Alan Modra  <amodra@gmail.com>
2918
2919         * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
2920         parameter is in fact used.  Whitespace fixes.
2921         * elf64-ppc.c: Likewise.
2922
2923 2017-03-09  Sam Thursfield  <sam.thursfield@codethink.co.uk>
2924
2925         * rs6000-core.c (CORE_NEW): Simplify macro when
2926         AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
2927
2928 2017-03-07  Alan Modra  <amodra@gmail.com>
2929
2930         PR 21224
2931         PR 20519
2932         * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
2933         dyn_relocs check.
2934
2935 2017-03-05  Alan Modra  <amodra@gmail.com>
2936
2937         * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
2938         * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
2939         (next_cie_fde_offset): New function.
2940         (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
2941         (_bfd_elf_discard_section_eh_frame): Align zero terminator to
2942         four bytes.  Align CIEs to four or eight bytes depending on
2943         per_encoding_aligned8.  Align FDEs according to their encoding.
2944         Pad last FDE to output section alignment.
2945         (_bfd_elf_write_section_eh_frame): Adjust to suit.  Remove
2946         assertion.
2947         * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
2948         (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
2949         (ppc64_elf_finish_dynamic_sections): Adjust to suit.
2950
2951 2017-03-02  Martin Bickel  <binutils@ineranves.de>
2952
2953         PR ld/21212
2954         * elf.c (rewrite_elf_program_header): Do not issue a warning for
2955         empty segments which have a zero filesz, but a non-zero memsz.
2956
2957 2017-03-02  Alan Modra  <amodra@gmail.com>
2958
2959         * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
2960
2961 2017-02-28  Alan Modra  <amodra@gmail.com>
2962
2963         * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
2964         (ppc64_elf_relocate_section): Likewise.
2965
2966 2017-02-28  Alan Modra  <amodra@gmail.com>
2967
2968         PR 20995
2969         * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
2970         rather than elf32_nios2_hash_table or elf_hash_table.
2971         (create_got_section): Likewise.
2972         (nios2_elf32_finish_dynamic_symbol): Likewise.
2973         (nios2_elf32_adjust_dynamic_symbol): Likewise.
2974         (nios2_elf32_size_dynamic_sections): Likewise.
2975         (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
2976         vars.  Use htab equivalents directly instead.  Don't create
2977         all dynamic sections on needing just the GOT.  Use a goto
2978         rather than a fall-through with reloc test.  Ensure
2979         htab->dynobj is set when making dynamic sreloc section.
2980         (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
2981         equivalent directly instead.  Don't segfault on looking for
2982         .dynamic when dynamic sections have not been created.  Don't
2983         segfault on .got.plt being discarded.
2984         (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
2985         Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
2986         fixme and another not so relevant comment.
2987         (nios2_elf_add_symbol_hook): Delete dynobj var.  If not
2988         already set, set hash table dynobj on creating .sbss.
2989
2990 2017-02-28  Alan Modra  <amodra@gmail.com>
2991
2992         * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
2993         * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
2994         (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
2995         (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
2996         (ppc64_elf_relocate_section): Likewise.
2997         * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
2998         (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
2999         (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
3000         * libbfd.h: Regenerate.
3001         * bfd-in2.h: Regenerate.
3002
3003 2017-02-28  Alan Modra  <amodra@gmail.com>
3004
3005         * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
3006         dynamic .data.rel.ro read-only.
3007         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
3008         rather than section flags when deciding where copy reloc goes.
3009         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
3010         * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
3011         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
3012         * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
3013         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
3014         * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
3015         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
3016         * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
3017         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
3018         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
3019         * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
3020         * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
3021         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
3022         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
3023         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
3024         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
3025         * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
3026         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
3027         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
3028
3029 2017-02-28  Maciej W. Rozycki  <macro@imgtec.com>
3030
3031         * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
3032         `jalr $0, $25' instruction encoding.
3033
3034 2017-02-27  Nick Clifton  <nickc@redhat.com>
3035
3036         PR ld/21180
3037         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
3038         generating a seg-fault when encountering a symbol that has been
3039         deleted by garbage collection.
3040
3041 2017-02-25  Alan Modra  <amodra@gmail.com>
3042
3043         * elf32-arc.c (struct dynamic_sections): Delete.
3044         (enum dyn_section_types): Delete.
3045         (dyn_section_names): Delete.
3046         (arc_create_dynamic_sections): Delete.
3047         (elf_arc_finish_dynamic_sections): Don't call the above.  Don't
3048         segfault on discarded .rela.plt section.
3049         (elf_arc_size_dynamic_sections): Formatting.  Don't call
3050         arc_create_dynamic_sections.  Don't allocate memory for sections
3051         handled by the generic linker.  Correct code finding relocs in
3052         read-only sections.  Set SEC_EXCLUDE on zero size .got,
3053         .got.plt, and .dynbss sections.  Do set .interp for pies.
3054
3055 2017-02-24  Andrew Waterman  <andrew@sifive.com>
3056
3057         * elfnn-riscv.c (GP_NAME): New macro.
3058         (riscv_global_pointer_value): Use it.
3059         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
3060         output section, consider only that section's alignment.
3061
3062 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
3063
3064         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
3065         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
3066         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
3067         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
3068
3069 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
3070
3071         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
3072         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
3073         or misaligned.
3074
3075 2017-02-23  Alan Modra  <amodra@gmail.com>
3076
3077         PR 20744
3078         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
3079         16D relocations.
3080         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
3081         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
3082         relocs.
3083
3084 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
3085
3086         PR ld/20828
3087         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
3088         processing ahead of the call to `elf_gc_sweep_symbol'.
3089
3090 2017-02-22  Nick Clifton  <nickc@redhat.com>
3091
3092         PR binutils/21193
3093         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
3094         created section 4-byte alignment.
3095
3096 2017-02-22  Alan Modra  <amodra@gmail.com>
3097
3098         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
3099         on .got or .plt output section being discarded by script.
3100         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
3101         vxworks splt temp.
3102
3103 2017-02-21  Alan Modra  <amodra@gmail.com>
3104
3105         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
3106         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
3107
3108 2017-02-20  Alan Modra  <amodra@gmail.com>
3109
3110         PR 21181
3111         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
3112         if DT_RELSZ/DT_RELASZ is zero.
3113
3114 2017-02-17  Nick Clifton  <nickc@redhat.com>
3115
3116         * compress.c (bfd_get_full_section_contents): Remember to reduce
3117         compressed size by the sizeof the compression header when
3118         decompressing the contents.
3119
3120 2017-02-17  Pedro Alves  <palves@redhat.com>
3121
3122         * srec.c (Chunk): Rename to ...
3123         (_bfd_srec_len): ... this.
3124         (S3Forced): Rename to ...
3125         (_bfd_srec_forceS3): ... this.
3126         * objcopy.c: Adjust all references.
3127
3128 2017-02-17  Pedro Alves  <palves@redhat.com>
3129
3130         * archive.c (bsd_write_armap): Rename to ...
3131         (_bfd_bsd_write_armap): ... this.
3132         (coff_write_armap): Rename to ...
3133         (_bfd_coff_write_armap): ... this.
3134         * libbfd-in.h (bsd_write_armap): Rename to ...
3135         (_bfd_bsd_write_armap): ... this.
3136         (coff_write_armap): Rename to ...
3137         (_bfd_coff_write_armap): ... this.
3138         * aout-target.h, aout-tic30.c: Adjust all users.
3139         * libbfd.h: Regenerate.
3140
3141 2017-02-17  Pedro Alves  <palves@redhat.com>
3142
3143         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
3144         (warn_deprecated): Rename to ...
3145         (_bfd_warn_deprecated): ... this.
3146         * libbfd.c (warn_deprecated): Rename to ...
3147         (_bfd_warn_deprecated): ... this.
3148         * bfd-in2.h: Regenerate.
3149
3150 2017-02-17  Pedro Alves  <palves@redhat.com>
3151
3152         * bfdio.c (real_ftell): Rename to ...
3153         (_bfd_real_ftell): ... this.
3154         (real_fseek): Rename to ...
3155         (_bfd_real_fseek): ... this.
3156         (real_fopen): Rename to ...
3157         (_bfd_real_fopen): ... this.
3158         * libbfd-in.h (real_ftell): Rename to ...
3159         (_bfd_real_ftell): ... this.
3160         (real_fseek): Rename to ...
3161         (_bfd_real_fseek): ... this.
3162         (real_fopen): Rename to ...
3163         (_bfd_real_fopen): ... this.
3164         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
3165         * libbfd.h: Regenerate.
3166
3167 2017-02-17  Pedro Alves  <palves@redhat.com>
3168
3169         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
3170         * libbfd.c (read_unsigned_leb128): Rename to ...
3171         (_bfd_read_unsigned_leb128): ... this.
3172         (read_signed_leb128): Rename to ...
3173         (_bfd_read_signed_leb128): ... this.
3174         (safe_read_leb128): Rename to ...
3175         (_bfd_safe_read_leb128): ... this.
3176         * libbfd-in.h (read_unsigned_leb128): Rename to ...
3177         (_bfd_read_unsigned_leb128): ... this.
3178         (read_signed_leb128): Rename to ...
3179         (_bfd_read_signed_leb128): ... this.
3180         (safe_read_leb128): Rename to ...
3181         (_bfd_safe_read_leb128): ... this.
3182         * libbfd.h: Renegerate.
3183
3184 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
3185
3186         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
3187         before trying to fine matching file and line information.
3188
3189 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
3190
3191         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
3192         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
3193         not match current bfd, then reload debug information.  Record bfd
3194         we're loading debug info for in the stash.  If we have debug
3195         informatin in the cache then perform section placement before
3196         returning.
3197
3198 2017-02-16  Alan Modra  <amodra@gmail.com>
3199
3200         PR 21000
3201         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
3202         * elfxx-target.h (elf_backend_no_page_alias): Define.
3203         (elfNN_bed): Init new field.
3204         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
3205         ensure PT_LOAD segment starts on a new page.
3206         * elf32-hppa.c (elf_backend_no_page_alias): Define.
3207
3208 2017-02-16  Alan Modra  <amodra@gmail.com>
3209
3210         PR 21132
3211         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
3212         if pic.
3213
3214 2017-02-16  Jiong Wang <jiong.wang@arm.com>
3215
3216         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
3217         * bfd-in2.h: Regenerated.
3218
3219 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
3220
3221         PR ld/21168
3222         * elf32-i386.c (elf_i386_relocate_section): Allow
3223         "lea foo@GOT, %reg" in PIC.
3224
3225 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
3226
3227         PR ld/20244
3228         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
3229         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
3230         error against local IFUNC symbol without a base register for
3231         PIC.
3232
3233 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
3234
3235         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
3236         `%P: %H:' with `info->callbacks->einfo'.
3237         (ppc_elf_relocate_section): Likewise.
3238         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
3239         (ppc64_elf_edit_toc): Likewise.
3240         (ppc64_elf_relocate_section): Likewise.
3241
3242 2017-02-14  Alan Modra  <amodra@gmail.com>
3243
3244         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
3245         --gc-keep-exported, and test versioned field of sym rather than
3246         looking for @ in name.
3247
3248 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
3249
3250         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
3251         __global_pointer$.
3252
3253 2017-02-13  Nick Clifton  <nickc@redhat.com>
3254
3255         PR binutils/21151
3256         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
3257         unit length field.
3258
3259 2017-02-07  Andrew Waterman  <andrew@sifive.com>
3260
3261         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
3262         entry size if PLT header is written.
3263
3264 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
3265
3266         Fix sparc64 dynamic relocation processing to use the dynamic
3267         symbol count.
3268         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
3269         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
3270         should be used.
3271
3272 2017-02-03  Nick Clifton  <nickc@redhat.com>
3273
3274         PR 21096
3275         * coffcode.h (coff_write_object_contents): Enlarge size of
3276         s_name_buf in order to avoid compile time warning about possible
3277         integer truncation.
3278         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
3279         32-bits of insn value before printing into buffer.
3280
3281 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3282
3283         * elfxx-mips.c (mips_elf_hash_sort_data): Add
3284         `max_local_dynindx'.
3285         (mips_elf_sort_hash_table): Handle it.
3286         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
3287         symbols bump up `max_local_dynindx' rather than
3288         `max_non_got_dynindx'.
3289
3290 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3291
3292         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
3293         `min_got_dynindx', `max_unref_got_dynindx' and
3294         `max_non_got_dynindx' members to the `bfd_size_type' data type.
3295         (mips_elf_sort_hash_table): Adjust accordingly.
3296
3297 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3298
3299         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
3300         to access the hash table.
3301
3302 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3303
3304         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
3305         non-NULL `htab' to the beginning.
3306
3307 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
3308
3309         * elflink.c (elf_gc_sweep): Wrap overlong line.
3310
3311 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
3312
3313         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
3314         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
3315         * elfxx-mips.c (mips_elf_link_hash_table): Add
3316         `ignore_branch_isa' member.
3317         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
3318         in branch relocation calculation as an error if
3319         `ignore_branch_isa' has been set.
3320         (_bfd_mips_elf_insn32): Rename to...
3321         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
3322         parameter to `insn32' and add an `ignore_branch_isa' parameter.
3323         Handle the new parameter.
3324
3325 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
3326
3327         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
3328         local variable dynobj.
3329
3330         PR ld/20995
3331         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
3332         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
3333         executable from read-only sections into sdynrelro.
3334         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
3335         dynamic relocs in sdynrelro.
3336         (elf_backend_want_dynrelro): Define.
3337
3338 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3339
3340         * config.bfd (*-*-rtemsaout*): Mark as removed.
3341
3342 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3343
3344         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
3345         (arm-*-rtems*): Move to (arm*-*-eabi*).
3346         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
3347         (m68-*-rtems*): Move to (m68*-*-elf*).
3348
3349 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
3350
3351         * config.bfd (*-*-rtemscoff*): Mark as removed.
3352
3353 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
3354
3355         PR ld/20828
3356         * elflink.c (bfd_elf_record_link_assignment): Revert last
3357         change and don't ever clear `forced_local'.  Set `mark'
3358         unconditionally.
3359         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
3360         file.
3361         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
3362         (bfd_elf_size_dynamic_sections): ... here.
3363         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
3364         and set `mark' instead in `__tls_get_addr_opt' processing.
3365         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
3366
3367 2017-01-24  Alan Modra  <amodra@gmail.com>
3368
3369         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
3370         where dynamic relocs are preferable.  Allow ifunc too.
3371         (ensure_undefweak_dynamic): New function.
3372         (allocate_dynrelocs): Use it here.  Move plt handling last and
3373         don't make symbols dynamic, simplifying loop.  Only make undef
3374         weak symbols with GOT entries dynamic.  Correct condition
3375         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
3376         comments.  Remove goto.
3377         (ppc_elf_relocate_section): Correct test for using dynamic
3378         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
3379         to suit.  Set up explicit tls_index entries and implicit GOT
3380         tls_index entries resolvable at link time for
3381         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
3382         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
3383         (ensure_undefweak_dynamic): New function.
3384         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
3385         with GOT entries dynamic.  Remove unnecessary test of
3386         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
3387         (ppc64_elf_relocate_section): Correct test for using dynamic
3388         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
3389         to suit.  Set up explicit tls_index entries and implicit GOT
3390         tls_index entries resolvable at link time for __tls_get_addr_opt.
3391         Simplify expression to clear mem for prelink.
3392
3393 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
3394
3395         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
3396
3397 2017-01-20  Jiong Wang <jiong.wang@arm.com>
3398
3399         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
3400         (elf_backend_hash_symbol): Define.
3401
3402 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
3403
3404         PR ld/20828
3405         * elflink.c (bfd_elf_record_link_assignment): Clear any
3406         `forced_local' marking for DSO symbols that are not being
3407         provided.
3408
3409 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
3410
3411         * elfnn-riscv.c (riscv_elf_object_p): New function.
3412
3413 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
3414
3415         PR ld/21038
3416         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
3417         plt_bnd_eh_frame.
3418         (elf_x86_64_check_relocs): Create .eh_frame section for the
3419         .plt.bnd section.
3420         (elf_x86_64_size_dynamic_sections): Allocate and initialize
3421         .eh_frame section for the .plt.bnd section.
3422         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
3423         for the .plt.bnd section.
3424
3425 2017-01-12  Nick Clifton  <nickc@redhat.com>
3426
3427         PR binutils/20876
3428         * opncls.c (find_separate_debug_file): Add include_dirs
3429         parameter.  Only include the directory part of the bfd's filename
3430         in search paths if include_dirs is true.  Add a couple of extra
3431         locations for looking for debug files.
3432         ( bfd_follow_gnu_debuglink): Update invocation of
3433         find_separate_debug_file.
3434         (bfd_follow_gnu_debugaltlink): Likewise.
3435         (get_build_id): New function: Finds the build-id of the given bfd.
3436         (get_build_id_name): New function: Computes the name of the
3437         separate debug info file for a bfd, based upon its build-id.
3438         (check_build_id_file): New function: Checks to see if a separate
3439         debug info file exists at the given location, and that its
3440         build-id matches that of the original bfd.
3441         (bfd_follow_build_id_debuglink): New function: Finds a separate
3442         debug info file for a given bfd by using the build-id method.
3443         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
3444         method of locating a separate debug info file before using the
3445         debuglink method.
3446         * bfd-in2.h: Regenerate.
3447
3448 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
3449
3450         PR ld/21038
3451         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
3452         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
3453         elf_x86_64_eh_frame_plt_got.
3454         (elf_x86_64_size_dynamic_sections): Get unwind info from
3455         elf_x86_64_bnd_arch_bed for the BND PLT.
3456
3457 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
3458
3459         * config.bfd: Add entries for i686-redox and x86_64-redox.
3460
3461 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3462
3463         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
3464         to 4 bytes.
3465         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
3466         .eh_frame section to 4 bytes for x32.
3467         (elf_x86_64_check_relocs): Likewise.
3468
3469 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3470
3471         PR ld/20830
3472         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
3473         (PLT_GOT_FDE_LENGTH): Likewise.
3474         (elf_i386_plt_layout): Add eh_frame_plt_got and
3475         eh_frame_plt_got_size.
3476         (elf_i386_plt): Updated.
3477         (elf_i386_link_hash_table): Add plt_got_eh_frame.
3478         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
3479         (elf_i386_size_dynamic_sections): Allocate and initialize
3480         .eh_frame section for .plt.got.
3481         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
3482         .plt.got.
3483         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
3484         eh_frame_plt_got_size.
3485         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
3486         (PLT_GOT_FDE_LENGTH): Likewise.
3487         (elf_x86_64_backend_data): Add eh_frame_plt_got and
3488         eh_frame_plt_got_size.
3489         (elf_x86_64_arch_bed): Updated.
3490         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
3491         eh_frame_plt_got_size.
3492         (elf_x86_64_nacl_arch_bed): Likewise.
3493         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
3494         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
3495         (elf_x86_64_size_dynamic_sections): Allocate and initialize
3496         .eh_frame section for .plt.got.
3497         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
3498         for .plt.got.
3499
3500 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3501
3502         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
3503         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
3504
3505 2017-01-09  Nick Clifton  <nickc@redhat.com>
3506
3507         * dwarf2.c (lookup_address_in_function_table): Return early if
3508         there are no functions in the given comp unit, or if the high
3509         address of the last function in the comp unit is less than the
3510         desired address.
3511
3512 2017-01-09  Nick Clifton  <nickc@redhat.com>
3513
3514         PR binutils/21013
3515         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
3516         message if there are too many symbols to load.
3517
3518 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
3519
3520         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
3521         if relocs are cached.
3522
3523 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
3524
3525         PR ld/21017
3526         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
3527         for R_MICROBLAZE_GOTOFF_64.
3528
3529 2017-01-03  Nick Clifton  <nickc@redhat.com>
3530
3531         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
3532         warning about using a possibly uninitialised variable.
3533
3534 2017-01-02  Alan Modra  <amodra@gmail.com>
3535
3536         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
3537         (allocate_plt_static, allocate_dynrelocs): Use it.
3538
3539 2017-01-02  Alan Modra  <amodra@gmail.com>
3540
3541         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
3542         .PARISC.unwind section.
3543
3544 2017-01-02  Alan Modra  <amodra@gmail.com>
3545
3546         PR ld/20989
3547         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
3548         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
3549         indirect to GOT pointer relative code edit.
3550
3551 2017-01-02  Alan Modra  <amodra@gmail.com>
3552
3553         Update year range in copyright notice of all files.
3554
3555 For older changes see ChangeLog-2016
3556 \f
3557 Copyright (C) 2017 Free Software Foundation, Inc.
3558
3559 Copying and distribution of this file, with or without modification,
3560 are permitted in any medium without royalty provided the copyright
3561 notice and this notice are preserved.
3562
3563 Local Variables:
3564 mode: change-log
3565 left-margin: 8
3566 fill-column: 74
3567 version-control: never
3568 End: