public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Remove LSB when finding landing pad correlating to a PC
@ 2021-12-10 16:50 Matthew Malcomson
0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-12-10 16:50 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:567c00d744255b38c1ae988922c279948b409d3d
commit 567c00d744255b38c1ae988922c279948b409d3d
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date: Fri Dec 10 16:31:28 2021 +0000
Remove LSB when finding landing pad correlating to a PC
Remove LSB when finding landing pad correlating to a PC
In the C personality function we need to find the landing pad associated
with a given PC. To find the relevant landing pad we need to look for
the relevant PC location. Since the PC we get from _Unwind_GetIP is a
valid sealed capability and removing that LSB loses the capability
validity we add code to maintain the clear difference between the IP
pointer and the IP as an address in the C personality function.
N.b. the implementation design of maintaining two variables is not
really necessary, we have no reason to need the IP from before. However
it's still nice to maintain a clear distinction between the two ways
of representing IP.
N.b. this changes the cleanup-5.c test from FAIL to PASS because we now
correctly identify the LSDA for the instruction that we are in (rather
than the instruction that would come after the current branch).
Diff:
---
libgcc/unwind-c.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/libgcc/unwind-c.c b/libgcc/unwind-c.c
index af8e390bdbd..d1831bed92c 100644
--- a/libgcc/unwind-c.c
+++ b/libgcc/unwind-c.c
@@ -128,7 +128,8 @@ PERSONALITY_FUNCTION (int version,
{
lsda_header_info info;
const unsigned char *language_specific_data, *p;
- _Unwind_Ptr landing_pad, ip;
+ _Unwind_Ptr landing_pad, ip_ptr;
+ _Unwind_Address ip;
int ip_before_insn = 0;
#ifdef __ARM_EABI_UNWINDER__
@@ -139,8 +140,8 @@ PERSONALITY_FUNCTION (int version,
function and LSDA pointers. The ARM implementation caches these in
the exception header (UCB). To avoid rewriting everything we make a
virtual scratch register point at the UCB. */
- ip = (_Unwind_Ptr) ue_header;
- _Unwind_SetGR (context, UNWIND_POINTER_REG, ip);
+ ip_ptr = (_Unwind_Ptr) ue_header;
+ _Unwind_SetGR (context, UNWIND_POINTER_REG, ip_ptr);
#else
if (version != 1)
return _URC_FATAL_PHASE1_ERROR;
@@ -160,10 +161,17 @@ PERSONALITY_FUNCTION (int version,
/* Parse the LSDA header. */
p = parse_lsda_header (context, language_specific_data, &info);
#ifdef HAVE_GETIPINFO
- ip = _Unwind_GetIPInfo (context, &ip_before_insn);
+ ip_ptr = _Unwind_GetIPInfo (context, &ip_before_insn);
#else
- ip = _Unwind_GetIP (context);
+ ip_ptr = _Unwind_GetIP (context);
#endif
+
+#ifdef __USING_SJLJ_EXCEPTIONS__
+ ip = (_Unwind_Address) ip_ptr;
+#else
+ ip = __builtin_code_address_from_pointer (ip_ptr);
+#endif
+
if (! ip_before_insn)
--ip;
landing_pad = 0;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-10 16:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 16:50 [gcc(refs/vendors/ARM/heads/morello)] Remove LSB when finding landing pad correlating to a PC Matthew Malcomson
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).