aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLifang Xia <lifang_xia@linux.alibaba.com>2022-01-20 10:42:55 +0800
committerLifang Xia <lifang_xia@c-sky.com>2022-01-22 17:20:18 +0800
commitcb2562f5530c2f2eb4ca70d70078fa600e3ba983 (patch)
treec5f3b7aacee52d204f9762e22cec451e25b2936f
parent5b4ea8a74096bc7be5962667150798de21449dc9 (diff)
downloadgdb-cb2562f5530c2f2eb4ca70d70078fa600e3ba983.zip
gdb-cb2562f5530c2f2eb4ca70d70078fa600e3ba983.tar.gz
gdb-cb2562f5530c2f2eb4ca70d70078fa600e3ba983.tar.bz2
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.
-rw-r--r--gas/config/tc-riscv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 390aaf1..2590859 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;
}