RISC-V: Don't check ABI flags if no code section.
[external/binutils.git] / bfd / ChangeLog
1 2019-04-02  Jim Wilson  <jimw@sifive.com>
2
3         PR 24389
4         * elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Move read of
5         ELF header flags to after check for ELF object file.  Loop through
6         sections looking for code sections, if none, then skip ABI checks.
7
8 2019-03-30  Andrew Waterman  <andrew@sifive.com>
9
10         * elfnn-riscv.c (_bfd_riscv_relax_call): Only check ARCH_SIZE for
11         rd == X_RA case.
12
13 2019-03-29  Max Filippov  <jcmvbkbc@gmail.com>
14
15         * elf32-xtensa.c (shrink_dynamic_reloc_sections): Add
16         info->export_dynamic to the conditional.
17
18 2019-03-28  Alan Modra  <amodra@gmail.com>
19
20         PR 24392
21         * configure.ac: Invoke AC_CHECK_SIZEOF(int).
22         * configure: Regenerate.
23         * coffgen.c (coff_get_reloc_upper_bound): Replace gcc diagnostic
24         workaround with SIZEOF_LONG vs. SIZEOF_INT check.
25         * elf.c (_bfd_elf_get_reloc_upper_bound): Likewise.
26         * elf64-sparc.c (elf64_sparc_get_reloc_upper_bound): Likewise.
27         * mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
28
29 2019-03-21  Jim Wilson  <jimw@sifive.com>
30
31         PR 24365
32         * elfnn-riscv.c (riscv_elf_relocate_section): For STT_SECTION check,
33         verify sym non-NULL before using.  Add identical check using h.
34
35 2019-03-21  Sudakshina Das  <sudi.das@arm.com>
36
37         * elf-bfd.h (struct elf_backend_data): Add argument to
38         merge_gnu_properties.
39         * elf-properties.c (elf_merge_gnu_properties): Add argument to
40         itself and while calling bed->merge_gnu_properties.
41         (elf_merge_gnu_property_list): Update the calls for
42         elf_merge_gnu_properties.
43         * elfnn-aarch64.c (elfNN_aarch64_merge_gnu_properties): Update handling
44         of --force-bti warning and add argument.
45         * elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Add
46         warning.
47         * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Add argument.
48         * elfxx-x86.h (_bfd_x86_elf_merge_gnu_properties): Likewise in
49         declaration.
50
51 2019-03-20  Sudakshina Das  <sudi.das@arm.com>
52
53         * elfxx-aarch64.c (_bfd_aarch64_elf_link_fixup_gnu_properties): Define.
54         * elfxx-aarch64.h (_bfd_aarch64_elf_link_fixup_gnu_properties): Declare.
55         (elf_backend_fixup_gnu_properties): Define for AArch64.
56
57 2019-03-18  Alan Modra  <amodra@gmail.com>
58
59         PR 24355
60         * elf32-ppc.c (ppc_finish_symbols): Don't call write_glink_stub
61         for local iplt syms with ent->plt.offset == -1.  Remove ineffective
62         attempt at writing glink stubs only once.
63
64 2019-03-16  Alan Modra  <amodra@gmail.com>
65
66         PR 24337
67         * elf.c (_bfd_elf_rela_local_sym): Revert last change.
68         (_bfd_elf_rel_local_sym): Likewise.
69         * elflink.c (elf_link_input_bfd): Use bfd_und_section for
70         section of symbols with unrecognized shndx.
71
72 2019-03-15  H.J. Lu  <hongjiu.lu@intel.com>
73
74         PR ld/24267
75         * coffgen.c (_bfd_coff_section_already_linked): Skip discarded
76         section.
77         * cofflink.c (coff_link_add_symbols): Check for symbols defined
78         in discarded section.
79
80 2019-03-15  Alan Modra  <amodra@gmail.com>
81
82         PR 24339
83         * elflink.c (elf_link_add_object_symbols): Bail out on a local
84         symbol after globals if elf_bad_symtab is not set.
85
86 2019-03-15  Alan Modra  <amodra@gmail.com>
87
88         PR 24337
89         * elf.c (_bfd_elf_rela_local_sym): Don't segfault on NULL sec.
90         (_bfd_elf_rel_local_sym): Likewise.
91
92 2019-03-15  Alan Modra  <amodra@gmail.com>
93
94         PR 24336
95         * elflink.c (elf_link_read_relocs_from_section): Handle fuzzed
96         object files with sh_size not a multiple of sh_entsize.
97
98 2019-03-15  H.J. Lu  <hongjiu.lu@intel.com>
99
100         PR ld/24338
101         * elf64-x86-64.c (elf_x86_64_relocate_section): Check for corrupt
102         input with bad relocation.
103
104 22019-03-15  H.J. Lu  <hongjiu.lu@intel.com>
105
106         * elf64-x86-64.c (elf_x86_64_relocate_section): Re-indent.
107
108 2019-03-14  Nick Clifton  <nickc@redhat.com>
109
110         PR 24334
111         * dwarf2.c (struct dwarf2_debug): Add sec_vma_count field.
112         (save_section_vma): Initialise field to the number of entries in
113         the sec_vma table.
114         (section_vma_same): Check that the number of entries in the
115         sec_vma table matches the number of sections in the bfd.
116
117 2019-03-14  Nick Clifton  <nickc@redhat.com>
118
119         PR 24333
120         * elflink.c (_bfd_elf_add_default_symbol): Add a check for a NULL
121         section owner pointer when adding the default symbol.
122
123 2019-03-14  Nick Clifton  <nickc@redhat.com>
124
125         PR 24332
126         * elflink.c (elf_link_add_object_symbols): Add new local variable
127         extversym_end.  Initialise it to point to the end of the version
128         symbol table, if present.  Check it when initialising and updating
129         the ever pointer.
130
131 2019-03-13  Sudakshina Das  <sudi.das@arm.com>
132
133         * elfnn-aarch64.c (PLT_PAC_ENTRY_SIZE, PLT_PAC_SMALL_ENTRY_SIZE): New.
134         (PLT_BTI_PAC_ENTRY_SIZE, PLT_BTI_PAC_SMALL_ENTRY_SIZE): New.
135         (setup_plt_values): Account for PAC or PAC and BTI enabled PLTs.
136         (elfNN_aarch64_size_dynamic_sections): Add checks for PLT_BTI_PAC
137         and PLT_PAC_PLT.
138         (elfNN_aarch64_finish_dynamic_sections): Account for PLT_BTI_PAC.
139         (get_plt_type): Add case for DT_AARCH64_PAC_PLT.
140         (elfNN_aarch64_plt_sym_val): Add cases for PLT_BTI_PAC and PLT_PAC.
141
142 2019-03-13  Sudakshina Das  <sudi.das@arm.com>
143             Szabolcs Nagy  <szabolcs.nagy@arm.com>
144
145         * bfd-in.h (aarch64_plt_type, aarch64_enable_bti_type): New.
146         (aarch64_bti_pac_info): New.
147         (bfd_elf64_aarch64_set_options): Add aarch64_bti_pac_info argument.
148         (bfd_elf32_aarch64_set_options): Likewise.
149         * bfd-in2.h: Regenerate
150         * elfnn-aarch64.c (PLT_BTI_ENTRY_SIZE): New.
151         (PLT_BTI_SMALL_ENTRY_SIZE, PLT_BTI_TLSDESC_ENTRY_SIZE): New.
152         (elfNN_aarch64_small_plt0_bti_entry): New.
153         (elfNN_aarch64_small_plt_bti_entry): New.
154         (elfNN_aarch64_tlsdesc_small_plt_bti_entry): New.
155         (elf_aarch64_obj_tdata): Add no_bti_warn and plt_type fields.
156         (elf_aarch64_link_hash_table): Add plt0_entry, plt_entry and
157         tlsdesc_plt_entry_size fields.
158         (elfNN_aarch64_link_hash_table_create): Initialise the new fields.
159         (setup_plt_values): New helper function.
160         (bfd_elfNN_aarch64_set_options): Use new bp_info to set plt sizes and
161         bti enable type.
162         (elfNN_aarch64_allocate_dynrelocs): Use new size members instead of
163         fixed macros.
164         (elfNN_aarch64_size_dynamic_sections): Likewise and add checks.
165         (elfNN_aarch64_create_small_pltn_entry): Use new generic pointers
166         to plt stubs instead of fixed ones and update filling them according
167         to the need for bti.
168         (elfNN_aarch64_init_small_plt0_entry): Likewise.
169         (elfNN_aarch64_finish_dynamic_sections): Likewise.
170         (get_plt_type, elfNN_aarch64_get_synthetic_symtab): New.
171         (elfNN_aarch64_plt_sym_val): Update size accordingly.
172         (elfNN_aarch64_link_setup_gnu_properties): Set up plts if BTI GNU NOTE
173         is set.
174         (bfd_elfNN_get_synthetic_symtab): Define.
175         (elfNN_aarch64_merge_gnu_properties): Give out warning with --force-bti
176         and mising BTI NOTE SECTION.
177
178
179 2019-03-13  Sudakshina Das  <sudi.das@arm.com>
180
181         * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Exclude
182         linker created inputs from merge.
183         * elfnn-aarch64.c (struct elf_aarch64_obj_tdata): Add field for
184         GNU_PROPERTY_AARCH64_FEATURE_1_AND properties.
185         (elfNN_aarch64_link_setup_gnu_properties): New.
186         (elfNN_aarch64_merge_gnu_properties): New.
187         (elf_backend_setup_gnu_properties): Define for AArch64.
188         (elf_backend_merge_gnu_properties): Likewise.
189         * elfxx-aarch64.c (_bfd_aarch64_elf_link_setup_gnu_properties): Define.
190         (_bfd_aarch64_elf_parse_gnu_properties): Define.
191         (_bfd_aarch64_elf_merge_gnu_properties): Define.
192         * elfxx-aarch64.h (_bfd_aarch64_elf_link_setup_gnu_properties): Declare.
193         (_bfd_aarch64_elf_parse_gnu_properties): Declare.
194         (_bfd_aarch64_elf_merge_gnu_properties): Declare.
195         (elf_backend_parse_gnu_properties): Define for AArch64.
196
197 2019-03-13  H.J. Lu  <hongjiu.lu@intel.com>
198
199         PR ld/24322
200         * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Properly
201         merge GNU_PROPERTY_X86_FEATURE_1_[IBT|SHSTK].
202
203 2019-03-12  Alan Modra  <amodra@gmail.com>
204
205         * coffcode.h (buy_and_read): Delete unnecessary forward decl.  Add
206         nmemb parameter.  Use bfd_alloc2.
207         (coff_slurp_line_table): Use bfd_alloc2.  Update buy_and_read calls.
208         Delete assertion.
209         (coff_slurp_symbol_table): Use bfd_alloc2 and bfd_zalloc2.
210         (coff_slurp_reloc_table): Use bfd_alloc2.  Update buy_and_read calls.
211         * coffgen.c (coff_get_reloc_upper_bound): Ensure size calculation
212         doesn't overflow.
213         * elf.c (bfd_section_from_shdr): Use bfd_zalloc2.  Style fix.
214         (assign_section_numbers): Style fix.
215         (swap_out_syms): Use bfd_malloc2.
216         (_bfd_elf_get_reloc_upper_bound): Ensure size calculation doesn't
217         overflow.
218         (_bfd_elf_make_empty_symbol): Style fix.
219         (elfobj_grok_stapsdt_note_1): Formatting.
220         * elfcode.h (elf_object_p): Use bfd_alloc2.
221         (elf_write_relocs, elf_write_shdrs_and_ehdr): Likewise.
222         (elf_slurp_symbol_table): Use bfd_zalloc2.
223         (elf_slurp_reloc_table): Use bfd_alloc2.
224         (_bfd_elf_bfd_from_remote_memory): Use bfd_malloc2.
225         * elf64-sparc (elf64_sparc_get_reloc_upper_bound): Ensure
226         size calculation doesn't overflow.
227         (elf64_sparc_get_dynamic_reloc_upper_bound): Likewise.
228         * mach-o.c (bfd_mach_o_get_reloc_upper_bound): Likewise.
229         * pdp11.c (get_reloc_upper_bound): Copy aoutx.h version.
230
231 2019-03-08  Alan Modra  <amodra@gmail.com>
232
233         PR 24311
234         * merge.c (merge_strings): Return secinfo.  Don't pad section
235         to alignment here.
236         (_bfd_merge_sections): Pad section to alignment here, if input
237         sections contributing to merged output all pad to alignment.
238         Formatting.
239
240 2019-03-06  Nick Clifton  <nickc@redhat.com>
241
242         * dwarf2.c (_bfd_dwarf2_find_symbol_bias): Check for a NULL symbol
243         table pointer.
244         * coffgen.c (coff_find_nearest_line_with_names): Do not call
245         _bfd_dwarf2_find_symbol_bias if there is no symbol table available.
246
247 2019-03-01  Andreas Krebbel  <krebbel@linux.ibm.com>
248
249         This reverts commit 5a12586d44fa8d5dfc74cbca4f2f36a273a16335.
250         2019-01-14  Maamoun Tarsha  <maamountk@hotmail.com>
251
252         PR 20113
253         * elf32-s390.c (allocate_dynrelocs): Update comment.
254
255 2019-02-28  Tamar Christina  <tamar.christina@arm.com>
256
257         * elf-eh-frame.c (_bfd_elf_write_section_eh_frame): Correct CIE parse.
258
259 2019-02-28  Nick Clifton  <nickc@redhat.com>
260
261         PR 24273
262         * elf.c (bfd_elf_string_from_elf_section): Check for a string
263         section that is not NUL terminated.
264
265 2019-02-27  H.J. Lu  <hongjiu.lu@intel.com>
266
267         PR ld/24276
268         * elf64-x86-64.c (elf_x86_64_check_relocs): Skip symbol defined
269         by linker when checking copy reloc on protected symbol.
270
271 2019-02-24  Alan Modra  <amodra@gmail.com>
272
273         PR 24144
274         * pdp11.c (set_section_contents): Revert 2015-02-24 change.
275
276 2019-02-20  Eric Tsai  <erictsai@cadence.com>
277
278         * elf32-xtensa.c (is_resolvable_asm_expansion): Scan output
279         sections between the call site and call destination and adjust
280         call distance by the largest alignment.
281
282 2019-02-20  Alan Hayward  <alan.hayward@arm.com>
283
284         * elf-bfd.h (elfcore_write_aarch_pauth): Add declaration.
285         * elf.c (elfcore_grok_aarch_pauth): New function.
286         (elfcore_grok_note): Check for NT_ARM_PAC_MASK.
287         (elfcore_write_aarch_pauth): New function.
288         (elfcore_write_register_note): Check for AArch64 pauth section.
289
290 2019-02-20  Alan Modra  <amodra@gmail.com>
291
292         PR 24225
293         * elf32-nios2.c (nios2_elf32_relocate_section): Check asprintf
294         return value.
295
296 2019-02-20  Michael Roitzsch  <reactorcontrol@icloud.com>
297
298         * configure.ac (SHARED_LIBADD): Add -liberty -lintl for all
299         Darwin hosts, not just or1k.
300         * configure: Regenerate.
301
302 2019-02-20  Alan Modra  <amodra@gmail.com>
303
304         PR 24236
305         * archive64.c (_bfd_archive_64_bit_slurp_armap): Move code adding
306         sentinel NUL to string buffer nearer to loop where it is used.
307         Don't go past sentinel when scanning strings, and don't write
308         NUL again.
309         * archive.c (do_slurp_coff_armap): Simplify string handling to
310         archive64.c style.
311
312 2019-02-19  Alan Modra  <amodra@gmail.com>
313
314         PR 24235
315         * pei-x86_64.c (pex64_bfd_print_pdata_section): Correct checks
316         attempting to prevent read past end of section.
317
318 2019-02-18  Alan Modra  <amodra@gmail.com>
319
320         PR 24225
321         * elf32-nios2.c (nios2_elf32_relocate_section): Use asprintf and
322         PRIx64 to generate warning messages.  Print local sym names too.
323
324 2019-02-09  Vineet Gupta  <vgupta@synopsys.com>
325
326         * elf32-arc (INIT_SYM_STRING): Delete.
327         (FINI_SYM_STRING): Likewise.
328         (init_str): Likewise.
329         (fini_str): Likewise.
330
331 2019-02-08  Alan Modra  <amodra@gmail.com>
332
333         * elf32-ppc.c (ppc_elf_relocate_section): Add %X to "unsupported
334         for bss-plt" warning to make it an error.
335
336 2019-02-07  Eric Botcazou  <ebotcazou@adacore.com>
337
338         PR ld/18841
339         * elf32-sparc.c (elf32_sparc_reloc_type_class): Return
340         reloc_class_ifunc for ifunc symbols.
341         * elf64-sparc.c (elf64_sparc_reloc_type_class): Likewise.
342
343 2019-02-07  Eric Botcazou  <ebotcazou@adacore.com>
344
345         * elf32-visium.c (visium_elf_howto_parity_reloc): Minor tweak.
346         <R_VISIUM_PC16>: Use explicit range test to detect an overflow.
347
348 2019-02-07  Nick Clifton  <nickc@redhat.com>
349
350         * config.bfd: Move the powerpc-lynxos and powerpc-windiss targets
351         into the definitely obsolete list.
352
353 2019-02-05  H.J. Lu  <hongjiu.lu@intel.com>
354
355         PR ld/24151
356         * elf64-x86-64.c (elf_x86_64_need_pic): Check
357         SYMBOL_DEFINED_NON_SHARED_P instead of def_regular.
358         (elf_x86_64_relocate_section): Move PIC check for PC-relative
359         relocations to ...
360         (elf_x86_64_check_relocs): Here.
361         (elf_x86_64_finish_dynamic_symbol): Use SYMBOL_DEFINED_NON_SHARED_P
362         to check if a symbol is defined in a non-shared object.
363         * elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): New.
364
365 2019-01-21  Sergio Durigan Junior  <sergiodj@redhat.com>
366
367         * elf32-arm.c (elf32_arm_final_link_relocate): Use 'llabs' instead
368         of 'labs' (and fix GCC warning).
369
370 2019-01-25  Nick Clifton  <nickc@redhat.com>
371
372         * po/ru.po: Updated Russian translation.
373
374 2019-01-23  Nick Clifton  <nickc@redhat.com>
375
376         * po/fr.po: Updated French translation.
377
378 2019-01-21  Nick Clifton  <nickc@redhat.com>
379
380         * po/pt.po: Updated Portuguese translation.
381         * po/uk.po: Updated Ukranian translation.
382
383 2019-01-21  Yuri Chornoivan  <yurchor@ukr.net>
384
385         PR 24108
386         * elf32-nds32.c (nds32_relocate_section): Add space between words
387         in error message.
388         * elfnn-riscv.c (riscv_version_mismatch): Fix spelling mistake in
389         error message.
390         (riscv_i_or_e_p): Likewise.
391         (riscv_merge_arch_attr_info): Likewise.
392
393 2019-01-19  Nick Clifton  <nickc@redhat.com>
394
395         * version.m4: Reset to 2.32.51
396         * configure: Regenerate.
397         * po/bfd.pot: Regenerate.
398
399 2018-06-24  Nick Clifton  <nickc@redhat.com>
400
401         2.32 branch created.
402
403 2019-01-16  Kito Cheng  <kito@andestech.com>
404
405         * elf-attrs.c (vendor_obj_attr_size): Return 0 if size is 0 even
406         for OBJ_ATTR_PROC.
407
408 2019-01-16  Kito Cheng  <kito@andestech.com>
409             Nelson Chu  <nelson@andestech.com>
410
411         * elfnn-riscv.c (in_subsets): New.
412         (out_subsets): Likewise.
413         (merged_subsets): Likewise.
414         (riscv_std_ext_p): Likewise.
415         (riscv_non_std_ext_p): Likewise.
416         (riscv_std_sv_ext_p): Likewise.
417         (riscv_non_std_sv_ext_p): Likewise.
418         (riscv_version_mismatch): Likewise.
419         (riscv_i_or_e_p): Likewise.
420         (riscv_merge_std_ext): Likewise.
421         (riscv_merge_non_std_and_sv_ext): Likewise.
422         (riscv_merge_arch_attr_info): Likewise.
423         (riscv_merge_attributes): Likewise.
424         (_bfd_riscv_elf_merge_private_bfd_data): Merge attribute.
425
426         * elfnn-riscv.c (riscv_elf_obj_attrs_arg_type): New.
427         (elf_backend_obj_attrs_vendor): Define.
428         (elf_backend_obj_attrs_section_type): Likewise.
429         (elf_backend_obj_attrs_section): Likewise.
430         (elf_backend_obj_attrs_arg_type): Define as
431         riscv_elf_obj_attrs_arg_type.
432         * elfxx-riscv.c (riscv_estimate_digit): New.
433         (riscv_estimate_arch_strlen1): Likewise.
434         (riscv_estimate_arch_strlen): Likewise.
435         (riscv_arch_str1): Likewise.
436         (riscv_arch_str): Likewise.
437         * elfxx-riscv.h (riscv_arch_str): Declare.
438
439 2019-01-14  John Darrington <john@darrington.wattle.id.au>
440
441         * bfd-in2.h [BFD_RELOC_S12Z_OPR]: New reloc.
442         * libbfd.h: regen.
443         * elf32-s12z.c (eld_s12z_howto_table): R_S12Z_OPR takes non zero
444         source field.  (md_apply_fix): Apply final fix
445         to BFD_RELOC_S12Z_OPR.
446         * reloc.c[BFD_RELOC_S12Z_OPR]: New reloc.
447
448 2019-01-14  Maamoun Tarsha  <maamountk@hotmail.com>
449
450         PR 20113
451         * elf32-s390.c (allocate_dynrelocs): Update comment.
452
453 2019-01-09  Andrew Paprocki  <andrew@ishiboo.com>
454
455         * warning.m4: Adjust egrep pattern for non-GNU compilers.
456         * configure: Regenerate.
457
458 2019-01-08  Alan Modra  <amodra@gmail.com>
459
460         PR 23699
461         PR 24065
462         * ihex.c (ihex_write_object_contents): Properly check 32-bit
463         address range.
464
465 2019-01-05  Yoshinori Sato <ysato@users.sourceforge.jp>
466
467         * bfd/archures.c: Add bfd_mach_rx_v2 and bfd_mach_rx_v3.
468         * bfd/bfd-in2.h: Regenerate.
469         * bfd/cpu-rx.c (arch_info_struct): Add RXv2 and RXv3 entry.
470         * bfd/elf32-rx.c (elf32_rx_machine): Add RXv2 and RXv3 support.
471
472 2019-01-04  Lifang Xia  <lifang_xia@c-sky.com>
473
474         * config.bfd (csky-*-elf* | csky-*-linux*): Modify the csky
475         default target, little endian target is more suitable.
476
477 2019-01-04  Alan Modra  <amodra@gmail.com>
478
479         PR 24061
480         PR 21786
481         * coff-rs6000.c (GET_VALUE_IN_FIELD): Add base parameter and
482         adjust all callers.
483         (EQ_VALUE_IN_FIELD): Likewise.
484         * coff64-rs6000.c (GET_VALUE_IN_FIELD): Likewise.
485
486 2019-01-01  Alan Modra  <amodra@gmail.com>
487
488         Update year range in copyright notice of all files.
489
490 For older changes see ChangeLog-2018
491 \f
492 Copyright (C) 2019 Free Software Foundation, Inc.
493
494 Copying and distribution of this file, with or without modification,
495 are permitted in any medium without royalty provided the copyright
496 notice and this notice are preserved.
497
498 Local Variables:
499 mode: change-log
500 left-margin: 8
501 fill-column: 74
502 version-control: never
503 End: