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