* [PATCH] RISC-V: create new frag after alignment.
@ 2022-01-20 6:26 Lifang Xia
2022-01-21 4:43 ` Nelson Chu
0 siblings, 1 reply; 3+ messages in thread
From: Lifang Xia @ 2022-01-20 6:26 UTC (permalink / raw)
To: binutils; +Cc: nelsonc1225, Lifang Xia
From: Lifang Xia <lifang_xia@linux.alibaba.com>
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.
---
gas/config/tc-riscv.c | 6 ++++++
1 file changed, 6 insertions(+)
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;
}
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: create new frag after alignment.
2022-01-20 6:26 [PATCH] RISC-V: create new frag after alignment Lifang Xia
@ 2022-01-21 4:43 ` Nelson Chu
2022-01-22 9:31 ` 夏立方
0 siblings, 1 reply; 3+ messages in thread
From: Nelson Chu @ 2022-01-21 4:43 UTC (permalink / raw)
To: Lifang Xia; +Cc: Binutils, nelsonc1225, Lifang Xia
OK, looks good. Please commit, otherwise we may get the wrong debug info.
Thanks
Nelson
On Thu, Jan 20, 2022 at 2:26 PM Lifang Xia <lifang_xia@c-sky.com> wrote:
>
> From: Lifang Xia <lifang_xia@linux.alibaba.com>
>
> 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.
> ---
> gas/config/tc-riscv.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> 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;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: create new frag after alignment.
2022-01-21 4:43 ` Nelson Chu
@ 2022-01-22 9:31 ` 夏立方
0 siblings, 0 replies; 3+ messages in thread
From: 夏立方 @ 2022-01-22 9:31 UTC (permalink / raw)
To: Nelson Chu; +Cc: binutils, nelsonc1225, Lifang Xia
commited.
------------------------------------------------------------------
Sender:Nelson Chu <nelson.chu@sifive.com>
Sent At:2022 Jan. 21 (Fri.) 12:43
Recipient:夏立方 <lifang_xia@c-sky.com>
Cc:binutils@sourceware.org <binutils@sourceware.org>; nelsonc1225 <nelsonc1225@sourceware.org>; Lifang Xia <lifang_xia@linux.alibaba.com>
Subject:Re: [PATCH] RISC-V: create new frag after alignment.
OK, looks good. Please commit, otherwise we may get the wrong debug info.
Thanks
Nelson
On Thu, Jan 20, 2022 at 2:26 PM Lifang Xia <lifang_xia@c-sky.com> wrote:
>
> From: Lifang Xia <lifang_xia@linux.alibaba.com>
>
> 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.
> ---
> gas/config/tc-riscv.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> 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;
> }
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-22 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20 6:26 [PATCH] RISC-V: create new frag after alignment Lifang Xia
2022-01-21 4:43 ` Nelson Chu
2022-01-22 9:31 ` 夏立方
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).