cb6a8938ed
progress, largely based on the gcc port in ports/lang/gcc/4.2. Requested by jsg@. It's somewhat usable on i386 (shared lib versions not yet properly under control). Build on amd64 currently fails with -fPIC problems. -- -- lvm-gcc is the LLVM C front end. It is a modified version of gcc that compiles C/C++/ObjC programs into native objects, LLVM bitcode or LLVM assembly language, depending upon the options. By default, llvm-gcc compiles to native objects just like GCC does. If the -emit-llvm option is given then it will generate LLVM bitcode files instead. If -S (assembly) is also given, then it will generate LLVM assembly. Being derived from the GNU Compiler Collection, llvm-gcc has many of gcc's features and accepts most of gcc's options. It handles a number of gcc's extensions to the C programming language. <sthen@zephyr:/usr/ports/mystuff/lang/llvm-gcc4:9>$CVS: ----------------------------------------------------------------------
52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
$OpenBSD: patch-gcc_unwind-dw2_c,v 1.1.1.1 2009/06/22 22:37:32 sthen Exp $
|
||
--- gcc/unwind-dw2.c.orig Thu Jan 25 02:13:44 2007
|
||
+++ gcc/unwind-dw2.c Wed Mar 18 11:03:10 2009
|
||
@@ -150,6 +150,25 @@ _Unwind_IsExtendedContext (struct _Unwind_Context *con
|
||
{
|
||
return context->flags & EXTENDED_CONTEXT_BIT;
|
||
}
|
||
+
|
||
+#ifdef __sparc64__
|
||
+
|
||
+/* Figure out StackGhost cookie. */
|
||
+_Unwind_Word uw_get_wcookie(void);
|
||
+
|
||
+asm(".text\n"
|
||
+ "uw_get_wcookie:\n"
|
||
+ " add %o7, %g0, %g4\n"
|
||
+ " save %sp, -176, %sp\n"
|
||
+ " save %sp, -176, %sp\n"
|
||
+ " flushw\n"
|
||
+ " restore\n"
|
||
+ " ldx [%sp + 2047 + 120], %g5\n"
|
||
+ " xor %g4, %g5, %i0\n"
|
||
+ " ret\n"
|
||
+ " restore\n");
|
||
+#endif
|
||
+
|
||
|
||
/* Get the value of register INDEX as saved in CONTEXT. */
|
||
|
||
@@ -172,6 +191,13 @@ _Unwind_GetGR (struct _Unwind_Context *context, int in
|
||
if (_Unwind_IsExtendedContext (context) && context->by_value[index])
|
||
return (_Unwind_Word) (_Unwind_Internal_Ptr) ptr;
|
||
|
||
+#ifdef __sparc64__
|
||
+ /* _Unwind_Word and _Unwind_Ptr are the same size on sparc64 */
|
||
+ _Unwind_Word reg = * (_Unwind_Word *) ptr;
|
||
+ if (index == 15 || index == 31)
|
||
+ reg ^= uw_get_wcookie ();
|
||
+ return reg;
|
||
+#else
|
||
/* This will segfault if the register hasn't been saved. */
|
||
if (size == sizeof(_Unwind_Ptr))
|
||
return * (_Unwind_Ptr *) ptr;
|
||
@@ -180,6 +206,7 @@ _Unwind_GetGR (struct _Unwind_Context *context, int in
|
||
gcc_assert (size == sizeof(_Unwind_Word));
|
||
return * (_Unwind_Word *) ptr;
|
||
}
|
||
+#endif
|
||
}
|
||
|
||
static inline void *
|