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