diff options
author | osa <osa@FreeBSD.org> | 2012-04-02 17:51:02 +0800 |
---|---|---|
committer | osa <osa@FreeBSD.org> | 2012-04-02 17:51:02 +0800 |
commit | 709ba1a07c70c7efd3b9266666a4d1002780c798 (patch) | |
tree | dffc26a0b29ca36bcff97340c67c5e462eb8fb82 /lang/luajit | |
parent | 11af3643e1147878afbfaa13fd379dfb86ac4788 (diff) | |
download | freebsd-ports-gnome-709ba1a07c70c7efd3b9266666a4d1002780c798.tar.gz freebsd-ports-gnome-709ba1a07c70c7efd3b9266666a4d1002780c798.tar.zst freebsd-ports-gnome-709ba1a07c70c7efd3b9266666a4d1002780c798.zip |
Replace unwind.h definitions with luajit own.
Bump PORTREVISION.
Patch obtained from browsable mirror of luajit
http://repo.or.cz/w/luajit-2.0.git.
Feature safe: yes
Diffstat (limited to 'lang/luajit')
-rw-r--r-- | lang/luajit/Makefile | 5 | ||||
-rw-r--r-- | lang/luajit/files/patch-lj_err.c | 139 | ||||
-rw-r--r-- | lang/luajit/files/unwind.h | 241 |
3 files changed, 140 insertions, 245 deletions
diff --git a/lang/luajit/Makefile b/lang/luajit/Makefile index 4afbf3a0356c..e3c5f7271c0a 100644 --- a/lang/luajit/Makefile +++ b/lang/luajit/Makefile @@ -7,7 +7,7 @@ PORTNAME= luajit DISTVERSION= 2.0.0-beta9 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= lang MASTER_SITES= http://luajit.org/download/ DISTNAME= LuaJIT-${DISTVERSION} @@ -28,9 +28,6 @@ CFLAGS+= "-I../" MAN1= luajit.1 .endif -pre-build: - ${CP} ${FILESDIR}/unwind.h ${WRKSRC} - post-install: ${LN} -sf ${PREFIX}/bin/${PORTNAME}-${DISTVERSION} \ ${PREFIX}/bin/${PORTNAME} diff --git a/lang/luajit/files/patch-lj_err.c b/lang/luajit/files/patch-lj_err.c new file mode 100644 index 000000000000..4836c6d5a528 --- /dev/null +++ b/lang/luajit/files/patch-lj_err.c @@ -0,0 +1,139 @@ +X-Git-Url: http://repo.or.cz/w/luajit-2.0.git/blobdiff_plain/339142c2aaa82fd6e3c71fdbbb12296899e8cdd2..018792452ecdcaeff9362e4238004420665b450b:/src/lj_err.c + +diff --git a/src/lj_err.c b/src/lj_err.c +index a4c7478..b46a6dc 100644 +--- src/lj_err.c ++++ src/lj_err.c +@@ -187,24 +187,48 @@ static void *err_unwind(lua_State *L, void *stopcf, int errcode) + + #if defined(__GNUC__) && !defined(LUAJIT_NO_UNWIND) + +-#ifdef __clang__ +-/* http://llvm.org/bugs/show_bug.cgi?id=8703 */ +-#define __unwind_word__ word +-#endif ++/* ++** We have to use our own definitions instead of the mandatory (!) unwind.h, ++** since various OS, distros and compilers mess up the header installation. ++*/ ++ ++typedef struct _Unwind_Exception ++{ ++ uint64_t exclass; ++ void (*excleanup)(int, struct _Unwind_Exception); ++ uintptr_t p1, p2; ++} __attribute__((__aligned__)) _Unwind_Exception; ++ ++typedef struct _Unwind_Context _Unwind_Context; + +-#include <unwind.h> ++#define _URC_OK 0 ++#define _URC_FATAL_PHASE1_ERROR 3 ++#define _URC_HANDLER_FOUND 6 ++#define _URC_INSTALL_CONTEXT 7 ++#define _URC_CONTINUE_UNWIND 8 ++#define _URC_FAILURE 9 + + #if !LJ_TARGET_ARM + ++extern uintptr_t _Unwind_GetCFA(_Unwind_Context *); ++extern void _Unwind_SetGR(_Unwind_Context *, int, uintptr_t); ++extern void _Unwind_SetIP(_Unwind_Context *, uintptr_t); ++extern void _Unwind_DeleteException(_Unwind_Exception *); ++extern int _Unwind_RaiseException(_Unwind_Exception *); ++ ++#define _UA_SEARCH_PHASE 1 ++#define _UA_CLEANUP_PHASE 2 ++#define _UA_HANDLER_FRAME 4 ++#define _UA_FORCE_UNWIND 8 ++ + #define LJ_UEXCLASS 0x4c55414a49543200ULL /* LUAJIT2\0 */ + #define LJ_UEXCLASS_MAKE(c) (LJ_UEXCLASS | (uint64_t)(c)) + #define LJ_UEXCLASS_CHECK(cl) (((cl) ^ LJ_UEXCLASS) <= 0xff) + #define LJ_UEXCLASS_ERRCODE(cl) ((int)((cl) & 0xff)) + + /* DWARF2 personality handler referenced from interpreter .eh_frame. */ +-LJ_FUNCA int lj_err_unwind_dwarf(int version, _Unwind_Action actions, +- uint64_t uexclass, struct _Unwind_Exception *uex, +- struct _Unwind_Context *ctx) ++LJ_FUNCA int lj_err_unwind_dwarf(int version, int actions, ++ uint64_t uexclass, _Unwind_Exception *uex, _Unwind_Context *ctx) + { + void *cf; + lua_State *L; +@@ -255,7 +279,7 @@ LJ_FUNCA int lj_err_unwind_dwarf(int version, _Unwind_Action actions, + #endif + #else + /* This is not the proper way to escape from the unwinder. We get away with +- ** it on x86/PPC because the interpreter restores all callee-saved regs. ++ ** it on non-x64 because the interpreter restores all callee-saved regs. + */ + lj_err_throw(L, errcode); + #endif +@@ -266,26 +290,46 @@ LJ_FUNCA int lj_err_unwind_dwarf(int version, _Unwind_Action actions, + #if LJ_UNWIND_EXT + #if LJ_TARGET_OSX || defined(__OpenBSD__) + /* Sorry, no thread safety for OSX. Complain to Apple, not me. */ +-static struct _Unwind_Exception static_uex; ++static _Unwind_Exception static_uex; + #else +-static __thread struct _Unwind_Exception static_uex; ++static __thread _Unwind_Exception static_uex; + #endif + + /* Raise DWARF2 exception. */ + static void err_raise_ext(int errcode) + { +- static_uex.exception_class = LJ_UEXCLASS_MAKE(errcode); +- static_uex.exception_cleanup = NULL; ++ static_uex.exclass = LJ_UEXCLASS_MAKE(errcode); ++ static_uex.excleanup = NULL; + _Unwind_RaiseException(&static_uex); + } + #endif + + #else + ++extern void _Unwind_DeleteException(void *); ++extern int __gnu_unwind_frame (void *, _Unwind_Context *); ++extern int _Unwind_VRS_Set(_Unwind_Context *, int, uint32_t, int, void *); ++extern int _Unwind_VRS_Get(_Unwind_Context *, int, uint32_t, int, void *); ++ ++static inline uint32_t _Unwind_GetGR(_Unwind_Context *ctx, int r) ++{ ++ uint32_t v; ++ _Unwind_VRS_Get(ctx, 0, r, 0, &v); ++ return v; ++} ++ ++static inline void _Unwind_SetGR(_Unwind_Context *ctx, int r, uint32_t v) ++{ ++ _Unwind_VRS_Set(ctx, 0, r, 0, &v); ++} ++ ++#define _US_VIRTUAL_UNWIND_FRAME 0 ++#define _US_UNWIND_FRAME_STARTING 1 ++#define _US_ACTION_MASK 3 ++#define _US_FORCE_UNWIND 8 ++ + /* ARM unwinder personality handler referenced from interpreter .ARM.extab. */ +-LJ_FUNCA _Unwind_Reason_Code lj_err_unwind_arm(_Unwind_State state, +- _Unwind_Control_Block *ucb, +- _Unwind_Context *ctx) ++LJ_FUNCA int lj_err_unwind_arm(int state, void *ucb, _Unwind_Context *ctx) + { + void *cf = (void *)_Unwind_GetGR(ctx, 13); + lua_State *L = cframe_L(cf); +@@ -295,9 +339,9 @@ LJ_FUNCA _Unwind_Reason_Code lj_err_unwind_arm(_Unwind_State state, + } + if ((state&(_US_ACTION_MASK|_US_FORCE_UNWIND)) == _US_UNWIND_FRAME_STARTING) { + _Unwind_DeleteException(ucb); +- _Unwind_SetGR(ctx, 15, (_Unwind_Word)(void *)lj_err_throw); +- _Unwind_SetGR(ctx, 0, (_Unwind_Word)L); +- _Unwind_SetGR(ctx, 1, (_Unwind_Word)LUA_ERRRUN); ++ _Unwind_SetGR(ctx, 15, (uint32_t)(void *)lj_err_throw); ++ _Unwind_SetGR(ctx, 0, (uint32_t)L); ++ _Unwind_SetGR(ctx, 1, (uint32_t)LUA_ERRRUN); + return _URC_INSTALL_CONTEXT; + } + if (__gnu_unwind_frame(ucb, ctx) != _URC_OK) diff --git a/lang/luajit/files/unwind.h b/lang/luajit/files/unwind.h deleted file mode 100644 index 3f4c06530ce1..000000000000 --- a/lang/luajit/files/unwind.h +++ /dev/null @@ -1,241 +0,0 @@ -/* Exception handling and frame unwind runtime interface routines. - Copyright (C) 2001, 2003, 2004, 2006 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING. If not, write to the Free - Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ - -/* As a special exception, if you include this header file into source - files compiled by GCC, this header file does not by itself cause - the resulting executable to be covered by the GNU General Public - License. This exception does not however invalidate any other - reasons why the executable file might be covered by the GNU General - Public License. */ - -/* This is derived from the C++ ABI for IA-64. Where we diverge - for cross-architecture compatibility are noted with "@@@". */ - -#ifndef _UNWIND_H -#define _UNWIND_H - -#ifndef HIDE_EXPORTS -#pragma GCC visibility push(default) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Level 1: Base ABI */ - -/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is - inefficient for 32-bit and smaller machines. */ -typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); -typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); -#if defined(__ia64__) && defined(__hpux__) -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); -#else -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); -#endif -typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); - -/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and - consumer of an exception. We'll go along with this for now even on - 32-bit machines. We'll need to provide some other option for - 16-bit machines and for machines with > 8 bits per byte. */ -typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); - -/* The unwind interface uses reason codes in several contexts to - identify the reasons for failures or other actions. */ -typedef enum -{ - _URC_NO_REASON = 0, - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_FATAL_PHASE2_ERROR = 2, - _URC_FATAL_PHASE1_ERROR = 3, - _URC_NORMAL_STOP = 4, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 -} _Unwind_Reason_Code; - - -/* The unwind interface uses a pointer to an exception header object - as its representation of an exception being thrown. In general, the - full representation of an exception object is language- and - implementation-specific, but it will be prefixed by a header - understood by the unwind interface. */ - -struct _Unwind_Exception; - -typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); - -struct _Unwind_Exception -{ - _Unwind_Exception_Class exception_class; - _Unwind_Exception_Cleanup_Fn exception_cleanup; - _Unwind_Word private_1; - _Unwind_Word private_2; - - /* @@@ The IA-64 ABI says that this structure must be double-word aligned. - Taking that literally does not make much sense generically. Instead we - provide the maximum alignment required by any type for the machine. */ -} __attribute__((__aligned__)); - - -/* The ACTIONS argument to the personality routine is a bitwise OR of one - or more of the following constants. */ -typedef int _Unwind_Action; - -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 -#define _UA_END_OF_STACK 16 - -/* This is an opaque type used to refer to a system-specific data - structure used by the system unwinder. This context is created and - destroyed by the system, and passed to the personality routine - during unwinding. */ -struct _Unwind_Context; - -/* Raise an exception, passing along the given exception object. */ -extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); - -/* Raise an exception for forced unwinding. */ - -typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, - void *); - -/* Helper to invoke the exception_cleanup routine. */ -extern void _Unwind_DeleteException (struct _Unwind_Exception *); - -/* Resume propagation of an existing exception. This is used after - e.g. executing cleanup code, and not to implement rethrowing. */ -extern void _Unwind_Resume (struct _Unwind_Exception *); - -/* @@@ Resume propagation of an FORCE_UNWIND exception, or to rethrow - a normal exception that was handled. */ -extern _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); - -/* @@@ Use unwind data to perform a stack backtrace. The trace callback - is called for every stack frame in the call chain, but no cleanup - actions are performed. */ -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) - (struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -/* These functions are used for communicating information about the unwind - context (i.e. the unwind descriptors and the user register state) between - the unwind library and the personality routine and landing pad. Only - selected registers maybe manipulated. */ - -extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); -extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); - -extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); -extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *); -extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); - -/* @@@ Retrieve the CFA of the given context. */ -extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); - -extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); - -extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); - - -/* The personality routine is the function in the C++ (or other language) - runtime library which serves as an interface between the system unwind - library and language-specific exception handling semantics. It is - specific to the code fragment described by an unwind info block, and - it is always referenced via the pointer in the unwind info block, and - hence it has no ABI-specified name. - - Note that this implies that two different C++ implementations can - use different names, and have different contents in the language - specific data area. Moreover, that the language specific data - area contains no version info because name of the function invoked - provides more effective versioning by detecting at link time the - lack of code to handle the different data format. */ - -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *); - -/* @@@ The following alternate entry points are for setjmp/longjmp - based unwinding. */ - -struct SjLj_Function_Context; -extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); -extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); - -extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException - (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind - (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); -extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (struct _Unwind_Exception *); - -/* @@@ The following provide access to the base addresses for text - and data-relative addressing in the LDSA. In order to stay link - compatible with the standard ABI for IA-64, we inline these. */ - -#ifdef __ia64__ -#include <stdlib.h> - -static inline _Unwind_Ptr -_Unwind_GetDataRelBase (struct _Unwind_Context *_C) -{ - /* The GP is stored in R1. */ - return _Unwind_GetGR (_C, 1); -} - -static inline _Unwind_Ptr -_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__))) -{ - abort (); - return 0; -} - -/* @@@ Retrieve the Backing Store Pointer of the given context. */ -extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); -#else -extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); -extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); -#endif - -/* @@@ Given an address, return the entry point of the function that - contains it. */ -extern void * _Unwind_FindEnclosingFunction (void *pc); - -#ifdef __cplusplus -} -#endif - -#ifndef HIDE_EXPORTS -#pragma GCC visibility pop -#endif - -#endif /* unwind.h */ |