From: Lifang Xia Date: Thu, 20 Jan 2022 02:42:55 +0000 (+0800) Subject: RISC-V: create new frag after alignment. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cb2562f5530c2f2eb4ca70d70078fa600e3ba983;p=binutils-gdb.git RISC-V: create new frag after alignment. PR 28793: The alignment may be removed in linker. We need to create new frag after alignment to prevent the assembler from computing static offsets. gas/ * config/tc-riscv.c (riscv_frag_align_code): Create new frag. --- diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 390aaf1710b..25908597436 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -3913,6 +3913,12 @@ riscv_frag_align_code (int n) riscv_mapping_state (MAP_INSN, worst_case_bytes); + /* We need to start a new frag after the alignment which may be removed by + the linker, to prevent the assembler from computing static offsets. + This is necessary to get correct EH info. */ + frag_wane (frag_now); + frag_new (0); + return true; }