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