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