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