-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RISC-V: Mapping symbols with ISA string on assembler
The mapping symbols with ISA string is proposed to deal with so called "ifunc issue". It enables disassembling a certain range of the code with a different architecture than the rest, even if conflicting. This is useful when there's "optimized" implementation is available but dynamically switched only if a certain extension is available. This commit implements the assembler support to emit mapping symbols with ISA string (and partial disassembler support only to pass tests). [1] Proposal: Extend .option directive for control enabled extensions on specific code region, riscv-non-isa/riscv-asm-manual#67 [2] Proposal: Add mapping symbol, riscv-non-isa/riscv-elf-psabi-doc#196 This commit is based on Nelson Chu's proposal "RISC-V: Output mapping symbols with ISA string once .option arch is used." but heavily modified to reflect the intent of Kito's original proposal. It is also made smarter so that it no longer requires MAP_INSN_ARCH. gas/ChangeLog: * config/tc-riscv.c (struct riscv_set_options): Add new field `arch_is_default' to keep track whether the architecture is still holds its default. (updated_riscv_subsets) New variable to keep track of whether the architecture is possibly changed and inspected to emit proper mapping symbols. (make_mapping_symbol): Make mapping symbols with ISA string if necessary. Don't emit the mapping symbol if the previous one in the same section has the same name. (riscv_elf_section_change_hook): New. Try to emit a new mapping symbol if the section is changed. (riscv_mapping_state): Don't skip if the architecture is possibly changed and the new state is "code". (s_riscv_option): Keep track of `updated_riscv_subsets' and `riscv_opts.arch_is_default'. * config/tc-riscv.h (md_elf_section_change_hook): Define as `riscv_elf_section_change_hook'. (riscv_elf_section_change_hook): Declare. * testsuite/gas/riscv/mapping-01a.d: Reflect mapping symbols with ISA string. * testsuite/gas/riscv/mapping-02a.d: Likewise. * testsuite/gas/riscv/mapping-03a.d: Likewise. * testsuite/gas/riscv/mapping-04a.d: Likewise. * testsuite/gas/riscv/mapping-norelax-03a.d: Likewise. * testsuite/gas/riscv/mapping-norelax-04a.d: Likewise. opcodes/ChangeLog: * riscv-dis.c (riscv_get_map_state): Minimum support of mapping symbols with ISA string without actually parsing the ISA string. The only purpose of this change is to pass the tests.
- Loading branch information
Showing
9 changed files
with
65 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters