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