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