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