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