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