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