This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ARM/FDPIC v6 13/24] [ARM] FDPIC: Force LSB bit for PC in Cortex-M architecture
- From: Christophe Lyon <christophe dot lyon at st dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 9 Sep 2019 17:44:55 +0200
- Subject: [ARM/FDPIC v6 13/24] [ARM] FDPIC: Force LSB bit for PC in Cortex-M architecture
- References: <20190909154526.11630-1-christophe.lyon@st.com>
From: Christophe Lyon <christophe.lyon@linaro.org>
Without this, when we are unwinding across a signal frame we can jump
to an even address which leads to an exception.
This is needed in __gnu_persnality_sigframe_fdpic() when restoring the
PC from the signal frame since the PC saved by the kernel has the LSB
bit set to zero.
2019-XX-XX Christophe Lyon <christophe.lyon@st.com>
Mickaël Guêné <mickael.guene@st.com>
libgcc/
* config/arm/unwind-arm.c (_Unwind_VRS_Set): Handle thumb-only
architecture.
Change-Id: Ie84de548226bcf1751e19a09e8f091fb3013ccea
diff --git a/libgcc/config/arm/unwind-arm.c b/libgcc/config/arm/unwind-arm.c
index 9ba73e7..8313ee0 100644
--- a/libgcc/config/arm/unwind-arm.c
+++ b/libgcc/config/arm/unwind-arm.c
@@ -199,6 +199,11 @@ _Unwind_VRS_Result _Unwind_VRS_Set (_Unwind_Context *context,
return _UVRSR_FAILED;
vrs->core.r[regno] = *(_uw *) valuep;
+#if defined(__thumb__)
+ /* Force LSB bit since we always run thumb code. */
+ if (regno == R_PC)
+ vrs->core.r[regno] |= 1;
+#endif
return _UVRSR_OK;
case _UVRSC_VFP:
--
2.6.3