Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
Don't set version info on unversioned symbols when seeing a hidden
versioned symbol after an unversioned definition and the default
versioned symbol.
bfd/
PR ld/28348
* elflink.c (elf_link_add_object_symbols): Don't set version info
on unversioned symbols.
ld/
PR ld/28348
* testsuite/ld-elf/pr28348.rd: New file.
* testsuite/ld-elf/pr28348.t: Likewise.
* testsuite/ld-elf/pr28348a.c: Likewise.
* testsuite/ld-elf/pr28348b.c: Likewise.
* testsuite/ld-elf/pr28348c.c: Likewise.
* testsuite/ld-elf/shared.exp: Run PR ld/28348 tests.
|
|
|
|
|
|
There are two main reasons for this patch,
* In the past we had two extension tables, one is used to record all
supported extensions in bfd/elfxx-riscv.c, another is used to get the
default extension versions in gas/config/tc-riscv.c. It is hard to
maintain lots of tables in different files, but in fact we can merge
them into just one table. Therefore, we now define many riscv_supported_std*
tables, which record names and versions for all supported extensions.
We not only use these tables to initialize the riscv_ext_order, but
also use them to get the default versions of extensions, and decide if
the extensions should be enbaled by default.
* We add a new filed `default_enable' for the riscv_supported_std* tables,
to decide if the extension should be enabled by default. For now if the
`default_enable' field of the extension is set to EXT_DEFAULT, then we
should enable the extension when the -march and elf architecture attributes
are not set. In the future, I suppose the `default_enable' can be set
to lots of EXT_<VENDOR>, each vendor can decide to open which extensions,
when the target triple of vendor is chosen.
The elf/linux regression tests of riscv-gnu-toolchain are passed.
bfd/
* elfnn-riscv.c (cpu-riscv.h): Removed sine it is included in
bfd/elfxx-riscv.h.
(riscv_merge_std_ext): Updated since the field of rpe is changed.
* elfxx-riscv.c (cpu-riscv.h): Removed.
(riscv_implicit_subsets): Added implicit extensions for g.
(struct riscv_supported_ext): Used to be riscv_ext_version. Moved
from gas/config/tc-riscv.c, and added new field `default_enable' to
decide if the extension should be enabled by default.
(EXT_DEFAULT): Defined for `default_enable' field.
(riscv_supported_std_ext): It used to return the supported standard
architecture string, but now we move ext_version_table from
gas/config/tc-riscv.c to here, and rename it to riscv_supported_std_ext.
Currently we not only use the table to initialize riscv_ext_order, but
also get the default versions of extensions, and decide if the extensions
should be enbaled by default.
(riscv_supported_std_z_ext): Likewise, but is used for z* extensions.
(riscv_supported_std_s_ext): Likewise, but is used for s* extensions.
(riscv_supported_std_h_ext): Likewise, but is used for h* extensions.
(riscv_supported_std_zxm_ext): Likewise, but is used for zxm* extensions.
(riscv_all_supported_ext): Includes all supported extension tables.
(riscv_known_prefixed_ext): Updated.
(riscv_valid_prefixed_ext): Updated.
(riscv_init_ext_order): Init the riscv_ext_order table according to
riscv_supported_std_ext.
(riscv_get_default_ext_version): Moved from gas/config/tc-riscv.c.
Get the versions of extensions from riscv_supported_std* tables.
(riscv_parse_add_subset): Updated.
(riscv_parse_std_ext): Updated.
(riscv_set_default_arch): Set the default subset list according to
the default_enable field of riscv_supported_*ext tables.
(riscv_parse_subset): If the input ARCH is NULL, then we call
riscv_set_default_arch to set the default subset list.
* elfxx-riscv.h (cpu-riscv.h): Included.
(riscv_parse_subset_t): Removed get_default_version field, and added
isa_spec field to replace it.
(extern riscv_supported_std_ext): Removed.
gas/
* (bfd/cpu-riscv.h): Removed.
(struct riscv_ext_version): Renamed and moved to bfd/elfxx-riscv.c.
(ext_version_table): Likewise.
(riscv_get_default_ext_version): Likewise.
(ext_version_hash): Removed.
(init_ext_version_hash): Removed.
(riscv_set_arch): Updated since the field of rps is changed. Besides,
report error when the architecture string is empty.
(riscv_after_parse_args): Updated.
|
|
|
|
|
|
Noticed in passing that we used 'sizeof (char **)' when calculating
the size of a list of 'char *' pointers. Of course, this isn't really
going to make a difference anywhere, but we may as well be correct.
There should be no user visible changes after this commit.
bfd/ChangeLog:
* archures.c (bfd_arch_list): Use 'char *' instead of 'char **'
when calculating space for a string list.
|
|
Remove duplicate entry in bfd_ft32_arch and bfd_rx_arch.
Fix printable name for bfd_mach_n1: "nh1" -> "n1".
PR 28336
* cpu-ft32.c (arch_info_struct): Remove "ft32" entry.
* cpu-rx.c (arch_info_struct): Remove "rx" entry.
* cpu-nds32.c (bfd_nds32_arch): Fix printable name for bfd_mach_n1
entry.
|
|
PR 28328
* archive.c (bfd_ar_hdr_from_filesystem): Don't use bfd_set_input_error
here, our caller will do that.
|
|
|
|
When statically linking, it can arrive to an undefined weak symbol of
which its value cannot be determined. However, we are having pieces of
code which doesn't take this situation into account, leading to access
a structure which may not be initialized. Fix this situation and add a
test.
bfd/
xxxx-xx-xx Cupertino Miranda <cmiranda@synopsys.com>
Claudiu Zissulescu <claziss@synopsys.com>
* arc-got.h (arc_static_sym_data): New structure.
(get_static_sym_data): New function.
(relocate_fix_got_relocs_for_got_info): Move the computation fo
symbol value and section to above introduced function, and use
this new function.
ld/testsuite/
xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com>
* ld-arc/got-weak.d: New file.
* ld-arc/got-weak.s: Likewise.
Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
fix
|
|
|
|
* config.bfd: Correct m68-*-*bsd* obsolete target match.
|
|
|
|
|
|
|
|
* elf32-ppc.c (offset_in_range): New function.
(ppc_elf_vle_split16): Sanity check r_offset before accessing
section contents. Return status.
(ppc_elf_relocate_section): Sanity check r_offset before
accessing section contents. Don't segfault on NULL howto.
|
|
|
|
|
|
This hardens the powerpc64 linker code transformations.
* elf64-ppc.c (is_8byte_reloc, offset_in_range): New functions.
(ppc64_elf_relocate_section): Sanity check r_offset before
accessing section contents for various code transformations.
|
|
_bfd_elf_ppc_at_tprel_transform doesn't handle prefix instructions,
and I'm not inclined to implement code editing for them.
* elf64-ppc.c (ppc64_elf_relocate_section): Don't attempt tprel
transform for R_PPC64_TPREL34.
|
|
|
|
bfd * elf.c (elfcore_make_memtag_note_section): New function.
(elfcore_grok_note): Handle NT_MEMTAG note types.
binutils* readelf.c (get_note_type): Handle NT_MEMTAG note types.
include * elf/common.h (NT_MEMTAG): New constant.
(NT_MEMTAG_TYPE_AARCH_MTE): New constant.
|
|
xtensa binary.
PR 28305
* elf32-xtensa.c (elf_xtensa_do_reloc): Add check for put of range
reloc.
|
|
RISC-V binary.
PR 28303
* elfxx-riscv.c (riscv_elf_add_sub_reloc): Add check for out of
range relocs.
|
|
Adds missing bfd_reloc_offset_in_range checks to various relocation
special_functions.
PR 28307
* elf32-ppc.c (ppc_elf_addr16_ha_reloc): Range check reloc offset.
* elf64-ppc.c (ppc64_elf_ha_reloc, ppc64_elf_brtaken_reloc): Likewise.
(ppc64_elf_toc64_reloc, ppc64_elf_prefix_reloc): Likewise.
|
|
|
|
PR 28304
* elfxx-score7.c (score_elf_gprel15_reloc): If there is no output bfd
treat the reloc as undefined.
|
|
|
|
|
|
|
|
* elf64-alpha.c (elf64_alpha_relax_with_lituse): Avoid UB.
|
|
|
|
patches we have been grooming and maintaining for quite a few years over on git.haiku-os.org. All of these architectures are working and most have been stable for quite some time.
|
|
.symtab_shndx section contents is an array, one entry for each symbol
in .symtab, present when the number of symbols exceeds a little less
than 64k. Since the mapping is 1-1 with symbols there is no need to
keep both dest_index and destshndx_index in elf_sym_strtab. Instead,
just make sure that the shndx pointers to the swap functions are kept
NULL when .symtab_shndx does not exist. Also, strtabcount in the
linker's elf hash table is incremented in lock-step with the output
symcount, so that can disappear too.
|
|
This defines a couple of macros used to avoid ubsan complaints about
calculations involving NULL pointers. PTR_ADD should be used in the
case where it is known that the offset is always zero with a NULL
pointer, and you'd like to know if a non-zero offset is ever used.
NPTR_ADD should be rarely used, but is defined for cases where a
non-zero offset is expected and should be ignored if the pointer is
NULL.
bfd/
* bfd-in.h (PTR_ADD, NPTR_ADD): Define.
* bfd-in2.h: Regenerate.
* elf-eh-frame.c (adjust_eh_frame_local_symbols): Avoid NULL
pointer calculations.
* elflink.c (_bfd_elf_strip_zero_sized_dynamic_sections): Likewise.
(bfd_elf_add_dt_needed_tag, elf_finalize_dynstr): Likewise.
(elf_link_add_object_symbols, elf_link_input_bfd): Likewise.
(bfd_elf_final_link, bfd_elf_gc_record_vtinherit): Likewise.
binutils/
* objdump.c (disassemble_section): Use PTR_ADD for rel_ppend.
|
|
|
|
|
|
|
|
Similar to ARM/AARCH64, we add mapping symbols in the symbol table,
to mark the start addresses of data and instructions. The $d means
data, and the $x means instruction. Then the disassembler uses these
symbols to decide whether we should dump data or instruction.
Consider the mapping-04 test case,
$ cat tmp.s
.text
.option norelax
.option norvc
.fill 2, 4, 0x1001
.byte 1
.word 0
.balign 8
add a0, a0, a0
.fill 5, 2, 0x2002
add a1, a1, a1
.data
.word 0x1 # No need to add mapping symbols.
.word 0x2
$ riscv64-unknown-elf-as tmp.s -o tmp.o
$ riscv64-unknown-elf-objdump -d tmp.o
Disassembly of section .text:
0000000000000000 <.text>:
0: 00001001 .word 0x00001001 # Marked $d, .fill directive.
4: 00001001 .word 0x00001001
8: 00000001 .word 0x00000001 # .byte + part of .word.
c: 00 .byte 0x00 # remaining .word.
d: 00 .byte 0x00 # Marked $d, odd byte of alignment.
e: 0001 nop # Marked $x, nops for alignment.
10: 00a50533 add a0,a0,a0
14: 20022002 .word 0x20022002 # Marked $d, .fill directive.
18: 20022002 .word 0x20022002
1c: 2002 .short 0x2002
1e: 00b585b3 add a1,a1,a1 # Marked $x.
22: 0001 nop # Section tail alignment.
24: 00000013 nop
* Use $d and $x to mark the distribution of data and instructions.
Alignments of code are recognized as instructions, since we usually
fill nops for them.
* If the alignment have odd bytes, then we cannot just fill the nops
into the spaces. We always fill an odd byte 0x00 at the start of
the spaces. Therefore, add a $d mapping symbol for the odd byte,
to tell disassembler that it isn't an instruction. The behavior
is same as Arm and Aarch64.
The elf/linux toolchain regressions all passed. Besides, I also
disable the mapping symbols internally, but use the new objudmp, the
regressions passed, too. Therefore, the new objudmp should dump
the objects corretly, even if they don't have any mapping symbols.
bfd/
pr 27916
* cpu-riscv.c (riscv_elf_is_mapping_symbols): Define mapping symbols.
* cpu-riscv.h: extern riscv_elf_is_mapping_symbols.
* elfnn-riscv.c (riscv_maybe_function_sym): Do not choose mapping
symbols as a function name.
(riscv_elf_is_target_special_symbol): Add mapping symbols.
binutils/
pr 27916
* testsuite/binutils-all/readelf.s: Updated.
* testsuite/binutils-all/readelf.s-64: Likewise.
* testsuite/binutils-all/readelf.s-64-unused: Likewise.
* testsuite/binutils-all/readelf.ss: Likewise.
* testsuite/binutils-all/readelf.ss-64: Likewise.
* testsuite/binutils-all/readelf.ss-64-unused: Likewise.
gas/
pr 27916
* config/tc-riscv.c (make_mapping_symbol): Create a new mapping symbol.
(riscv_mapping_state): Decide whether to create mapping symbol for
frag_now. Only add the mapping symbols to text sections.
(riscv_add_odd_padding_symbol): Add the mapping symbols for the
riscv_handle_align, which have odd bytes spaces.
(riscv_check_mapping_symbols): Remove any excess mapping symbols.
(md_assemble): Marked as MAP_INSN.
(riscv_frag_align_code): Marked as MAP_INSN.
(riscv_init_frag): Add mapping symbols for frag, it usually called
by frag_var. Marked as MAP_DATA for rs_align and rs_fill, and
marked as MAP_INSN for rs_align_code.
(s_riscv_insn): Marked as MAP_INSN.
(riscv_adjust_symtab): Call riscv_check_mapping_symbols.
* config/tc-riscv.h (md_cons_align): Defined to riscv_mapping_state
with MAP_DATA.
(TC_SEGMENT_INFO_TYPE): Record mapping state for each segment.
(TC_FRAG_TYPE): Record the first and last mapping symbols for the
fragments. The first mapping symbol must be placed at the start
of the fragment.
(TC_FRAG_INIT): Defined to riscv_init_frag.
* testsuite/gas/riscv/mapping-01.s: New testcase.
* testsuite/gas/riscv/mapping-01a.d: Likewise.
* testsuite/gas/riscv/mapping-01b.d: Likewise.
* testsuite/gas/riscv/mapping-02.s: Likewise.
* testsuite/gas/riscv/mapping-02a.d: Likewise.
* testsuite/gas/riscv/mapping-02b.d: Likewise.
* testsuite/gas/riscv/mapping-03.s: Likewise.
* testsuite/gas/riscv/mapping-03a.d: Likewise.
* testsuite/gas/riscv/mapping-03b.d: Likewise.
* testsuite/gas/riscv/mapping-04.s: Likewise.
* testsuite/gas/riscv/mapping-04a.d: Likewise.
* testsuite/gas/riscv/mapping-04b.d: Likewise.
* testsuite/gas/riscv/mapping-norelax-04a.d: Likewise.
* testsuite/gas/riscv/mapping-norelax-04b.d: Likewise.
* testsuite/gas/riscv/no-relax-align.d: Updated.
* testsuite/gas/riscv/no-relax-align-2.d: Likewise.
include/
pr 27916
* opcode/riscv.h (enum riscv_seg_mstate): Added.
opcodes/
pr 27916
* riscv-dis.c (last_map_symbol, last_stop_offset, last_map_state):
Added to dump sections with mapping symbols.
(riscv_get_map_state): Get the mapping state from the symbol.
(riscv_search_mapping_symbol): Check the sorted symbol table, and
then find the suitable mapping symbol.
(riscv_data_length): Decide which data size we should print.
(riscv_disassemble_data): Dump the data contents.
(print_insn_riscv): Handle the mapping symbols.
(riscv_symbol_is_valid): Marked mapping symbols as invalid.
|
|
|
|
|
|
bfd/
PR ld/28264
* elflink.c (_bfd_elf_merge_symbol): Change indirect symbol from
IR to undefined.
ld/
PR ld/28264
* testsuite/ld-plugin/lto.exp: Run PR ld/28264 test.
* testsuite/ld-plugin/pr28264-1.d: New file.
* testsuite/ld-plugin/pr28264-2.d: Likewise.
* testsuite/ld-plugin/pr28264-3.d: Likewise.
* testsuite/ld-plugin/pr28264-4.d: Likewise.
* testsuite/ld-plugin/pr28264.c: Likewise.
* testsuite/ld-plugin/pr28264.ver: Likewise.
|
|
PR 28264
PR 26978
* linker.c (_bfd_generic_link_add_one_symbol <MIND>): Check
that string is non-NULL.
|
|
|
|
|
|
|
|
|
|
|