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