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