Skip to content

riscv_gas_mapping_syms_fix_segemit

Tsukasa OI edited this page Nov 16, 2022 · 3 revisions

GAS: Mapping symbol with ISA string whenever non-default architecture is used

Issue Solved

GAS incorrectly emits instruction mapping symbols without ISA string if no segments use two or more architectures simultaneously.

If no segments use two or more architectures (using .option directives), need_arch_map_symbol is not set to true, making riscv_check_mapping_symbols function to replace segment's mapping symbols ($x+arch) with $x.

This easily occurs when a segment (section) is surrounded by .option push / pop. In this example, even when a non-default architecture is used by the program, $x+arch mapping symbol emission is suppressed unless the architecture is changed during a section so that two instructions in one section use the different architecture.

This commit renames need_arch_map_symbol to arch_changed_in_seg to reflect the actual role and suppresses $x+arch mapping symbol emission only if this variable is false (as before) and the section's architecture is the same as the default one (to be written as an ELF attribute).

Clone this wiki locally