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