Date: Sat, 30 Mar 2019 19:51:34 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-arm@FreeBSD.org Subject: [Bug 236905] LLVM's implementation of __gcc_personality_v0 does not correctly initialise the context Message-ID: <bug-236905-7@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236905 Bug ID: 236905 Summary: LLVM's implementation of __gcc_personality_v0 does not correctly initialise the context Product: Base System Version: CURRENT Hardware: arm OS: Any Status: New Severity: Affects Many People Priority: --- Component: arm Assignee: freebsd-arm@FreeBSD.org Reporter: theraven@FreeBSD.org When __gcc_personality_v0 is invoked (when exceptions unwind through C code that needs to run cleanups), it calls _Unwind_GetLanguageSpecificData: https://github.com/freebsd/freebsd/blob/56c04b0bcfcd116f1b13087ec13bcba2d8d= c7705/contrib/compiler-rt/lib/builtins/gcc_personality_v0.c#L205 This is completely fine on most architectures, but on ARM this tries to map from the context to the exception structure. The GNU extension to the APCS requires that the personality function stores this pointer in the context in register 12 (reserved as a linker scratch register, so never actually used = in unwinding).=20=20 The abstraction layer used in libcxxrt does this automatically: https://github.com/pathscale/libcxxrt/blob/f96846efbfd508f66d91fcbbef5dd808= 947c7f6d/src/unwind-arm.h#L223 It appears that the LLVM implementation of the personality routine does not= do this. This can be fixed by adding: ``` _Unwind_SetGR(context, 12, reinterpret_cast<unsigned long>(exceptionObject)= ); ``` on entry to the personality routine. This will want to be done upstream, b= ut we should carry a local patch to compiler-rt (and possibly issue an EN) bec= ause at present any program that tries to throw an exception through C stack fra= mes crashes on ARM. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236905-7>