31fd5428663231e944a3f92ad77ccc1ec081c4cb
[external/binutils.git] / bfd / ChangeLog
1 2017-06-27  Nick Clifton  <nickc@redhat.com>
2
3         * tekhex.c (pass_over): Revert accidental conversion of a local
4         array to a static array.
5
6 2017-06-27  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
7
8         PR ld/13402
9         * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust
10         reloc addend if necessary. Adjust diff only if
11         shrinked_insn_address < end_address.
12
13 2017-06-27  Alan Modra  <amodra@gmail.com>
14
15         PR binutils/21665
16         * libbfd.c (_bfd_generic_get_section_contents): Warning fix.
17         (_bfd_generic_get_section_contents_in_window): Likewise.
18
19 2017-06-26  Kuan-Lin Chen  <rufus@andestech.com>
20
21         * elfnn-riscv.c (perform_relocation): Support the new
22         R_RISCV_32_PCREL relocation.
23         (riscv_elf_relocate_section): Likewise.
24         * elfxx-riscv.c (howto_table): Likewise.
25         (riscv_reloc_map): Likewise.
26         * bfd-in2.h (BFD_RELOC_RISCV_32_PCREL): New relocation.
27         * libbfd.h: Regenerate.
28
29 2017-06-27  Alan Modra  <amodra@gmail.com>
30
31         PR binutils/21665
32         * libbfd.c (_bfd_generic_get_section_contents): Delete abort.
33         Use unsigned file pointer type, and remove cast.
34         * libbfd.c (_bfd_generic_get_section_contents_in_window): Likewise.
35         Add "count", not "sz".
36
37 2017-06-26  Pedro Alves  <palves@redhat.com>
38
39         PR binutils/21665
40         * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
41         "sz".
42
43 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
44
45         PR binutils/21665
46         * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
47         a missing line.
48
49 2017-06-26  Maciej W. Rozycki  <macro@imgtec.com>
50
51         * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
52         * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
53         E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
54         (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
55         `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
56
57 2017-06-26  H.J. Lu  <hongjiu.lu@intel.com>
58
59         PR binutils/21665
60         * compress.c (bfd_get_full_section_contents): Don't check the
61         file size here.
62         * libbfd.c (_bfd_generic_get_section_contents): Check for and
63         reject a section whose size + offset is greater than the size
64         of the entire file.
65         (_bfd_generic_get_section_contents_in_window): Likewise.
66
67 2017-06-26  Nick Clifton  <nickc@redhat.com>
68
69         PR binutils/21670
70         * tekhex.c (getvalue): Check for the source pointer exceeding the
71         end pointer before the first byte is read.
72
73 2017-06-26  Nick Clifton  <nickc@redhat.com>
74
75         PR binutils/21665
76         * opncls.c (get_build_id): Check that the section is big enough
77         to contain the whole note.
78         * compress.c (bfd_get_full_section_contents): Check for and reject
79         a section whose size is greater than the size of the entire file.
80         * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
81         contain a notes section.
82
83 2017-06-26  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
84
85         * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
86         pointer checks.
87         (elf_s390_modify_segment_map): Likewise.
88         (bfd_elf_s390_set_options): Lisewise.
89
90 2017-06-26  Alan Modra  <amodra@gmail.com>
91
92         * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
93         a --just-syms bfd.
94         (_bfd_elf_size_group_sections): Skip --just-syms bfds.
95         (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
96         .preinit_array on --just-syms bfds.
97         (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
98         (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
99         (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
100
101 2017-06-25  Sergei Trofimovich  <slyfox@gentoo.org>
102
103         * elf.c (find_link): Bounds check "hint".
104
105 2017-06-24  Thomas Preud'homme  <thomas.preudhomme@arm.com>
106
107         * elf32-arm.c (using_thumb_only): Update list of architectures in
108         BFD_ASSERT for which the logic is valid.
109         (using_thumb2_bl): Likewise.
110         (using_thumb2): Likewise and return true for ARMv8-R.
111         (arch_has_arm_nop): Likewise.
112         (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
113         merging logic.  Update commentis for value 15 of v8m_baseline,
114         v8m_mainline and v4t_plus_v6_m arrays.  Use v8r array to decide
115         merging of value 15 of Tag_CPU_arch.
116
117 2017-06-23  Jiong Wang  <jiong.wang@arm.com>
118
119         * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
120         BFD_RELOC_AARCH64_ADR_GOT_PAGE
121         * bfd-in2.h: Regenerate.
122
123 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
124
125         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
126         the error_alignment label forward.  Properly align program
127         property note section.
128
129 2017-06-22  Eric Christopher  <echristo@gmail.com>
130
131         * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
132         abs to fix a truncation warning.
133
134 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
135
136         * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
137         local undefined weak symbol to 0.
138         * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
139
140 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
141
142         * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
143         is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
144         (elf_i386_link_setup_gnu_properties): If info->shstk is set,
145         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
146         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
147         info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
148         (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
149         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
150
151 2017-06-22  H.J. Lu  <hongjiu.lu@intel.com>
152
153         * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
154         (elf_i386_lazy_ibt_plt_entry): Likewise.
155         (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
156         (elf_i386_non_lazy_ibt_plt_entry): Likewise.
157         (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
158         (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
159         (elf_i386_lazy_plt_layout): Likewise.
160         (elf_i386_non_lazy_plt_layout): Likewise.
161         (elf_i386_link_hash_entry): Add plt_second.
162         (elf_i386_link_hash_table): Add plt_second and
163         plt_second_eh_frame.
164         (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
165         (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
166         the second PLT.  Check the second PLT.
167         (elf_i386_relocate_section): Use the second PLT to resolve
168         PLT reference if needed.
169         (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
170         needed.
171         (elf_i386_finish_dynamic_sections): Set sh_entsize on the
172         second PLT.  Generate unwind info for the second PLT.
173         (elf_i386_plt_type): Add plt_second.
174         (elf_i386_get_synthetic_symtab): Support the second PLT.
175         (elf_i386_parse_gnu_properties): Support
176         GNU_PROPERTY_X86_FEATURE_1_AND.
177         (elf_i386_merge_gnu_properties): Support
178         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
179         on GNU_PROPERTY_X86_FEATURE_1_IBT
180         (elf_i386_link_setup_gnu_properties): If info->ibt is set,
181         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
182         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
183         is set on all relocatable inputs.
184         * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
185         (elf_x32_lazy_ibt_plt_entry): Likewise.
186         (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
187         (elf_x32_non_lazy_ibt_plt_entry): Likewise.
188         (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
189         (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
190         (elf_x86_64_lazy_ibt_plt): Likewise.
191         (elf_x32_lazy_ibt_plt): Likewise.
192         (elf_x86_64_non_lazy_ibt_plt): Likewise.
193         (elf_x32_non_lazy_ibt_plt): Likewise.
194         (elf_x86_64_get_synthetic_symtab): Support the second PLT.
195         (elf_x86_64_parse_gnu_properties): Support
196         GNU_PROPERTY_X86_FEATURE_1_AND.
197         (elf_x86_64_merge_gnu_properties): Support
198         GNU_PROPERTY_X86_FEATURE_1_AND.  If info->ibt is set, turn
199         on GNU_PROPERTY_X86_FEATURE_1_IBT
200         (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
201         turn on GNU_PROPERTY_X86_FEATURE_1_IBT.  Use IBT-enabled PLT
202         for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
203         is set on all relocatable inputs.
204
205 2017-06-22  Nick Clifton  <nickc@redhat.com>
206
207         PR binutils/21649
208         * som.c (setup_sections): NUL terminate the space_strings buffer.
209         Check that the space.name field does not index beyond the end of
210         the space_strings buffer.
211
212 2017-06-21  Nick Clifton  <nickc@redhat.com>
213
214         PR binutils/21646
215         * coff-sh.c (sh_reloc): Check for an out of range reloc.
216
217 2017-06-21  Nick Clifton  <nickc@redhat.com>
218
219         PR binutils/21639
220         * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
221         type of the size parameter.
222         (_bfd_vms_save_counted_string): Add second parameter - the maximum
223         length of the counted string.
224         * vms.h (_bfd_vms_save_sized_string): Update prototype.
225         (_bfd_vms_save_counted_string): Likewise.
226         * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
227         _bfd_vms_save_counted_string.
228         (_bfd_vms_slurp_ehdr): Likewise.
229         (_bfd_vms_slurp_egsd): Likewise.
230         (Parse_module): Likewise.
231
232 2017-06-21  Alan Modra  <amodra@gmail.com>
233
234         * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
235         calls before tocsave calls.
236         (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
237         following nop.
238
239 2017-06-21  Nick Clifton  <nickc@redhat.com>
240
241         PR binutils/21645
242         * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
243         bfd_get_full_section_contents returns no contents.
244
245 2017-06-21  Nick Clifton  <nickc@redhat.com>
246
247         PR binutils/21638
248         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
249         record.
250
251 2017-06-21  Nick Clifton  <nickc@redhat.com>
252
253         PR binutils/21637
254         * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
255         list.
256         (image_set_ptr): Likewise.
257         (alpha_vms_fix_sec_rel): Likewise.
258         (alpha_vms_slurp_relocs): Likewise.
259
260 2017-06-21  Nick Clifton  <nickc@redhat.com>
261
262         PR binutils/21633
263         * ieee.c (ieee_slurp_sections): Check for a NULL return from
264         read_id.
265         (ieee_archive_p): Likewise.
266         (ieee_object_p): Likewise.
267
268 2017-06-21  Nick Clifton  <nickc@redhat.com>
269
270         PR binutils/21640
271         * elf.c (setup_group): Zero the group section pointer list after
272         allocation so that loops can be caught.  Check for NULL pointers
273         when processing a group list.
274
275 2017-06-20  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>
276
277         * elf-s390.h: New file.
278         * elf64-s390.c (struct elf_s390_link_hash_table): Add params
279         field.
280         (elf_s390_additional_program_headers): New function.
281         (elf_s390_modify_segment_map): New function.
282         (bfd_elf_s390_set_options): New function.
283         (elf_backend_additional_program_headers)
284         (elf_backend_modify_segment_map): Add macro definitions.
285
286 2017-06-19  H.J. Lu  <hongjiu.lu@intel.com>
287
288         PR ld/21626
289         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
290         the DYNAMIC bit instead of bfd_count_sections.
291
292 2017-06-19  Nick Clifton  <nickc@redhat.com>
293
294         PR binutils/21618
295         * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
296         length.
297         (evax_bfd_print_eeom): Likewise.
298         (evax_bfd_print_egsd): Check for an overlarge record length.
299         (evax_bfd_print_etir): Likewise.
300
301 2017-06-19  Nick Clifton  <nickc@redhat.com>
302
303         PR binutils/21612
304         * libieee.h (struct common_header_type): Add end_p field.
305         * ieee.c (this_byte_and_next): Do not advance input_p beyond
306         end_p.
307         (read_id): Check for a length that exceeds the remaining bytes in
308         the input buffer.
309         (ieee_seek): Initialise end_p.
310         (ieee_archive_p): Likewise.
311         (ieee_object_p): Likewise.
312
313 2017-06-19  Nick Clifton  <nickc@redhat.com>
314
315         PR binutils/21611
316         * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
317         before reading the EIHS structure entries.
318
319 2017-06-19  Nick Clifton  <nickc@redhat.com>
320
321         PR binutils/21615
322         * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
323         gsd_size.  Check that there are enough bytes remaining to read the
324         type and size of the next egsd.  Check that the size of the egsd
325         does not exceed the size of the record.
326
327 2017-06-19  Alan Modra  <amodra@gmail.com>
328
329         * config.bfd: Correct targ_underscore for cris.
330
331 2017-06-18  Alan Modra  <amodra@gmail.com>
332
333         * config.bfd: Correct targ_underscore for epiphany, ip2k,
334         m32c, mn10200, pru, rl78, rx, crisv32 and v850.
335
336 2017-06-16  Nick Clifton  <nickc@redhat.com>
337
338         * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
339         bucketlist is empty because there are no symbols to add to the
340         list.
341
342 2017-06-16  Alan Modra  <amodra@gmail.com>
343
344         PR ld/20022
345         PR ld/21557
346         PR ld/21562
347         PR ld/21571
348         * targets.c (struct bfd_target): Add _bfd_define_start_stop.
349         (BFD_JUMP_TABLE_LINK): Likewise.
350         * elf-bfd.h (bfd_elf_define_start_stop): Declare.
351         * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
352         (bfd_elf_define_start_stop): New function.
353         * linker.c (bfd_generic_define_start_stop): New function.
354         * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
355         new field.
356         * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
357         * aout-target.h (MY_bfd_define_start_stop): Define.
358         * aout-tic30.c (MY_bfd_define_start_stop): Define.
359         * binary.c (binary_bfd_define_start_stop): Define.
360         * bout.c (b_out_bfd_define_start_stop): Define.
361         * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
362         * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
363         * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
364         * coffcode.h (coff_bfd_define_start_stop): Define.
365         * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
366         * i386msdos.c (msdos_bfd_define_start_stop): Define.
367         * i386os9k.c (os9k_bfd_define_start_stop): Define.
368         * ieee.c (ieee_bfd_define_start_stop): Define.
369         * ihex.c (ihex_bfd_define_start_stop): Define.
370         * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
371         * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
372         * mmo.c (mmo_bfd_define_start_stop): Define.
373         * nlm-target.h (nlm_bfd_define_start_stop): Define.
374         * oasys.c (oasys_bfd_define_start_stop): Define.
375         * pef.c (bfd_pef_bfd_define_start_stop): Define.
376         * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
377         * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
378         * som.c (som_bfd_define_start_stop): Define.
379         * srec.c (srec_bfd_define_start_stop): Define.
380         * tekhex.c (tekhex_bfd_define_start_stop): Define.
381         * versados.c (versados_bfd_define_start_stop): Define.
382         * vms-alpha.c (vms_bfd_define_start_stop): Define.
383         (alpha_vms_bfd_define_start_stop): Define.
384         * xsym.c (bfd_sym_bfd_define_start_stop): Define.
385         * bfd-in2.h: Regenerate.
386         * libbfd.h: Regenerate.
387
388 2017-06-16  Jiong Wang  <jiong.wang@arm.com>
389
390         * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
391         SYMBOL_REFERENCES_LOCAL.
392
393 2017-06-15  Jiong Wang  <jiong.wang@arm.com>
394
395         PR ld/21532
396         * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
397         (elfNN_aarch64_final_link_relocate): Also propagate relocations to
398         runtime for if there needs copy relocation elimination.
399         (need_copy_relocation_p): New function.  Return true for symbol with
400         pc-relative references and if it's against read-only sections.
401         (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
402         (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
403         that are related with accessing external objects.
404         (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
405         in elfNN_aarch64_check_relocs.
406
407 2017-06-15  Nick Clifton  <nickc@redhat.com>
408
409         PR binutils/21582
410         * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
411         bugs.
412         PR binutils/21581
413         (ieee_archive_p): Likewise.
414
415 2017-06-15  Nick Clifton  <nickc@redhat.com>
416
417         PR binutils/21579
418         * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
419
420 2017-06-14  Max Filippov  <jcmvbkbc@gmail.com>
421
422         * elf32-xtensa.c (elf_xtensa_be_plt_entry,
423         elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
424         keep both windowed and call0 ABI PLT definitions.
425         (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
426         elf_xtensa_*_plt_entry endex.
427         (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
428
429 2017-06-14  Nick Clifton  <nickc@redhat.com>
430
431         PR binutils/21578
432         * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
433         flag value.
434
435 2017-06-14  Nick Clifton  <nickc@redhat.com>
436
437         PR binutils/21589
438         * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
439         maximum value for the ascic pointer.  Check that name processing
440         does not read beyond this value.
441         (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
442         end of etir record.
443
444 2017-06-14  Nick Clifton  <nickc@redhat.com>
445
446         PR binutils/21591
447         * versados.c (versados_mkobject): Zero the allocated tdata structure.
448         (process_otr): Check for an invalid offset in the otr structure.
449
450 2017-06-14  Sebastian Huber  <sebastian.huber@embedded-brains.de>
451
452         * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
453
454 2017-06-13  H.J. Lu  <hongjiu.lu@intel.com>
455
456         PR ld/20022
457         PR ld/21557
458         PR ld/21562
459         PR ld/21571
460         * elf-bfd.h (elf_link_hash_entry): Add start_stop.  Change the
461         vtable field to a union.
462         (_bfd_elf_is_start_stop): Removed.
463         * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
464         __start_SECNAME and __stop_SECNAME symbols.
465         * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
466         * elflink.c (_bfd_elf_is_start_stop): Removed.
467         (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
468         _bfd_elf_is_start_stop.
469         (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
470         __stop_SECNAME symbols.  Updated.
471         (elf_gc_smash_unused_vtentry_relocs): Likewise.
472         (bfd_elf_gc_record_vtinherit): Likewise.
473         (bfd_elf_gc_record_vtentry): Likewise.
474
475 2017-06-13  Nick Clifton  <nickc@redhat.com>
476
477         PR ld/21524
478         * elflink.c (elf_link_adjust_relocs): Generate an error when
479         encountering a reloc against a symbol removed by garbage
480         collection.
481
482 2017-06-12  H.J. Lu  <hongjiu.lu@intel.com>
483
484         * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
485         to merge_gnu_properties.
486         * elf-properties.c (elf_merge_gnu_properties): Add struct
487         bfd_link_info * and pass it to merge_gnu_properties.
488         (elf_merge_gnu_property_list): Add struct bfd_link_info *
489         and pass it to elf_merge_gnu_properties.
490         (_bfd_elf_link_setup_gnu_properties): Pass info to
491         elf_merge_gnu_property_list.
492         * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
493         bfd_link_info *.
494         * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
495
496 2017-06-11  Joe Zbiciak  <joe.zbiciak@leftturnonly.info>
497
498         PR 21564
499         * binary.c (binary_set_section_contents): Scale lma by octets
500         per byte to set filepos.
501
502 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
503
504         * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
505         dynamic sections.
506
507 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
508
509         * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
510         require TEXTREL.
511
512 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
513
514         * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
515         patched section contents for TLS IE reloc.
516         * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
517
518 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
519
520         * elf32-arc.c (elf_arc_relocate_section): Added "call" to
521         RELOC_FOR_GLOBAL_SYMBOL macro.
522
523 2018-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
524
525         * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
526         changes.
527
528 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
529
530         * config/tc-arc.c (md_undefined_symbol): Changed.
531         * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
532
533 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
534
535         * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
536         symbols.
537
538 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
539
540         * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
541         warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
542
543 2017-06-08  Cupertino Miranda  <cmiranda@synopsys.com>
544
545         * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
546         object is created.
547
548 2017-06-08  Richard Earnshaw  <rearnsha@arm.com>
549
550         * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
551         that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
552         is non-zero.  Add clarifying comments.
553
554 2017-06-08  H.J. Lu  <hongjiu.lu@intel.com>
555
556         * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
557         name.  Use local IFUNC symbol name string to report unsupported
558         non-PIC call to IFUNC function.
559         (elf_i386_relocate_section): Dump local IFUNC name with minfo
560         when generating R_386_IRELATIVE relocation.
561         (elf_i386_finish_dynamic_symbol): Likewise.
562         * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
563         IFUNC symbol name.
564         (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
565         when generating R_X86_64_IRELATIVE relocation.
566         (elf_x86_64_finish_dynamic_symbol): Likewise.
567
568 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
569
570         * elf.c (setup_group): Make sure BFD sections are created for all
571         group sections in the input file when processing SHF_GROUP
572         sections.
573         (bfd_section_from_shdr): Avoid duplicating logic already
574         implemented in `setup_group'.
575
576 2017-06-06  Daniel Bonniot de Ruisselet  <bonniot@gmail.com>
577
578         PR binutils/21546
579         * peXXigen.c (pe_print_idata): Use the address of the first thunk
580         if the hint address is zero.
581
582 2017-06-06  James Clarke  <jrtc27@jrtc27.com>
583
584         PR ld/19579
585         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
586         ELF_COMMON_DEF_P for common symbols.
587
588 2017-06-06  Andrew Burgess  <andrew.burgess@embecosm.com>
589
590         * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
591         SEC_GROUP sections as SEC_EXCLUDE.
592         (bfd_elf_set_group_contents): Replace use of abort with an assert.
593         (assign_section_numbers): Use resolve_section_groups flag instead
594         of relocatable link type.
595         (_bfd_elf_init_private_section_data): Use resolve_section_groups
596         flag instead of checking the final_link flag for part of the
597         checks in here.  Fix white space as a result.
598         * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
599         instead of relocatable link type.
600         (bfd_elf_final_link): Likewise.
601
602 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
603
604         * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
605         variable `bed'.
606         * elf32-score.c (score_elf_final_link_relocate): Likewise.
607         (s3_bfd_score_elf_check_relocs): Likewise.
608         * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
609         (score_elf_final_link_relocate): Likewise.
610         (s7_bfd_score_elf_check_relocs): Likewise.
611
612 2017-06-06  Jose E. Marchesi  <jose.marchesi@oracle.com>
613
614         * elflink.c (init_reloc_cookie_rels): Remove unused variable
615         `bed'.
616
617 2017-06-06  Maciej W. Rozycki  <macro@imgtec.com>
618
619         * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
620         from `reloc_count' rather than decrementing it.
621         * elf.c (bfd_section_from_shdr): Multiply the adjustment to
622         `reloc_count' by `int_rels_per_ext_rel'.
623         * elf32-score.c (score_elf_final_link_relocate): Do not multiply
624         `reloc_count' by `int_rels_per_ext_rel' for last relocation
625         entry determination.
626         (s3_bfd_score_elf_check_relocs): Likewise.
627         * elf32-score7.c (score_elf_final_link_relocate): Likewise.
628         (s7_bfd_score_elf_relocate_section): Likewise.
629         (s7_bfd_score_elf_check_relocs): Likewise.
630         * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
631         prototype and function.
632         (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
633         (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
634         triple rather than once the sum of REL and RELA relocation entry
635         counts.
636         (bfd_elf64_get_reloc_upper_bound): Remove macro.
637         * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
638         `reloc_count' by `int_rels_per_ext_rel' for internal relocation
639         storage allocation size determination.
640         (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
641         size by `int_rels_per_ext_rel'.  Do not multiply `reloc_count'
642         by `int_rels_per_ext_rel' for last relocation entry
643         determination.
644         (bfd_elf_final_link): Do not multiply `reloc_count' by
645         `int_rels_per_ext_rel' for internal relocation storage
646         allocation size determination.
647         (init_reloc_cookie_rels): Do not multiply `reloc_count' by
648         `int_rels_per_ext_rel' for last relocation entry determination.
649         (elf_gc_smash_unused_vtentry_relocs): Likewise.
650         * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
651         (_bfd_mips_elf_relocate_section): Likewise.
652
653 2017-06-05  Alan Modra  <amodra@gmail.com>
654
655         PR 21529
656         * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
657
658 2017-06-01  John Baldwin  <jhb@FreeBSD.org>
659
660         * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
661         determine structure sizes.
662         (elfcore_grok_freebsd_prstatus): Likewise.
663
664 2017-06-01  Alan Modra  <amodra@gmail.com>
665
666         * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
667         (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
668         dynamic objects.
669         (is_elfv2_localentry0): New function.
670         (ppc64_elf_tls_setup): Default params->plt_localentry0.
671         (plt_stub_size): Adjust size for tls_get_addr_opt stub.
672         (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
673         (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
674         optimized localentry:0 stubs.
675         (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
676         (ppc64_elf_relocate_section): Leave nop unchanged for optimized
677         localentry:0 stubs.
678         (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
679         DT_PPC64_OPT.
680         * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
681
682 2017-05-30  Casey Smith  <clegg89@gmail.com>
683
684         PR ld/21523
685         * elf32-arm.c (elf32_arm_final_link_relocate): Install an absolute
686         value when processing the R_ARM_THM_ALU_PREL_11_0 reloc.
687
688 2017-05-30  Anton Kolesov  Anton.Kolesov@synopsys.com
689
690         * cpu-arc.c (arc_compatible): New function.
691
692 2017-05-30  Anton Kolesov  <anton.kolesov@synopsys.com>
693
694         * cpu-arc.c (arch_info_struct): Remove duplicate ARC600 entry.
695
696 2017-05-30  H.J. Lu  <hongjiu.lu@intel.com>
697
698         PR binutils/21519
699         * bfdio.c (bfd_get_file_size): New function.
700         * bfd-in2.h: Regenerated.
701
702 2017-05-23  Dilian Palauzov  <git-dpa@aegee.org>
703
704         * elf32-arc.c (arc_elf_merge_attributes): Add fall through
705         comments.
706
707 2017-05-22  H.J. Lu  <hongjiu.lu@intel.com>
708
709         * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Use
710         dynobj instead of htab->elf.dynobj.
711
712 2017-05-19  Maciej W. Rozycki  <macro@imgtec.com>
713
714         * elf64-mips.c (mips_elf64_canonicalize_reloc): Remove prototype
715         and function.
716         (mips_elf64_canonicalize_dynamic_reloc): Likewise.
717         (mips_elf64_slurp_one_reloc_table): Set `reloc_count' to the
718         actual number of internal relocations retrieved.  Adjust
719         function description.
720         (bfd_elf64_canonicalize_reloc): Remove macro.
721         (bfd_elf64_canonicalize_dynamic_reloc): Likewise.
722
723 2017-05-19  Jose E. Marchesi  <jose.marchesi@oracle.com>
724
725         * archures.c (bfd_mach_sparc_v9m8): Define.
726         (bfd_mach_sparc_v8plusm8): Likewise.
727         (bfd_mach_sparc_v9_p): Adjust to M8.
728         (bfd_mach_sparc_64bit_p): Likewise.
729         * aoutx.h (machine_type): Handle bfd_mach_sparc_v9m8 and
730         bfd_mach_sparc_v8plusm8.
731         * bfd-in2.h: Regenerated.
732         * cpu-sparc.c (arch_info_struct): Entries for sparc:v9m8 and
733         sparc:v8plusm8.
734         * elfxx-sparc.c (_bfd_sparc_elf_object_p): Handle
735         bfd_mach_sparc_v8plusm8 and bfd_mach_sparc_v9m8 using the new hw
736         capabilities ONADDSUB, ONMUL, ONDIV, DICTUNP, FPCPSHL, RLE and
737         SHA3.
738         * elf32-sparc.c (elf32_sparc_final_write_processing): Handle
739         bfd_mach_sparc_v8plusm8.
740
741 2017-05-19  Alan Modra  <amodra@gmail.com>
742
743         * elflink.c (_bfd_elf_gc_mark_extra_sections): Don't keep
744         debug and special sections when no non-note alloc sections in an
745         object are kept.
746
747 2017-05-18  Alan Modra  <amodra@gmail.com>
748
749         * arc-got.h: Don't compare boolean values against TRUE or FALSE.
750         * elf-m10300.c: Likewise.
751         * elf.c: Likewise.
752         * elf32-arc.c: Likewise.
753         * elf32-bfin.c: Likewise.
754         * elf32-m68k.c: Likewise.
755         * elf32-nds32.c: Likewise.
756         * elf32-tilepro.c: Likewise.
757         * elflink.c: Likewise.
758         * elfnn-aarch64.c: Likewise.
759         * elfnn-riscv.c: Likewise.
760         * elfxx-tilegx.c: Likewise.
761         * mach-o.c: Likewise.
762         * peXXigen.c: Likewise.
763         * vms-alpha.c: Likewise.
764         * vms-lib.c: Likewise.
765
766 2017-05-17  H.J. Lu  <hongjiu.lu@intel.com>
767
768         PR ld/20882
769         * elflink.c (elf_gc_mark_debug_section): New function.
770         (_bfd_elf_gc_mark_extra_sections): Mark any debug sections
771         referenced by kept debug sections.
772
773 2017-05-16  Alan Modra  <amodra@gmail.com>
774
775         * elf-m10300.c: Rename occurrences of non_ir_ref.
776         * elf32-arm.c: Likewise.
777         * elf32-bfin.c: Likewise.
778         * elf32-cr16.c: Likewise.
779         * elf32-cris.c: Likewise.
780         * elf32-d10v.c: Likewise.
781         * elf32-dlx.c: Likewise.
782         * elf32-fr30.c: Likewise.
783         * elf32-frv.c: Likewise.
784         * elf32-hppa.c: Likewise.
785         * elf32-i370.c: Likewise.
786         * elf32-i386.c: Likewise.
787         * elf32-iq2000.c: Likewise.
788         * elf32-lm32.c: Likewise.
789         * elf32-m32c.c: Likewise.
790         * elf32-m32r.c: Likewise.
791         * elf32-m68hc1x.c: Likewise.
792         * elf32-m68k.c: Likewise.
793         * elf32-mcore.c: Likewise.
794         * elf32-metag.c: Likewise.
795         * elf32-microblaze.c: Likewise.
796         * elf32-moxie.c: Likewise.
797         * elf32-msp430.c: Likewise.
798         * elf32-mt.c: Likewise.
799         * elf32-nios2.c: Likewise.
800         * elf32-or1k.c: Likewise.
801         * elf32-ppc.c: Likewise.
802         * elf32-rl78.c: Likewise.
803         * elf32-s390.c: Likewise.
804         * elf32-score.c: Likewise.
805         * elf32-score7.c: Likewise.
806         * elf32-sh.c: Likewise.
807         * elf32-tic6x.c: Likewise.
808         * elf32-tilepro.c: Likewise.
809         * elf32-v850.c: Likewise.
810         * elf32-vax.c: Likewise.
811         * elf32-xstormy16.c: Likewise.
812         * elf32-xtensa.c: Likewise.
813         * elf64-alpha.c: Likewise.
814         * elf64-hppa.c: Likewise.
815         * elf64-ia64-vms.c: Likewise.
816         * elf64-mmix.c: Likewise.
817         * elf64-ppc.c: Likewise.
818         * elf64-s390.c: Likewise.
819         * elf64-sh64.c: Likewise.
820         * elf64-x86-64.c: Likewise.
821         * elflink.c: Likewise.
822         * elfnn-aarch64.c: Likewise.
823         * elfnn-ia64.c: Likewise.
824         * elfnn-riscv.c: Likewise.
825         * elfxx-mips.c: Likewise.
826         * elfxx-sparc.c: Likewise.
827         * elfxx-tilegx.c: Likewise.
828         * linker.c: Likewise.
829
830 2017-05-16  Alan Modra  <amodra@gmail.com>
831
832         * elf64-ppc.c (add_symbol_adjust): Transfer non_ir_ref_dynamic.
833         * elflink.c (elf_link_add_object_symbols): Update to use
834         non_ir_ref_dynamic.
835         (elf_link_input_bfd): Test non_ir_ref_dynamic in addition to
836         non_ir_ref.
837         * linker.c (_bfd_generic_link_add_one_symbol): Likewise.
838
839 2017-05-15  Maciej W. Rozycki  <macro@imgtec.com>
840
841         * elfxx-mips.c (print_mips_ases): Handle MIPS16e2 ASE.
842
843 2017-05-12  H.J. Lu  <hongjiu.lu@intel.com>
844
845         * elf32-i386.c (elf_i386_parse_gnu_properties): Merge
846         GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED
847         properties.
848         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
849
850 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
851
852         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Rename plt_bnd
853         to plt_second.
854         (elf_x86_64_link_hash_table): Rename plt_bnd/plt_bnd_eh_frame
855         to plt_second/plt_second_eh_frame.
856         (elf_x86_64_link_hash_newfunc): Updated.
857         (elf_x86_64_allocate_dynrelocs): Likewise.
858         (elf_x86_64_size_dynamic_sections): Likewise.
859         (elf_x86_64_relocate_section): Likewise.
860         (elf_x86_64_finish_dynamic_symbol): Likewise.
861         (elf_x86_64_finish_dynamic_sections): Likewise.
862         (elf_x86_64_plt_type): Rename plt_bnd to plt_second.
863         (elf_x86_64_get_synthetic_symtab): Updated.  Also scan the
864         .plt.sec section.
865         (elf_backend_setup_gnu_properties): Updated.  Create the
866         .plt.sec section instead of the .plt.sec section.
867
868 2017-05-11  H.J. Lu  <hongjiu.lu@intel.com>
869
870         * elf32-i386.c (elf_i386_allocate_dynrelocs): Partially revert
871         commit 25070364b0ce33eed46aa5d78ebebbec6accec7e.
872         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewse.
873
874 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
875
876         * elf64-sparc.c (elf64_sparc_set_reloc): New function.
877         (bfd_elf64_set_reloc): Define.
878         (elf64_sparc_write_relocs): Use `canon_reloc_count'.
879
880 2017-05-10  Jose E. Marchesi  <jose.marchesi@oracle.com>
881
882         * targets.c (BFD_JUMP_TABLE_RELOCS): Add NAME##_set_reloc.
883         (struct bfd_target): New field _bfd_set_reloc.
884         * bfd.c (bfd_set_reloc): Call backend _set_bfd.
885         * reloc.c (_bfd_generic_set_reloc): New function.
886         * coffcode.h (coff_set_reloc): Define to _bfd_generic_set_reloc.
887         * nlm-target.h (nlm_set_reloc): Likewise.
888         * coff-rs6000.c (_bfd_xcoff_set_reloc): Likewise.
889         * aout-tic30.c (MY_set_reloc): Likewise.
890         * aout-target.h (MY_set_reloc): Likewise.
891         * elfxx-target.h (bfd_elfNN_set_reloc): Likewise.
892         * coff-alpha.c (_bfd_ecoff_set_reloc): Likewise.
893         * mach-o-target.c (bfd_mach_o_set_reloc): Likewise.
894         * vms-alpha.c (alpha_vms_set_reloc): Likewise.
895         * aout-adobe.c (aout_32_set_reloc): Likewise.
896         * bout.c (b_out_set_reloc): Likewise.
897         * coff-mips.c (_bfd_ecoff_set_reloc): Likewise.
898         * i386os9k.c (aout_32_set_reloc): Likewise.
899         * ieee.c (ieee_set_reloc): Likewise.
900         * oasys.c (oasys_set_reloc): Likewise.
901         * som.c (som_set_reloc): Likewise.
902         * versados.c (versados_set_reloc): Likewise.
903         * coff64-rs6000.c (rs6000_xcoff64_vec): Add
904         _bfd_generic_set_reloc.
905         (rs6000_xcoff64_aix_vec): LIkewise.
906         * libbfd.c (_bfd_norelocs_set_reloc): New function.
907         * libbfd-in.h: Prototype for _bfd_norelocs_set_reloc.
908         * i386msdos.c (msdos_set_reloc): Define to
909         _bfd_norelocs_set_reloc.
910         * elfcode.h (elf_set_reloc): Define.
911         * bfd-in2.h: Regenerated.
912
913 2017-05-10  H.J. Lu  <hongjiu.lu@intel.com>
914
915         PR ld/21481
916         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Use .plt.bnd
917         for IFUNC function address.
918
919 2017-05-10  Claudiu Zissulescu  <claziss@synopsys.com>
920
921         * elf32-arc.c (FEATURE_LIST_NAME): Define.
922         (CONFLICT_LIST): Likewise.
923         (opcode/arc-attrs.h): Include.
924         (arc_elf_print_private_bfd_data): Print OSABI v4 flag.
925         (arc_extract_features): New file.
926         (arc_stralloc): Likewise.
927         (arc_elf_merge_attributes): Likewise.
928         (arc_elf_merge_private_bfd_data): Use object attributes.
929         (bfd_arc_get_mach_from_attributes): New function.
930         (arc_elf_object_p): Use object attributes.
931         (arc_elf_final_write_processing): Likewise.
932         (elf32_arc_obj_attrs_arg_type): New function.
933         (elf32_arc_obj_attrs_handle_unknown): Likewise.
934         (elf32_arc_section_from_shdr): Likewise.
935         (elf_backend_obj_attrs_vendor): Define.
936         (elf_backend_obj_attrs_section): Likewise.
937         (elf_backend_obj_attrs_arg_type): Likewise.
938         (elf_backend_obj_attrs_section_type): Likewise.
939         (elf_backend_obj_attrs_handle_unknown): Likewise.
940         (elf_backend_section_from_shdr): Likewise.
941
942 2017-05-09  Andrew Goedhart  <Andrewgoedhart@simplepowersolutions.co.za>
943
944         PR ld/21458
945         * elf32-arm.c (elf32_arm_final_link_relocate): Set the bottom bit
946         of the value when resolving a R_ARM_THM_ALU_PREL_11_0 relocation
947         and the destination is a Thumb symbol.
948
949 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
950
951         * elf32-i386.c (elf_i386_get_synthetic_symtab): Add missing
952         initializer to silence GCC 4.2.
953         * lf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Likewise.
954
955 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
956
957         * elf64-x86-64.c (PLT_ENTRY_SIZE): Renamed to ...
958         (LAZY_PLT_ENTRY_SIZE): This.
959         (NON_LAZY_PLT_ENTRY_SIZE): New.
960         (elf_x86_64_plt0_entry): Renamed to ...
961         (elf_x86_64_lazy_plt0_entry): This.
962         (elf_x86_64_plt_entry): Renamed to ...
963         (elf_x86_64_lazy_plt_entry): This.
964         (elf_x86_64_bnd_plt0_entry): Renamed to ...
965         (elf_x86_64_lazy_bnd_plt0_entry): This.
966         (elf_x86_64_legacy_plt_entry): Removed.
967         (elf_x86_64_bnd_plt_entry): Renamed to ...
968         (elf_x86_64_lazy_bnd_plt_entry): This.
969         (elf_x86_64_legacy_plt2_entry): Renamed to ...
970         (elf_x86_64_non_lazy_plt_entry): This.
971         (elf_x86_64_bnd_plt2_entry): Renamed to ...
972         (elf_x86_64_non_lazy_bnd_plt_entry): This.
973         (elf_x86_64_eh_frame_plt): Renamed to ...
974         (elf_x86_64_eh_frame_lazy_plt): This.
975         (elf_x86_64_eh_frame_bnd_plt): Renamed to ...
976         (elf_x86_64_eh_frame_lazy_bnd_plt): This.
977         (elf_x86_64_eh_frame_plt_got): Renamed to ...
978         (elf_x86_64_eh_frame_non_lazy_plt): This.
979         (elf_x86_64_lazy_plt_layout): New.
980         (elf_x86_64_non_lazy_plt_layout): Likewise.
981         (elf_x86_64_plt_layout): Likewise.
982         (elf_x86_64_backend_data): Remove PLT layout information.  Add
983         os for target system.
984         (GET_PLT_ENTRY_SIZE): Removed.
985         (elf_x86_64_lazy_plt): New.
986         (elf_x86_64_non_lazy_plt): Likewise.
987         (elf_x86_64_lazy_bnd_plt): Likewise.
988         (elf_x86_64_non_lazy_bnd_plt): Likewise.
989         (elf_x86-64_arch_bed): Updated.
990         (elf_x86_64_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
991         (elf_x86_64_create_dynamic_sections): Removed.
992         (elf_x86_64_check_relocs): Don't check elf.dynobj.  Don't call
993         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
994         (elf_x86-64_adjust_dynamic_symbol): Updated.
995         (elf_x86_64_allocate_dynrelocs): Updated.  Pass 0 as PLT header
996         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
997         size for PLT0 if there is no PLT0.  Get plt_entry_size from
998         non_lazy_plt for non-lazy PLT entries.
999         (elf_x86_64_size_dynamic_sections): Updated.  Get plt_entry_size
1000         from non_lazy_plt for non-lazy PLT entries.
1001         (elf_x86-64_relocate_section): Updated.  Properly get PLT index
1002         if there is no PLT0.
1003         (elf_x86_64_finish_dynamic_symbol): Updated.  Fill the first slot
1004         in the PLT entry with generic PLT layout.  Fill the non-lazy PLT
1005         entries with non-lazy PLT layout.  Don't fill the second and third
1006         slots in the PLT entry if there is no PLT0.
1007         (elf_x86_64_finish_dynamic_sections): Updated.  Don't fill PLT0
1008         if there is no PLT0.  Set sh_entsize on the .plt.got section.
1009         (compare_relocs): New.
1010         (elf_x86_64_plt_type): Likewise.
1011         (elf_x86_64_plt): Likewise.
1012         (elf_x86_64_nacl_plt): New. Forward declaration.
1013         (elf_x86_64_get_plt_sym_val): Removed.
1014         (elf_x86_64_get_synthetic_symtab): Rewrite to check PLT sections
1015         against all dynamic relocations.
1016         (elf_x86_64_link_setup_gnu_properties): New function.
1017         (elf_backend_create_dynamic_sections): Updated.
1018         (elf_backend_setup_gnu_properties): New.
1019         (elf_x86_64_nacl_plt): New.
1020         (elf_x86_64_nacl_arch_bed): Updated.
1021
1022 2017-05-08  H.J. Lu  <hongjiu.lu@intel.com>
1023
1024         * elf32-i386.c (PLT_ENTRY_SIZE): Renamed to ...
1025         (LAZY_PLT_ENTRY_SIZE): This.
1026         (NON_LAZY_PLT_ENTRY_SIZE): New.
1027         (elf_i386_plt0_entry): Renamed to ...
1028         (elf_i386_lazy_plt0_entry): This.
1029         (elf_i386_plt_entry): Renamed to ...
1030         (elf_i386_lazy_plt_entry): This.
1031         (elf_i386_pic_plt0_entry): Renamed to ...
1032         (elf_i386_pic_lazy_plt0_entry): This.
1033         (elf_i386_pic_plt_entry): Renamed to ...
1034         (elf_i386_pic_lazy_plt_entry): This.
1035         (elf_i386_got_plt_entry): Renamed to ...
1036         (elf_i386_non_lazy_plt_entry): This.
1037         (elf_i386_pic_got_plt_entry): Renamed to ...
1038         (elf_i386_pic_non_lazy_plt_entry): This.
1039         (elf_i386_eh_frame_plt): Renamed to ...
1040         (elf_i386_eh_frame_lazy_plt): This.
1041         (elf_i386_eh_frame_plt_got): Renamed to ...
1042         (elf_i386_eh_frame_non_lazy_plt): This.
1043         (elf_i386_plt_layout): Renamed to ...
1044         (elf_i386_lazy_plt_layout): This.  Remove eh_frame_plt_got and
1045         eh_frame_plt_got_size.
1046         (elf_i386_non_lazy_plt_layout): New.
1047         (elf_i386_plt_layout): Likewise.
1048         (elf_i386_non_lazy_plt): Likewise.
1049         (GET_PLT_ENTRY_SIZE): Removed.
1050         (elf_i386_plt): Renamed to ...
1051         (elf_i386_lazy_plt): This.
1052         (elf_i386_backend_data): Remove plt.  Rename is_vxworks to os.
1053         (elf_i386_arch_bed): Updated.
1054         (elf_i386_link_hash_table): Add plt, lazy_plt and non_lazy_plt.
1055         (elf_i386_create_dynamic_sections): Removed.
1056         (elf_i386_check_relocs): Don't check elf.dynobj.  Don't call
1057         _bfd_elf_create_ifunc_sections nor _bfd_elf_create_got_section.
1058         (elf_i386_adjust_dynamic_symbol): Updated.
1059         (elf_i386_allocate_dynrelocs): Updated.  Pass 0 as PLT header
1060         size to _bfd_elf_allocate_ifunc_dyn_relocs and don't allocate
1061         size for PLT0 if there is no PLT0.
1062         (elf_i386_size_dynamic_sections): Updated.  Check whether GOT
1063         output section is discarded only if GOT isn't empty.
1064         (elf_i386_relocate_section): Updated.  Properly get PLT index
1065         if there is no PLT0.
1066         (elf_i386_finish_dynamic_symbol): Updated.  Don't fill the
1067         second and third slots in the PLT entry if there is no PLT0.
1068         (elf_i386_finish_dynamic_sections): Updated.  Don't fill PLT0
1069         if there is no PLT0.  Set sh_entsize on the .plt.got section.
1070         (elf_i386_nacl_plt): Forward declaration.
1071         (elf_i386_get_plt_sym_val): Removed.
1072         (elf_i386_get_synthetic_symtab): Rewrite to check PLT sections
1073         against all dynamic relocations.
1074         (elf_i386_link_setup_gnu_properties): New function.
1075         (elf_backend_create_dynamic_sections): Updated.
1076         (elf_backend_setup_gnu_properties): New.
1077         (elf_i386_nacl_plt): Updated.
1078         (elf_i386_nacl_arch_bed): Likewise.
1079         (elf_i386_vxworks_arch_bed): Likewise.
1080
1081 2017-05-08  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1082
1083         * elflink.c (elf_output_implib): Remove executable flag from import
1084         library bfd.
1085         * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
1086         library is a relocatable object file.
1087
1088 2017-05-01  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
1089
1090         PR ld/21404
1091         * elf32-avr.c (avr_should_move_sym): New function.
1092         (avr_should_reduce_sym_size): Likewise.
1093         (avr_should_increase_sym_size): Likewise.
1094         (elf32_avr_relax_delete_bytes): Adjust symbol values
1095         and sizes by calling new functions.
1096
1097 2017-05-01  Palmer Dabbelt  <palmer@dabbelt.com>
1098
1099         * config.bfd (riscv32-*): Enable rv64.
1100
1101 2017-05-02  Alan Modra  <amodra@gmail.com>
1102
1103         PR 21384
1104         * elflink.c (bfd_elf_link_mark_dynamic_symbol): Test h->non_elf
1105         rather than h->root.type == bfd_link_hash_new.
1106         (bfd_elf_record_link_assignment): Similarly, call
1107         bfd_elf_link_mark_dynamic_symbol when h->non_elf.
1108
1109 2017-04-29  Alan Modra  <amodra@gmail.com>
1110
1111         PR 21432
1112         * reloc.c (reloc_offset_in_range): New function.
1113         (bfd_perform_relocation, bfd_install_relocation): Use it.
1114         (_bfd_final_link_relocate): Likewise.
1115
1116 2017-04-28  H.J. Lu  <hongjiu.lu@intel.com>
1117
1118         * elf32-i386.c (elf_i386_allocate_dynrelocs): Check plt_got
1119         before using .plt.got.
1120         * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise.
1121
1122 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1123
1124         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Use "="
1125         instead of "+=" to update 0.
1126
1127 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1128
1129         * elf32-i386.c (elf_i386_create_dynamic_sections): Create the
1130         .plt.got section here.
1131         (elf_i386_check_relocs): Don't create the .plt.got section.
1132         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Create
1133         the .plt.got and .plt.bnd sections here.
1134         (elf_x86_64_check_relocs): Don't create the .plt.got nor
1135         .plt.bnd sections.
1136
1137 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1138
1139         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Remove
1140         has_bnd_reloc.
1141         (elf_x86_64_link_hash_newfunc): Don't clear has_bnd_reloc.
1142         (elf_x86_64_copy_indirect_symbol): Don't copy has_bnd_reloc.
1143         (elf_x86_64_check_relocs): Don't set has_bnd_reloc.
1144         (elf_x86_64_finish_dynamic_symbol): Check bndplt instead of
1145         has_bnd_reloc.
1146
1147 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1148
1149         * elf-bfd.h (elf_backend_data): Change setup_gnu_properties
1150         to return bfd *.
1151         (_bfd_elf_link_setup_gnu_properties): Return bfd *.
1152         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Return
1153         the first relocatable ELF input with GNU properties.
1154
1155 2017-04-27  H.J. Lu  <hongjiu.lu@intel.com>
1156
1157         * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
1158         VxWorks for non-PIC.
1159
1160 2017-04-27  Alan Modra  <amodra@gmail.com>
1161
1162         * elf-bfd.h (struct elf_backend_data): Make asection param of
1163         elf_backend_eh_frame_address_size const.
1164         (_bfd_elf_eh_frame_address_size): Likewise.
1165         * elf32-m32c.c (_bfd_m32c_elf_eh_frame_address_size): Likewise.
1166         * elf32-msp430.c (elf32_msp430_eh_frame_address_size): Likewise.
1167         * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Likewise.
1168         * elfxx-mips.h (_bfd_mips_elf_eh_frame_address_size): Likewise.
1169         * elf-eh-frame.c (_bfd_elf_eh_frame_address_size): Likewise.
1170         (next_cie_fde_offset): Constify params.
1171         (offset_adjust, adjust_eh_frame_local_symbols): Likewise.
1172
1173 2017-04-27  Alan Modra  <amodra@gmail.com>
1174
1175         * elf-bfd.h (struct eh_cie_fde): Add aug_str_len and aug_data_len.
1176         (_bfd_elf_adjust_eh_frame_global_symbol): Declare.
1177         * elf-eh-frame.c (_bfd_elf_parse_eh_frame): Set aug_str_len and
1178         aug_data_len.
1179         (offset_adjust): New function.
1180         (_bfd_elf_adjust_eh_frame_global_symbol): Likewise.
1181         (adjust_eh_frame_local_symbols): Likewise.
1182         (_bfd_elf_discard_section_eh_frame): Call adjust_eh_frame_local_symbols
1183         after changing anything.  Return true if anything changed.
1184         * elflink.c (bfd_elf_discard_info): If .eh_frame changed, call
1185         _bfd_elf_adjust_eh_frame_global_symbol for globals.
1186
1187 2017-04-27  Alan Modra  <amodra@gmail.com>
1188
1189         * elflink.c (_bfd_elf_link_hash_hide_symbol): Clear dynstr_index
1190         when force_local.
1191
1192 2017-04-27  Alan Modra  <amodra@gmail.com>
1193
1194         * elf32-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
1195         (ppc_elf_select_plt_layout, ppc_elf_tls_setup): Use it.
1196         (ppc_elf_adjust_dynamic_symbol, allocate_dynrelocs): Likewise.
1197         (ppc_elf_relocate_section): Likewise.  Delete silly optimisation
1198         for undef and undefweak dyn_relocs.
1199         * elf64-ppc.c (UNDEFWEAK_NO_DYNAMIC_RELOC): Define.
1200         (ppc64_elf_adjust_dynamic_symbol, ppc64_elf_tls_setup): Use it.
1201         (allocate_got, allocate_dynrelocs): Likewise.
1202         (ppc64_elf_relocate_section): Likewise.
1203
1204 2017-04-26  H.J. Lu  <hongjiu.lu@intel.com>
1205
1206         * elf32-i386.c (elf_i386_size_dynamic_sections): Alwasys add
1207         DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rel.plt section.
1208         * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Alwasys
1209         add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL for .rela.plt section.
1210
1211 2017-04-26  Nick Clifton  <nickc@redhat.com>
1212
1213         PR binutils/21434
1214         * reloc.c (bfd_perform_relocation): Check for a negative address
1215         in the reloc.
1216
1217 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
1218
1219         PR ld/21334
1220         * elf-bfd.h (elf_backend_data): Add `always_renumber_dynsyms'
1221         member.
1222         * elfxx-target.h [!elf_backend_always_renumber_dynsyms]
1223         (elf_backend_always_renumber_dynsyms): Define.
1224         (elfNN_bed): Initialize `always_renumber_dynsyms' member.
1225         * elfxx-mips.h (elf_backend_always_renumber_dynsyms): Define.
1226         * elflink.c (bfd_elf_size_dynamic_sections): Also call
1227         `_bfd_elf_link_renumber_dynsyms' if the backend has requested
1228         it.
1229         (bfd_elf_size_dynsym_hash_dynstr): Likewise.
1230
1231 2017-04-26  Maciej W. Rozycki  <macro@imgtec.com>
1232
1233         * elflink.c (bfd_elf_size_dynamic_sections): Only call
1234         `_bfd_elf_link_renumber_dynsyms' after section GC if dynamic
1235         sections have been created.
1236
1237 2017-04-26  Nick Clifton  <nickc@redhat.com>
1238
1239         PR binutils/21431
1240         * compress.c (bfd_init_section_compress_status): Check the return
1241         value from bfd_malloc.
1242
1243 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1244
1245         * elf64-x86-64.c (elf_x86_64_link_hash_entry): Add
1246         no_finish_dynamic_symbol.
1247         (elf_x86_64_link_hash_newfunc): Set no_finish_dynamic_symbol to
1248         0.
1249         (elf_x86_64_allocate_dynrelocs): If a symbol isn't undefined
1250         weak symbol, don't make it dynamic.
1251         (elf_x86_64_relocate_section): If a symbol isn't dynamic in PIC,
1252         set no_finish_dynamic_symbol and generate R_X86_64_RELATIVE
1253         relocation for GOT reference.
1254         (elf_x86_64_finish_dynamic_symbol): Abort if
1255         no_finish_dynamic_symbol isn't 0.
1256
1257 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1258
1259         PR ld/21402
1260         * elf32-i386.c (elf_i386_allocate_dynrelocs): If a symbol isn't
1261         undefined weak symbol, don't make it dynamic.
1262         (elf_i386_relocate_section): If a symbol isn't dynamic in PIC,
1263         set no_finish_dynamic_symbol and generate R_386_RELATIVE
1264         relocation for R_386_GOT32.
1265
1266 2017-04-24  H.J. Lu  <hongjiu.lu@intel.com>
1267
1268         PR ld/21425
1269         * elf32-i386.c (ELF_MAXPAGESIZE): Set to 0x1000 for VxWorks.
1270
1271 2017-04-23  Alan Modra  <amodra@gmail.com>
1272
1273         PR 21414
1274         * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
1275         * elf.c (lcomm_sym): New.
1276         (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
1277         * bfd-in2.h: Regenerate.
1278
1279 2017-04-23  Alan Modra  <amodra@gmail.com>
1280
1281         PR 21412
1282         * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
1283         parameters and comment.
1284         (_bfd_elf_get_reloc_section): Delete.
1285         (_bfd_elf_plt_get_reloc_section): Declare.
1286         * elf.c (_bfd_elf_plt_get_reloc_section, elf_get_reloc_section):
1287         New functions.  Don't blindly skip over assumed .rel/.rela prefix.
1288         Extracted from..
1289         (_bfd_elf_get_reloc_section): ..here.  Delete.
1290         (assign_section_numbers): Call elf_get_reloc_section.
1291         * elf64-ppc.c (elf_backend_get_reloc_section): Define.
1292         * elfxx-target.h (elf_backend_get_reloc_section): Update.
1293
1294 2017-04-23  Alan Modra  <amodra@gmail.com>
1295
1296         PR 21409
1297         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Don't segfault when
1298         no symbols.
1299
1300 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
1301
1302         PR ld/21402
1303         * elf32-i386.c (elf_i386_link_hash_entry): Add
1304         no_finish_dynamic_symbol.
1305         (elf_i386_link_hash_newfunc): Set no_finish_dynamic_symbol to 0.
1306         (elf_i386_allocate_dynrelocs): If a symbol isn't undefined weak
1307         symbol, don't make it dynamic in PIE.
1308         (elf_i386_relocate_section): If a symbol isn't dynamic in PIE,
1309         set no_finish_dynamic_symbol and generate R_386_RELATIVE
1310         relocation for R_386_GOT32
1311         (elf_i386_finish_dynamic_symbol): Abort if no_finish_dynamic_symbol
1312         isn't 0.
1313
1314 2017-04-21  H.J. Lu  <hongjiu.lu@intel.com>
1315
1316         PR ld/19617
1317         PR ld/21086
1318         * elflink.c (elf_link_add_object_symbols): Require
1319         --no-dynamic-linker with -E/--dynamic-list when creating
1320         dynamic sections.
1321
1322 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
1323
1324         * elflink.c (_bfd_elf_symbol_refs_local_p): Always return TRUE
1325         if forced local.
1326
1327 2017-04-20  Maciej W. Rozycki  <macro@imgtec.com>
1328
1329         * elfxx-mips.c (_bfd_mips_elf_final_link): Reorder comment about
1330         dynamic symbol sorting.
1331
1332 2017-04-20  H.J. Lu  <hongjiu.lu@intel.com>
1333
1334         PR ld/21382
1335         * elflink.c (elf_link_add_object_symbols): Preserve
1336         dynamic_ref_after_ir_def when restoring the symbol table for
1337         unneeded dynamic object.
1338
1339 2017-04-19  H.J. Lu  <hongjiu.lu@intel.com>
1340
1341         PR ld/21401
1342         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Don't abort
1343         on on undefined IFUNC symbol in the second PLT.
1344
1345 2017-04-19  Wedson Almeida Filho  <wedsonaf@gmail.com>
1346
1347         * peXXigen.c (pe_print_reloc): Correct chunk_end.
1348
1349 2017-04-19  Alan Modra  <amodra@gmail.com>
1350
1351         * elflink.c (_bfd_elf_adjust_dynamic_symbol): Hide undefweak
1352         or make dynamic for info->dynamic_undefined_weak 0 and 1.
1353         * elf32-ppc.c:Formatting.
1354         (ensure_undefweak_dynamic): Don't make dynamic when
1355         info->dynamic_undefined_weak is zero.
1356         (allocate_dynrelocs): Discard undefweak dyn_relocs for
1357         info->dynamic_undefined_weak.  Discard undef dyn_relocs when
1358         not default visibility.  Discard undef and undefweak
1359         dyn_relocs earlier.
1360         (ppc_elf_relocate_section): Adjust to suit.
1361         * elf64-ppc.c: Formatting.
1362         (ensure_undefweak_dynamic): Don't make dynamic when
1363         info->dynamic_undefined_weak is zero.
1364         (allocate_dynrelocs): Discard undefweak dyn_relocs for
1365         info->dynamic_undefined_weak.  Discard them earlier.
1366
1367 2017-04-17  H.J. Lu  <hongjiu.lu@intel.com>
1368
1369         PR ld/21389
1370         * elflink.c (bfd_elf_size_dynamic_sections): Get soname index
1371         before generating the version definition section.
1372
1373 2017-04-17  Alan Modra  <amodra@gmail.com>
1374
1375         * elflink.c (_bfd_elf_merge_symbol): Undo dynamic linking
1376         state when a regular object file defines a symbol with
1377         incompatible type to that defined by an earlier shared lib.
1378
1379 2017-04-13  Alan Modra  <amodra@gmail.com>
1380
1381         * coffcode.h: Wrap some overly long _bfd_error_handler args.
1382         * elf.c: Likewise.
1383         * elf32-arm.c: Likewise.
1384         * elf32-i386.c: Likewise.
1385         * elf32-mep.c: Likewise.
1386         * elf64-ia64-vms.c: Likewise.
1387         * elf64-x86-64.c: Likewise.
1388         * elflink.c: Likewise.
1389         * elfnn-ia64.c: Likewise.
1390         * elfxx-mips.c: Likewise.
1391
1392 2017-04-13  Alan Modra  <amodra@gmail.com>
1393
1394         * aoutx.h: Use %B and %A in error messages throughout file.
1395         * aout-cris.c: Likewise.
1396         * archive.c: Likewise.
1397         * binary.c: Likewise.
1398         * coff-rs6000.c: Likewise.
1399         * coff-tic4x.c: Likewise.
1400         * coffcode.h: Likewise.
1401         * coffgen.c: Likewise.
1402         * cofflink.c: Likewise.
1403         * coffswap.h: Likewise.
1404         * cpu-arm.c: Likewise.
1405         * elf-eh-frame.c: Likewise.
1406         * elf-m10300.c: Likewise.
1407         * elf.c: Likewise.
1408         * elf32-arc.c: Likewise.
1409         * elf32-arm.c: Likewise.
1410         * elf32-bfin.c: Likewise.
1411         * elf32-frv.c: Likewise.
1412         * elf32-iq2000.c: Likewise.
1413         * elf32-m32c.c: Likewise.
1414         * elf32-microblaze.c: Likewise.
1415         * elf32-nds32.c: Likewise.
1416         * elf32-rl78.c: Likewise.
1417         * elf32-rx.c: Likewise.
1418         * elf32-score.c: Likewise.
1419         * elf32-score7.c: Likewise.
1420         * elf32-sh64.c: Likewise.
1421         * elf32-v850.c: Likewise.
1422         * elf32-vax.c: Likewise.
1423         * elf32-visium.c: Likewise.
1424         * elf64-ia64-vms.c: Likewise.
1425         * elf64-mmix.c: Likewise.
1426         * elf64-sh64.c: Likewise.
1427         * elfcode.h: Likewise.
1428         * elfnn-aarch64.c: Likewise.
1429         * elfnn-ia64.c: Likewise.
1430         * elfxx-mips.c: Likewise.
1431         * hpux-core.c: Likewise.
1432         * ieee.c: Likewise.
1433         * ihex.c: Likewise.
1434         * linker.c: Likewise.
1435         * merge.c: Likewise.
1436         * mmo.c: Likewise.
1437         * oasys.c: Likewise.
1438         * pdp11.c: Likewise.
1439         * peXXigen.c: Likewise.
1440         * rs6000-core.c: Likewise.
1441         * vms-alpha.c: Likewise.
1442         * xcofflink.c: Likewise.
1443
1444 2017-04-13  Alan Modra  <amodra@gmail.com>
1445
1446         * bfd.c (PRINT_TYPE): Define.
1447         (_doprnt): New function.
1448         (error_handler_internal): Use _doprnt.
1449         * coff-arm.c: Put %A and %B arguments to _bfd_error_handler
1450         calls in their natural order, throughout file.
1451         * coff-mcore.c: Likewise.
1452         * coff-ppc.c: Likewise.
1453         * coff-tic80.c: Likewise.
1454         * cofflink.c: Likewise.
1455         * elf-s390-common.c: Likewise.
1456         * elf.c: Likewise.
1457         * elf32-arm.c: Likewise.
1458         * elf32-i386.c: Likewise.
1459         * elf32-m32r.c: Likewise.
1460         * elf32-msp430.c: Likewise.
1461         * elf32-spu.c: Likewise.
1462         * elf64-ia64-vms.c: Likewise.
1463         * elf64-sparc.c: Likewise.
1464         * elf64-x86-64.c: Likewise.
1465         * elflink.c: Likewise.
1466         * elfnn-aarch64.c: Likewise.
1467         * elfnn-ia64.c: Likewise.
1468         * elfxx-mips.c: Likewise.
1469
1470 2017-04-13  Alan Modra  <amodra@gmail.com>
1471
1472         * elf32-arm.c (arm_type_of_stub): Supply missing args to "long
1473         branch veneers" error.  Fix double space and format message.
1474         * elf32-avr.c (avr_add_stub): Do not pass NULL as %B arg.
1475         * elf64-ppc.c (tocsave_find): Supply missing %B arg.
1476
1477 2017-04-13  Alan Modra  <amodra@gmail.com>
1478
1479         * bfd-in2.h: Regenerate.
1480
1481 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
1482
1483         * elf-properties.c (_bfd_elf_parse_gnu_properties): Remove the
1484         extra `\n' in warning/error messages.
1485         * elf32-i386.c (elf_i386_parse_gnu_properties): Likewise.
1486         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
1487
1488 2017-04-11  H.J. Lu  <hongjiu.lu@intel.com>
1489
1490         * elf-properties.c (_bfd_elf_parse_gnu_properties): Ignore
1491         processor-specific properties with generic ELF target vector.
1492
1493 2017-04-10  Qing Zhao  <qing.zhao@oracle.com>
1494
1495         * elf32-sparc.c (elf_backend_fixup_symbol): New.
1496         * elf64-sparc.c (elf_backend_fixup_symbol): New.
1497         * elfxx-sparc.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): New.
1498         (_bfd_sparc_elf_link_hash_entry): Add has_got_reloc and
1499         has_non_got_reloc.
1500         (link_hash_newfunc): Initialize has_got_reloc and
1501         has_non_got_reloc.
1502         (_bfd_sparc_elf_size_dynamic_sections): Set interp to .interp
1503         section.
1504         (_bfd_sparc_elf_copy_indirect_symbol): Copy has_got_reloc and
1505         has_non_got_reloc.
1506         (_bfd_sparc_elf_check_relocs): Set has_got_reloc and
1507         has_non_got_reloc.
1508         (_bfd_sparc_elf_fixup_symbol): New function.
1509         (allocate_dynrelocs): Don't allocate space for dynamic
1510         relocations and discard relocations against resolved undefined
1511         weak symbols in executable.  Don't make resolved undefined weak
1512         symbols in executable dynamic.  Keep dynamic non-GOT/non-PLT
1513         relocation against undefined weak symbols in PIE.
1514         (_bfd_sparc_elf_relocate_section): Don't generate dynamic
1515         relocations against resolved undefined weak symbols in PIE
1516         (_bfd_sparc_elf_finish_dynamic_symbol): Keep PLT/GOT entries
1517         without ynamic PLT/GOT relocations for resolved undefined weak
1518         symbols.
1519         Don't generate dynamic relocation against resolved undefined
1520         weak symbol in executable.
1521         (pie_finish_undefweak_symbol): New function.
1522         (_bfd_sparc_elf_finish_dynamic_sections): Call
1523         pie_finish_undefweak_symbol on all symbols in PIE.
1524         * elfxx-sparc.h (_bfd_sparc_elf_link_hash_table): Add interp.
1525         (_bfd_sparc_elf_fixup_symbol): New function.
1526
1527 2017-04-10  Nick Clifton  <nickc@redhat.com>
1528
1529         * config.bfd: Remove ns32k from obsolete list.
1530
1531 2017-04-10  Alan Modra  <amodra@gmail.com>
1532
1533         PR 21287
1534         * elf.c (special_sections_f): Match .fini_array and .fini_array.*.
1535         (special_sections_i): Likewise for .init_array.
1536         (special_sections_p): Likewise for .preinit_array.
1537
1538 2017-04-07  H.J. Lu  <hongjiu.lu@intel.com>
1539
1540         PR ld/19579
1541         PR ld/21306
1542         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Check
1543         ELF_COMMON_DEF_P for common symbols.
1544         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
1545         * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise.
1546         * elflink.c (_bfd_elf_merge_symbol): Revert commits
1547         202ac193bbbecc96a4978d1ac3d17148253f9b01 and
1548         07492f668d2173da7a2bda3707ff0985e0f460b6.
1549
1550 2017-04-07  Pedro Alves  <palves@redhat.com>
1551
1552         * opncls.c (bfd_get_debug_link_info): Rename to...
1553         (bfd_get_debug_link_info_1): ... this.  Change type of second
1554         parameter to void pointer.  Adjust.
1555         (bfd_get_debug_link_info): Reimplement on top of
1556         bfd_get_debug_link_info_1.
1557         (separate_debug_file_exists, separate_alt_debug_file_exists):
1558         Change type of second parameter to void pointer.  Adjust.
1559         (get_func_type, check_func_type): Change type of second parameter
1560         to void pointer.
1561         (find_separate_debug_file): Add 'func_data' parameter.  Pass it to
1562         the callback functions instead of passing the address of a local.
1563         (bfd_follow_gnu_debuglink): Pass address of unsigned long local to
1564         find_separate_debug_file.
1565         (get_alt_debug_link_info_shim): Change type of second parameter to
1566         void pointer.  Adjust.
1567         (bfd_follow_gnu_debugaltlink): Adjust to pass NULL to
1568         find_separate_debug_file.
1569         (get_build_id_name, bfd_boolean check_build_id_file): Change type
1570         of second parameter to void pointer.  Adjust.
1571         (bfd_follow_build_id_debuglink): Pass address of bfd_build_id
1572         pointer local to find_separate_debug_file.
1573
1574 2017-04-07  Tristan Gingold  <gingold@gingold-Precision-7510>
1575
1576         * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
1577         external symbols with a definition.
1578         (_bfd_coff_gc_mark_extra_sections): Fix typo.
1579
1580 2017-04-07  Alan Modra  <amodra@gmail.com>
1581
1582         * po/SRC-POTFILES.in: Regenerate.
1583
1584 2017-04-05  Alan Modra  <amodra@gmail.com>
1585
1586         * elf64-ppc.c (ppc64_elf_gc_sweep_hook): Support ELFv2 PLT
1587         reference counting.
1588
1589 2017-04-02  Jon Turney  <jon.turney@dronecode.org.uk>
1590
1591         (_bfd_XXi_swap_aouthdr_out): For clarity, use defines rather than
1592         numbers for DataDirectory entry indicies passed to
1593         add_data_entry().
1594
1595 2017-04-04  H.J. Lu  <hongjiu.lu@intel.com>
1596
1597         * elf.c (get_program_header_size): Add a GNU_MBIND segment for
1598         each GNU_MBIND section and align GNU_MBIND section to page size.
1599         (_bfd_elf_map_sections_to_segments): Create a GNU_MBIND
1600         segment for each GNU_MBIND section.
1601         (_bfd_elf_init_private_section_data): Copy sh_info from input
1602         for GNU_MBIND section.
1603
1604 2017-04-03  Palmer Dabbelt  <palmer@dabbelt.com>
1605
1606         * elfnn-riscv.c (GP_NAME): Delete.
1607         (riscv_global_pointer_value): Change GP_NAME to RISCV_GP_SYMBOL.
1608         (_bfd_riscv_relax_lui): Likewise.
1609
1610 2017-04-04  Nick Clifton  <nickc@redhat.com>
1611
1612         PR binutils/21342
1613         * elflink.c (_bfd_elf_define_linkage_sym): Prevent null pointer
1614         dereference.
1615         (bfd_elf_final_link): Only initialize the extended symbol index
1616         section if there are extended symbol tables to list.
1617
1618 2017-04-03  H.J. Lu  <hongjiu.lu@intel.com>
1619
1620         * Makefile.am (BFD32_BACKENDS): Add elf-properties.lo.
1621         (BFD32_BACKENDS_CFILES): Add elf-properties.c.
1622         * configure.ac (elf): Add elf-properties.lo.
1623         * Makefile.in: Regenerated.
1624         * configure: Likewise.
1625         * elf-bfd.h (elf_property_kind): New.
1626         (elf_property): Likewise.
1627         (elf_property_list): Likewise.
1628         (elf_properties): Likewise.
1629         (_bfd_elf_parse_gnu_properties): Likewise.
1630         (_bfd_elf_get_property): Likewise.
1631         (_bfd_elf_link_setup_gnu_properties): Likewise.
1632         (elf_backend_data): Add parse_gnu_properties, merge_gnu_properties
1633         and setup_gnu_properties.
1634         (elf_obj_tdata): Add properties.
1635         * elf-properties.c: New file.
1636         * elf32-i386.c (elf_i386_parse_gnu_properties): New.
1637         (elf_i386_merge_gnu_properties): Likewise.
1638         (elf_backend_parse_gnu_properties): Likewise.
1639         (elf_backend_merge_gnu_properties): Likewise.
1640         * elf64-x86-64.c (elf_x86_64_parse_gnu_properties): Likewise.
1641         (elf_x86_64_merge_gnu_properties): Likewise.
1642         (elf_backend_parse_gnu_properties): Likewise.
1643         (elf_backend_merge_gnu_properties): Likewise.
1644         * elfxx-target.h (elf_backend_merge_gnu_properties): Likewise.
1645         (elf_backend_parse_gnu_properties): Likewise.
1646         (elf_backend_setup_gnu_properties): Likewise.
1647         (elfNN_bed): Add elf_backend_parse_gnu_properties,
1648         elf_backend_merge_gnu_properties and
1649         elf_backend_setup_gnu_properties.
1650
1651 2017-03-30  Pip Cet  <pipcet@gmail.com>
1652
1653         * elf32-wasm32.c: Add relocation code, two relocs.
1654         * reloc.c: Add wasm32 relocations.
1655         * libbfd.h: Regenerate.
1656         * bfd-in2.h: Regenerate.
1657         * bfd/po/bfd.pot: Regenerate.
1658
1659 2017-03-29  Nick Clifton  <nickc@redhat.com>
1660
1661         PR binutils/18025
1662         * coff-bfd.h (struct coff_section_data): Add new fields:
1663         saved_bias and bias.
1664         * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
1665         computed for PE binaries.
1666         * dwarf2.c (scan_unit_for_symbols): Only warn once about each
1667         missing abbrev.
1668
1669 2017-03-28  Hans-Peter Nilsson  <hp@axis.com>
1670
1671         PR ld/16044
1672         * elf32-cris.c (elf_cris_adjust_gotplt_to_got): Adjust BFD_ASSERT
1673         to handle a local symbol with a hash-symbol-entry; without PLT.
1674         Add BFD_ASSERT for an incidental case with GOT entry present.
1675         (cris_elf_check_relocs): Increment PLT refcount only if the symbol
1676         isn't forced-or-set local.
1677
1678 2017-03-27  Pip Cet  <pipcet@gmail.com>
1679
1680         * wasm-module.c: New file to support WebAssembly modules.
1681         * wasm-module.h: New file to support WebAssembly modules.
1682         * doc/webassembly.texi: Start documenting wasm-module.c.
1683         * config.bfd: Add wasm_vec.
1684         * targets.c: Likewise.
1685         * configure.ac: Likewise.
1686         * Makefile.am: Add entries for wasm-module.c.
1687         * Makefile.in: Regenerate.
1688         * configure: Regenerate.
1689         * po/SRC-POTFILES.in: Regenerate.
1690
1691 2017-03-27  Pip Cet  <pipcet@gmail.com>
1692
1693         * cpu-wasm32.c: New file to support wasm32 architecture.
1694         * elf32-wasm32.c: New file to support wasm32 architecture.
1695         * Makefile.am: Add wasm32 architecture.
1696         * archures.c: Likewise.
1697         * config.bfd: Likewise.
1698         * configure.ac: Likewise.
1699         * targets.c: Likewise.
1700         * Makefile.in: Regenerate.
1701         * bfd-in2.h: Regenerate.
1702         * configure: Regenerate.
1703         * po/SRC-POTFILES.in: Regenerate.
1704
1705 2017-03-20  Alan Modra  <amodra@gmail.com>
1706
1707         PR 21266
1708         * elf64-ppc.c (compare_symbols): Stabilize sort.
1709
1710 2017-03-18  Alan Modra  <amodra@gmail.com>
1711
1712         * elf64-ppc.c (struct ppc_link_hash_table): Add
1713         local_ifunc_resolver and maybe_local_ifunc_resolver.
1714         (ppc_build_one_stub): Set flags on emitting dynamic
1715         relocation to ifunc.
1716         (ppc64_elf_relocate_section): Likewise.
1717         (ppc64_elf_finish_dynamic_symbol): Likewise.
1718         (ppc64_elf_finish_dynamic_sections): Error on DT_TEXTREL with
1719         local dynamic relocs to ifuncs.
1720         * elf32-ppc.c (struct ppc_elf_link_hash_table): Add
1721         local_ifunc_resolver and maybe_local_ifunc_resolver.
1722         (ppc_elf_relocate_section): Set flag on emitting dynamic
1723         relocation to ifuncs.
1724         (ppc_elf_finish_dynamic_symbol): Likewise.
1725         (ppc_elf_finish_dynamic_sections): Error on DT_TEXTREL with local
1726         dynamic relocs to ifuncs.
1727
1728 2017-03-13  Nick Clifton  <nickc@redhat.com>
1729
1730         PR binutils/21202
1731         * reloc.c (BFD_RELOC_AARCH64_TLSDESC_LD64_LO12_NC): Rename to
1732         BFD_RELOC_AARCH64_TLSDESC_LD64_LO12.
1733         (BFD_RELOC_AARCH64_TLSDESC_ADD_LO12_NC): Rename to
1734         BFD_RELOC_AARCH64_TLSDESC_ADD_LO12.
1735         * bfd-in2.h: Regenerate.
1736         * libbfd.h: Regenerate.
1737         * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): Update reloc
1738         names.
1739         (IS_AARCH64_TLSDESC_RELOC): Likewise.
1740         (elfNN_aarch64_howto_table): Likewise.
1741         (aarch64_tls_transition_without_check): Likewise.
1742         (aarch64_reloc_got_type): Likewise.
1743         (elfNN_aarch64_final_link_relocate): Likewise.
1744         (elfNN_aarch64_tls_relax): Likewise.
1745         (elfNN_aarch64_relocate_section): Likewise.
1746         (elfNN_aarch64_gc_sweep_hook): Likewise.
1747         (elfNN_aarch64_check_relocs): Likewise.
1748         * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise.
1749         (_bfd_aarch64_elf_resolve_relocation): Likewise.
1750
1751 2017-03-11  Alan Modra  <amodra@gmail.com>
1752
1753         * elf32-ppc.c: Remove ATTRIBUTE_UNUSED throughout when function
1754         parameter is in fact used.  Whitespace fixes.
1755         * elf64-ppc.c: Likewise.
1756
1757 2017-03-09  Sam Thursfield  <sam.thursfield@codethink.co.uk>
1758
1759         * rs6000-core.c (CORE_NEW): Simplify macro when
1760         AIX_CORE_DUMPX_CORE and BFD64 are true to avoid compile warning.
1761
1762 2017-03-07  Alan Modra  <amodra@gmail.com>
1763
1764         PR 21224
1765         PR 20519
1766         * elf64-ppc.c (ppc64_elf_relocate_section): Add missing
1767         dyn_relocs check.
1768
1769 2017-03-05  Alan Modra  <amodra@gmail.com>
1770
1771         * elf-bfd.h (struct eh_cie_fde): Add u.cie.per_encoding_aligned8.
1772         * elf-eh-frame.c (size_of_output_cie_fde): Don't align here.
1773         (next_cie_fde_offset): New function.
1774         (_bfd_elf_parse_eh_frame): Set u.cie.per_encoding_aligned8.
1775         (_bfd_elf_discard_section_eh_frame): Align zero terminator to
1776         four bytes.  Align CIEs to four or eight bytes depending on
1777         per_encoding_aligned8.  Align FDEs according to their encoding.
1778         Pad last FDE to output section alignment.
1779         (_bfd_elf_write_section_eh_frame): Adjust to suit.  Remove
1780         assertion.
1781         * elf64-ppc.c (glink_eh_frame_cie): Delete padding.
1782         (ppc64_elf_size_stubs): Pad glink eh_frame as per elf-eh-frame.c.
1783         (ppc64_elf_finish_dynamic_sections): Adjust to suit.
1784
1785 2017-03-02  Martin Bickel  <binutils@ineranves.de>
1786
1787         PR ld/21212
1788         * elf.c (rewrite_elf_program_header): Do not issue a warning for
1789         empty segments which have a zero filesz, but a non-zero memsz.
1790
1791 2017-03-02  Alan Modra  <amodra@gmail.com>
1792
1793         * elf32-ppc.c (ppc_elf_vle_split16): Correct insn mask typo.
1794
1795 2017-02-28  Alan Modra  <amodra@gmail.com>
1796
1797         * elf64-ppc.c (ppc64_elf_ha_reloc): Revert last change.
1798         (ppc64_elf_relocate_section): Likewise.
1799
1800 2017-02-28  Alan Modra  <amodra@gmail.com>
1801
1802         PR 20995
1803         * elf32-nios2.c (nios2_elf32_relocate_section): Use htab
1804         rather than elf32_nios2_hash_table or elf_hash_table.
1805         (create_got_section): Likewise.
1806         (nios2_elf32_finish_dynamic_symbol): Likewise.
1807         (nios2_elf32_adjust_dynamic_symbol): Likewise.
1808         (nios2_elf32_size_dynamic_sections): Likewise.
1809         (nios2_elf32_check_relocs): Delete dynobj, sgot, and srelgot
1810         vars.  Use htab equivalents directly instead.  Don't create
1811         all dynamic sections on needing just the GOT.  Use a goto
1812         rather than a fall-through with reloc test.  Ensure
1813         htab->dynobj is set when making dynamic sreloc section.
1814         (nios2_elf32_finish_dynamic_sections): Delete dynobj, use htab
1815         equivalent directly instead.  Don't segfault on looking for
1816         .dynamic when dynamic sections have not been created.  Don't
1817         segfault on .got.plt being discarded.
1818         (nios2_elf32_size_dynamic_sections): Delete plt and got vars.
1819         Don't set "relocs" on .rela.plt.  Do handle .sbss.  Delete
1820         fixme and another not so relevant comment.
1821         (nios2_elf_add_symbol_hook): Delete dynobj var.  If not
1822         already set, set hash table dynobj on creating .sbss.
1823
1824 2017-02-28  Alan Modra  <amodra@gmail.com>
1825
1826         * reloc.c (BFD_RELOC_PPC_16DX_HA): New.
1827         * elf64-ppc.c (ppc64_elf_howto_raw <R_PPC64_16DX_HA>): New howto.
1828         (ppc64_elf_reloc_type_lookup): Translate new bfd reloc.
1829         (ppc64_elf_ha_reloc): Correct overflow test on REL16DX_HA.
1830         (ppc64_elf_relocate_section): Likewise.
1831         * elf32-ppc.c (ppc_elf_howto_raw <R_PPC_16DX_HA>): New howto.
1832         (ppc_elf_reloc_type_lookup): Translate new bfd reloc.
1833         (ppc_elf_check_relocs): Handle R_PPC_16DX_HA to pacify gcc.
1834         * libbfd.h: Regenerate.
1835         * bfd-in2.h: Regenerate.
1836
1837 2017-02-28  Alan Modra  <amodra@gmail.com>
1838
1839         * elflink.c (_bfd_elf_create_dynamic_sections): Don't make
1840         dynamic .data.rel.ro read-only.
1841         * elf32-arm.c (elf32_arm_finish_dynamic_symbol): Compare section
1842         rather than section flags when deciding where copy reloc goes.
1843         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
1844         * elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
1845         * elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
1846         * elf32-metag.c (elf_metag_finish_dynamic_symbol): Likewise.
1847         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Likewise.
1848         * elf32-nios2.c (nios2_elf32_finish_dynamic_symbol): Likewise.
1849         * elf32-or1k.c (or1k_elf_finish_dynamic_symbol): Likewise.
1850         * elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Likewise.
1851         * elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
1852         * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol): Likewise.
1853         * elf32-tilepro.c (tilepro_elf_finish_dynamic_symbol): Likewise.
1854         * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Likewise.
1855         * elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
1856         * elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
1857         * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Likewise.
1858         * elfnn-riscv.c (riscv_elf_finish_dynamic_symbol): Likewise.
1859         * elfxx-mips.c (_bfd_mips_vxworks_finish_dynamic_symbol): Likewise.
1860         * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
1861         * elfxx-tilegx.c (tilegx_elf_finish_dynamic_symbol): Likewise.
1862
1863 2017-02-28  Maciej W. Rozycki  <macro@imgtec.com>
1864
1865         * elfxx-mips.c (mips_elf_perform_relocation): Also handle the
1866         `jalr $0, $25' instruction encoding.
1867
1868 2017-02-27  Nick Clifton  <nickc@redhat.com>
1869
1870         PR ld/21180
1871         * elf32-microblaze.c (microblaze_elf_finish_dynamic_symbol): Avoid
1872         generating a seg-fault when encountering a symbol that has been
1873         deleted by garbage collection.
1874
1875 2017-02-25  Alan Modra  <amodra@gmail.com>
1876
1877         * elf32-arc.c (struct dynamic_sections): Delete.
1878         (enum dyn_section_types): Delete.
1879         (dyn_section_names): Delete.
1880         (arc_create_dynamic_sections): Delete.
1881         (elf_arc_finish_dynamic_sections): Don't call the above.  Don't
1882         segfault on discarded .rela.plt section.
1883         (elf_arc_size_dynamic_sections): Formatting.  Don't call
1884         arc_create_dynamic_sections.  Don't allocate memory for sections
1885         handled by the generic linker.  Correct code finding relocs in
1886         read-only sections.  Set SEC_EXCLUDE on zero size .got,
1887         .got.plt, and .dynbss sections.  Do set .interp for pies.
1888
1889 2017-02-24  Andrew Waterman  <andrew@sifive.com>
1890
1891         * elfnn-riscv.c (GP_NAME): New macro.
1892         (riscv_global_pointer_value): Use it.
1893         (_bfd_riscv_relax_lui): If symbol and global pointer are in same
1894         output section, consider only that section's alignment.
1895
1896 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
1897
1898         * elfxx-mips.h (_bfd_mips_relax_section): Remove prototype.
1899         * elfxx-mips.c (_bfd_mips_relax_section): Remove function.
1900         * elf64-mips.c (bfd_elf64_bfd_relax_section): Remove macro.
1901         * elfn32-mips.c (bfd_elf32_bfd_relax_section): Likewise.
1902
1903 2017-02-23  Maciej W. Rozycki  <macro@imgtec.com>
1904
1905         * elfxx-mips.c (mips_elf_calculate_relocation) <R_MIPS_JALR>
1906         <R_MICROMIPS_JALR>: Discard relocation if `cross_mode_jump_p'
1907         or misaligned.
1908
1909 2017-02-23  Alan Modra  <amodra@gmail.com>
1910
1911         PR 20744
1912         * elf32-ppc.c (ppc_elf_howto_raw): Correct dst_mask on all VLE
1913         16D relocations.
1914         (ppc_elf_vle_split16): Correct field mask and shift for 16D relocs.
1915         (ppc_elf_relocate_section): Correct calculation for VLE SDAREL
1916         relocs.
1917
1918 2017-02-22  Maciej W. Rozycki  <macro@imgtec.com>
1919
1920         PR ld/20828
1921         * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version
1922         processing ahead of the call to `elf_gc_sweep_symbol'.
1923
1924 2017-02-22  Nick Clifton  <nickc@redhat.com>
1925
1926         PR binutils/21193
1927         * opncls.c (bfd_create_gnu_debuglink_section): Give the newly
1928         created section 4-byte alignment.
1929
1930 2017-02-22  Alan Modra  <amodra@gmail.com>
1931
1932         * elf64-ppc.c (ppc64_elf_finish_dynamic_sections): Don't segfault
1933         on .got or .plt output section being discarded by script.
1934         * elf32-ppc.c (ppc_elf_finish_dynamic_sections): Likewise.  Move
1935         vxworks splt temp.
1936
1937 2017-02-21  Alan Modra  <amodra@gmail.com>
1938
1939         * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
1940         DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
1941
1942 2017-02-20  Alan Modra  <amodra@gmail.com>
1943
1944         PR 21181
1945         * elflink.c (bfd_elf_final_link): Make DT_REL/DT_RELA zero
1946         if DT_RELSZ/DT_RELASZ is zero.
1947
1948 2017-02-17  Nick Clifton  <nickc@redhat.com>
1949
1950         * compress.c (bfd_get_full_section_contents): Remember to reduce
1951         compressed size by the sizeof the compression header when
1952         decompressing the contents.
1953
1954 2017-02-17  Pedro Alves  <palves@redhat.com>
1955
1956         * srec.c (Chunk): Rename to ...
1957         (_bfd_srec_len): ... this.
1958         (S3Forced): Rename to ...
1959         (_bfd_srec_forceS3): ... this.
1960         * objcopy.c: Adjust all references.
1961
1962 2017-02-17  Pedro Alves  <palves@redhat.com>
1963
1964         * archive.c (bsd_write_armap): Rename to ...
1965         (_bfd_bsd_write_armap): ... this.
1966         (coff_write_armap): Rename to ...
1967         (_bfd_coff_write_armap): ... this.
1968         * libbfd-in.h (bsd_write_armap): Rename to ...
1969         (_bfd_bsd_write_armap): ... this.
1970         (coff_write_armap): Rename to ...
1971         (_bfd_coff_write_armap): ... this.
1972         * aout-target.h, aout-tic30.c: Adjust all users.
1973         * libbfd.h: Regenerate.
1974
1975 2017-02-17  Pedro Alves  <palves@redhat.com>
1976
1977         * bfd-in.h (bfd_read, bfd_write): Adjust to rename.
1978         (warn_deprecated): Rename to ...
1979         (_bfd_warn_deprecated): ... this.
1980         * libbfd.c (warn_deprecated): Rename to ...
1981         (_bfd_warn_deprecated): ... this.
1982         * bfd-in2.h: Regenerate.
1983
1984 2017-02-17  Pedro Alves  <palves@redhat.com>
1985
1986         * bfdio.c (real_ftell): Rename to ...
1987         (_bfd_real_ftell): ... this.
1988         (real_fseek): Rename to ...
1989         (_bfd_real_fseek): ... this.
1990         (real_fopen): Rename to ...
1991         (_bfd_real_fopen): ... this.
1992         * libbfd-in.h (real_ftell): Rename to ...
1993         (_bfd_real_ftell): ... this.
1994         (real_fseek): Rename to ...
1995         (_bfd_real_fseek): ... this.
1996         (real_fopen): Rename to ...
1997         (_bfd_real_fopen): ... this.
1998         * cache.c, dwarf2.c, opncls.c: Adjust all callers.
1999         * libbfd.h: Regenerate.
2000
2001 2017-02-17  Pedro Alves  <palves@redhat.com>
2002
2003         * dwarf2.c, elf-attrs.c, elf32-nds32.c: Adjust all callers.
2004         * libbfd.c (read_unsigned_leb128): Rename to ...
2005         (_bfd_read_unsigned_leb128): ... this.
2006         (read_signed_leb128): Rename to ...
2007         (_bfd_read_signed_leb128): ... this.
2008         (safe_read_leb128): Rename to ...
2009         (_bfd_safe_read_leb128): ... this.
2010         * libbfd-in.h (read_unsigned_leb128): Rename to ...
2011         (_bfd_read_unsigned_leb128): ... this.
2012         (read_signed_leb128): Rename to ...
2013         (_bfd_read_signed_leb128): ... this.
2014         (safe_read_leb128): Rename to ...
2015         (_bfd_safe_read_leb128): ... this.
2016         * libbfd.h: Renegerate.
2017
2018 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
2019
2020         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Perform symbol lookup
2021         before trying to fine matching file and line information.
2022
2023 2017-02-16  Andrew Burgess  <andrew.burgess@embecosm.com>
2024
2025         * dwarf2.c (struct dwarf2_debug): Add orig_bfd member.
2026         (_bfd_dwarf2_slurp_debug_info): If stashed debug information does
2027         not match current bfd, then reload debug information.  Record bfd
2028         we're loading debug info for in the stash.  If we have debug
2029         informatin in the cache then perform section placement before
2030         returning.
2031
2032 2017-02-16  Alan Modra  <amodra@gmail.com>
2033
2034         PR 21000
2035         * elf-bfd.h (struct elf_backend_data): Add no_page_alias.
2036         * elfxx-target.h (elf_backend_no_page_alias): Define.
2037         (elfNN_bed): Init new field.
2038         * elf.c (assign_file_positions_for_load_sections): If no_page_alias
2039         ensure PT_LOAD segment starts on a new page.
2040         * elf32-hppa.c (elf_backend_no_page_alias): Define.
2041
2042 2017-02-16  Alan Modra  <amodra@gmail.com>
2043
2044         PR 21132
2045         * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
2046         if pic.
2047
2048 2017-02-16  Jiong Wang <jiong.wang@arm.com>
2049
2050         * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
2051         * bfd-in2.h: Regenerated.
2052
2053 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
2054
2055         PR ld/21168
2056         * elf32-i386.c (elf_i386_relocate_section): Allow
2057         "lea foo@GOT, %reg" in PIC.
2058
2059 2017-02-15  H.J. Lu  <hongjiu.lu@intel.com>
2060
2061         PR ld/20244
2062         * elf32-i386.c (elf_i386_relocate_section): Properly get IFUNC
2063         symbol name when reporting R_386_GOT32/R_386_GOT32X relocation
2064         error against local IFUNC symbol without a base register for
2065         PIC.
2066
2067 2017-02-15  Maciej W. Rozycki  <macro@imgtec.com>
2068
2069         * elf32-ppc.c (ppc_elf_check_relocs): Use `%H:' rather than
2070         `%P: %H:' with `info->callbacks->einfo'.
2071         (ppc_elf_relocate_section): Likewise.
2072         * elf64-ppc.c (ppc64_elf_check_relocs): Likewise.
2073         (ppc64_elf_edit_toc): Likewise.
2074         (ppc64_elf_relocate_section): Likewise.
2075
2076 2017-02-14  Alan Modra  <amodra@gmail.com>
2077
2078         * elf64-ppc.c (ppc64_elf_gc_mark_dynamic_ref): Support
2079         --gc-keep-exported, and test versioned field of sym rather than
2080         looking for @ in name.
2081
2082 2017-02-13  Palmer Dabbelt  <palmer@dabbelt.com>
2083
2084         * elfnn-riscv.c (riscv_global_pointer_value): Change _gp to
2085         __global_pointer$.
2086
2087 2017-02-13  Nick Clifton  <nickc@redhat.com>
2088
2089         PR binutils/21151
2090         * dwarf2.c (_bfd_dwarf2_find_nearest_line): Check for an invalid
2091         unit length field.
2092
2093 2017-02-07  Andrew Waterman  <andrew@sifive.com>
2094
2095         * elfnn-riscv.c (riscv_elf_finish_dynamic_sections): Only write PLT
2096         entry size if PLT header is written.
2097
2098 2017-02-06  Sheldon Lobo  <sheldon.lobo@oracle.com>
2099
2100         Fix sparc64 dynamic relocation processing to use the dynamic
2101         symbol count.
2102         * elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Use 'dynamic'
2103         to determine if bfd_get_symcount() or bfd_get_dynamic_symcount()
2104         should be used.
2105
2106 2017-02-03  Nick Clifton  <nickc@redhat.com>
2107
2108         PR 21096
2109         * coffcode.h (coff_write_object_contents): Enlarge size of
2110         s_name_buf in order to avoid compile time warning about possible
2111         integer truncation.
2112         * elf32-nds32.c (nds32_elf_ex9_import_table): Mask off lower
2113         32-bits of insn value before printing into buffer.
2114
2115 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2116
2117         * elfxx-mips.c (mips_elf_hash_sort_data): Add
2118         `max_local_dynindx'.
2119         (mips_elf_sort_hash_table): Handle it.
2120         (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local
2121         symbols bump up `max_local_dynindx' rather than
2122         `max_non_got_dynindx'.
2123
2124 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2125
2126         * elfxx-mips.c (mips_elf_hash_sort_data): Convert the
2127         `min_got_dynindx', `max_unref_got_dynindx' and
2128         `max_non_got_dynindx' members to the `bfd_size_type' data type.
2129         (mips_elf_sort_hash_table): Adjust accordingly.
2130
2131 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2132
2133         * elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
2134         to access the hash table.
2135
2136 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2137
2138         * elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
2139         non-NULL `htab' to the beginning.
2140
2141 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
2142
2143         * elflink.c (elf_gc_sweep): Wrap overlong line.
2144
2145 2017-01-30  Maciej W. Rozycki  <macro@imgtec.com>
2146
2147         * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
2148         (_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
2149         * elfxx-mips.c (mips_elf_link_hash_table): Add
2150         `ignore_branch_isa' member.
2151         (mips_elf_perform_relocation): Do not treat an ISA mode mismatch
2152         in branch relocation calculation as an error if
2153         `ignore_branch_isa' has been set.
2154         (_bfd_mips_elf_insn32): Rename to...
2155         (_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
2156         parameter to `insn32' and add an `ignore_branch_isa' parameter.
2157         Handle the new parameter.
2158
2159 2017-01-27  Hans-Peter Nilsson  <hp@axis.com>
2160
2161         * elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
2162         local variable dynobj.
2163
2164         PR ld/20995
2165         * elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
2166         (elf_cris_adjust_dynamic_symbol): Place variables copied into the
2167         executable from read-only sections into sdynrelro.
2168         (elf_cris_finish_dynamic_symbol): Select sreldynrelro for
2169         dynamic relocs in sdynrelro.
2170         (elf_backend_want_dynrelro): Define.
2171
2172 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2173
2174         * config.bfd (*-*-rtemsaout*): Mark as removed.
2175
2176 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2177
2178         * config.bfd (powerpcle-*-rtems*): Do not mark as removed.
2179         (arm-*-rtems*): Move to (arm*-*-eabi*).
2180         (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
2181         (m68-*-rtems*): Move to (m68*-*-elf*).
2182
2183 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
2184
2185         * config.bfd (*-*-rtemscoff*): Mark as removed.
2186
2187 2017-01-24  Maciej W. Rozycki  <macro@imgtec.com>
2188
2189         PR ld/20828
2190         * elflink.c (bfd_elf_record_link_assignment): Revert last
2191         change and don't ever clear `forced_local'.  Set `mark'
2192         unconditionally.
2193         (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
2194         file.
2195         (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
2196         (bfd_elf_size_dynamic_sections): ... here.
2197         * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
2198         and set `mark' instead in `__tls_get_addr_opt' processing.
2199         * elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
2200
2201 2017-01-24  Alan Modra  <amodra@gmail.com>
2202
2203         * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
2204         where dynamic relocs are preferable.  Allow ifunc too.
2205         (ensure_undefweak_dynamic): New function.
2206         (allocate_dynrelocs): Use it here.  Move plt handling last and
2207         don't make symbols dynamic, simplifying loop.  Only make undef
2208         weak symbols with GOT entries dynamic.  Correct condition
2209         for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
2210         comments.  Remove goto.
2211         (ppc_elf_relocate_section): Correct test for using dynamic
2212         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
2213         to suit.  Set up explicit tls_index entries and implicit GOT
2214         tls_index entries resolvable at link time for
2215         __tls_get_addr_opt.  Simplify test to clear mem for prelink.
2216         * elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
2217         (ensure_undefweak_dynamic): New function.
2218         (allocate_dynrelocs): Use it here.  Only make undef weak symbols
2219         with GOT entries dynamic.  Remove unnecessary test of
2220         WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
2221         (ppc64_elf_relocate_section): Correct test for using dynamic
2222         symbol on GOT relocs.  Rearrange test for emitting GOT relocs
2223         to suit.  Set up explicit tls_index entries and implicit GOT
2224         tls_index entries resolvable at link time for __tls_get_addr_opt.
2225         Simplify expression to clear mem for prelink.
2226
2227 2017-01-23  Yury Norov  <ynorov@caviumnetworks.com>
2228
2229         * elfnn-aarch64.c: Fix relaxations for ILP32 mode.
2230
2231 2017-01-20  Jiong Wang <jiong.wang@arm.com>
2232
2233         * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
2234         (elf_backend_hash_symbol): Define.
2235
2236 2017-01-18  Maciej W. Rozycki  <macro@imgtec.com>
2237
2238         PR ld/20828
2239         * elflink.c (bfd_elf_record_link_assignment): Clear any
2240         `forced_local' marking for DSO symbols that are not being
2241         provided.
2242
2243 2017-01-17  Kuan-Lin Chen  <kuanlinchentw@gmail.com>
2244
2245         * elfnn-riscv.c (riscv_elf_object_p): New function.
2246
2247 2017-01-12  H.J. Lu  <hongjiu.lu@intel.com>
2248
2249         PR ld/21038
2250         * elf64-x86-64.c (elf_x86_64_link_hash_table): Add
2251         plt_bnd_eh_frame.
2252         (elf_x86_64_check_relocs): Create .eh_frame section for the
2253         .plt.bnd section.
2254         (elf_x86_64_size_dynamic_sections): Allocate and initialize
2255         .eh_frame section for the .plt.bnd section.
2256         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
2257         for the .plt.bnd section.
2258
2259 2017-01-12  Nick Clifton  <nickc@redhat.com>
2260
2261         PR binutils/20876
2262         * opncls.c (find_separate_debug_file): Add include_dirs
2263         parameter.  Only include the directory part of the bfd's filename
2264         in search paths if include_dirs is true.  Add a couple of extra
2265         locations for looking for debug files.
2266         ( bfd_follow_gnu_debuglink): Update invocation of
2267         find_separate_debug_file.
2268         (bfd_follow_gnu_debugaltlink): Likewise.
2269         (get_build_id): New function: Finds the build-id of the given bfd.
2270         (get_build_id_name): New function: Computes the name of the
2271         separate debug info file for a bfd, based upon its build-id.
2272         (check_build_id_file): New function: Checks to see if a separate
2273         debug info file exists at the given location, and that its
2274         build-id matches that of the original bfd.
2275         (bfd_follow_build_id_debuglink): New function: Finds a separate
2276         debug info file for a given bfd by using the build-id method.
2277         * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
2278         method of locating a separate debug info file before using the
2279         debuglink method.
2280         * bfd-in2.h: Regenerate.
2281
2282 2017-01-11  H.J. Lu  <hongjiu.lu@intel.com>
2283
2284         PR ld/21038
2285         * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
2286         (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
2287         elf_x86_64_eh_frame_plt_got.
2288         (elf_x86_64_size_dynamic_sections): Get unwind info from
2289         elf_x86_64_bnd_arch_bed for the BND PLT.
2290
2291 2017-01-11  Jeremy Soller  <jackpot51@gmail.com>
2292
2293         * config.bfd: Add entries for i686-redox and x86_64-redox.
2294
2295 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2296
2297         * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
2298         to 4 bytes.
2299         * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
2300         .eh_frame section to 4 bytes for x32.
2301         (elf_x86_64_check_relocs): Likewise.
2302
2303 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2304
2305         PR ld/20830
2306         * elf32-i386.c (elf_i386_eh_frame_plt_got): New.
2307         (PLT_GOT_FDE_LENGTH): Likewise.
2308         (elf_i386_plt_layout): Add eh_frame_plt_got and
2309         eh_frame_plt_got_size.
2310         (elf_i386_plt): Updated.
2311         (elf_i386_link_hash_table): Add plt_got_eh_frame.
2312         (elf_i386_check_relocs): Create .eh_frame section for .plt.got.
2313         (elf_i386_size_dynamic_sections): Allocate and initialize
2314         .eh_frame section for .plt.got.
2315         (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
2316         .plt.got.
2317         (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
2318         eh_frame_plt_got_size.
2319         * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
2320         (PLT_GOT_FDE_LENGTH): Likewise.
2321         (elf_x86_64_backend_data): Add eh_frame_plt_got and
2322         eh_frame_plt_got_size.
2323         (elf_x86_64_arch_bed): Updated.
2324         (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
2325         eh_frame_plt_got_size.
2326         (elf_x86_64_nacl_arch_bed): Likewise.
2327         (elf_x86_64_link_hash_table): Add plt_got_eh_frame.
2328         (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
2329         (elf_x86_64_size_dynamic_sections): Allocate and initialize
2330         .eh_frame section for .plt.got.
2331         (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
2332         for .plt.got.
2333
2334 2017-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2335
2336         * elf32-i386.c (elf_i386_size_dynamic_sections): Set
2337         plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
2338
2339 2017-01-09  Nick Clifton  <nickc@redhat.com>
2340
2341         * dwarf2.c (lookup_address_in_function_table): Return early if
2342         there are no functions in the given comp unit, or if the high
2343         address of the last function in the comp unit is less than the
2344         desired address.
2345
2346 2017-01-09  Nick Clifton  <nickc@redhat.com>
2347
2348         PR binutils/21013
2349         * coffgen.c (_bfd_coff_get_external_symbols): Generate an error
2350         message if there are too many symbols to load.
2351
2352 2017-01-04  James Clarke  <jrtc27@jrtc27.com>
2353
2354         * elf64-alpha.c (elf64_alpha_relax_opt_call): Don't set tsec_free
2355         if relocs are cached.
2356
2357 2017-01-03  Rich Felker  <bugdal@aerifal.cx>
2358
2359         PR ld/21017
2360         * elf32-microblaze.c (microblaze_elf_check_relocs): Add an entry
2361         for R_MICROBLAZE_GOTOFF_64.
2362
2363 2017-01-03  Nick Clifton  <nickc@redhat.com>
2364
2365         * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
2366         warning about using a possibly uninitialised variable.
2367
2368 2017-01-02  Alan Modra  <amodra@gmail.com>
2369
2370         * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
2371         (allocate_plt_static, allocate_dynrelocs): Use it.
2372
2373 2017-01-02  Alan Modra  <amodra@gmail.com>
2374
2375         * elf-hppa.h (elf_hppa_fake_sections): Set SHF_INFO_LINK for
2376         .PARISC.unwind section.
2377
2378 2017-01-02  Alan Modra  <amodra@gmail.com>
2379
2380         PR ld/20989
2381         * elfxx-sparc.c (gdop_relative_offset_ok): New function.
2382         (_bfd_sparc_elf_relocate_section): Use it to validate GOT
2383         indirect to GOT pointer relative code edit.
2384
2385 2017-01-02  Alan Modra  <amodra@gmail.com>
2386
2387         Update year range in copyright notice of all files.
2388
2389 For older changes see ChangeLog-2016
2390 \f
2391 Copyright (C) 2017 Free Software Foundation, Inc.
2392
2393 Copying and distribution of this file, with or without modification,
2394 are permitted in any medium without royalty provided the copyright
2395 notice and this notice are preserved.
2396
2397 Local Variables:
2398 mode: change-log
2399 left-margin: 8
2400 fill-column: 74
2401 version-control: never
2402 End: