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