diff options
author | Andrew Sun | 2018-08-07 08:18:46 -0400 |
---|---|---|
committer | Andrew Sun | 2018-08-07 08:18:46 -0400 |
commit | ae5b109b679df7c23166f86958589c35fe880fa5 (patch) | |
tree | 52becfd8675a373a08048de01930de6426afee63 | |
download | aur-ae5b109b679df7c23166f86958589c35fe880fa5.tar.gz |
add mingw-w64-libsigsegv (version 2.12)
-rw-r--r-- | .SRCINFO | 19 | ||||
-rw-r--r-- | 0001-libsigsegv-2.11-fix-assembly.patch | 103 | ||||
-rw-r--r-- | PKGBUILD | 44 |
3 files changed, 166 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..b19fc50dabd2 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,19 @@ +pkgbase = mingw-w64-libsigsegv + pkgdesc = Page fault detection library (mingw-w64) + pkgver = 2.12 + pkgrel = 1 + url = http://www.gnu.org/software/libsigsegv/ + arch = any + license = GPL2 + makedepends = mingw-w64-configure + depends = mingw-w64-crt + options = !strip + options = !buildflags + options = staticlibs + source = http://ftp.gnu.org/gnu/libsigsegv/libsigsegv-2.12.tar.gz + source = 0001-libsigsegv-2.11-fix-assembly.patch + sha1sums = df167811328b050d2b746bec3d88423edc5a8cbf + sha1sums = 945d032622103b260b0397b07da8c0f5fdd78d42 + +pkgname = mingw-w64-libsigsegv + diff --git a/0001-libsigsegv-2.11-fix-assembly.patch b/0001-libsigsegv-2.11-fix-assembly.patch new file mode 100644 index 000000000000..abd0ff5fb6e4 --- /dev/null +++ b/0001-libsigsegv-2.11-fix-assembly.patch @@ -0,0 +1,103 @@ +--- libsigsegv-2.11/src/handler-win32-orig.c 2017-11-30 17:36:43.362197800 -0500 ++++ libsigsegv-2.11/src/handler-win32.c 2017-11-30 17:42:56.526459500 -0500 +@@ -167,6 +167,91 @@ + ) + #endif + ) ++#ifdef _WIN64 ++ { ++#if 0 /* for debugging only */ ++ printf ("Exception!\n"); ++ printf ("Code = 0x%x\n", ++ ExceptionInfo->ExceptionRecord->ExceptionCode); ++ printf ("Flags = 0x%x\n", ++ ExceptionInfo->ExceptionRecord->ExceptionFlags); ++ printf ("Address = 0x%x\n", ++ ExceptionInfo->ExceptionRecord->ExceptionAddress); ++ printf ("Params:"); ++ { ++ DWORD i; ++ for (i = 0; i < ExceptionInfo->ExceptionRecord->NumberParameters; i++) ++ printf (" 0x%x,", ++ ExceptionInfo->ExceptionRecord->ExceptionInformation[i]); ++ } ++ printf ("\n"); ++ printf ("Registers:\n"); ++ printf ("rip = 0x%x\n", ExceptionInfo->ContextRecord->Rip); ++ printf ("rax = 0x%x, ", ExceptionInfo->ContextRecord->Rax); ++ printf ("rbx = 0x%x, ", ExceptionInfo->ContextRecord->Rbx); ++ printf ("rcx = 0x%x, ", ExceptionInfo->ContextRecord->Rcx); ++ printf ("rdx = 0x%x\n", ExceptionInfo->ContextRecord->Rdx); ++ printf ("rsi = 0x%x, ", ExceptionInfo->ContextRecord->Rsi); ++ printf ("rdi = 0x%x, ", ExceptionInfo->ContextRecord->Rdi); ++ printf ("rbp = 0x%x, ", ExceptionInfo->ContextRecord->Rbp); ++ printf ("rsp = 0x%x\n", ExceptionInfo->ContextRecord->Rsp); ++#endif ++ if (ExceptionInfo->ExceptionRecord->NumberParameters == 2) ++ { ++ if (stk_user_handler ++ && ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) ++ { ++ char *address = (char *) ExceptionInfo->ExceptionRecord->ExceptionInformation[1]; ++ /* Restart the program, giving it a sane value for %esp. ++ At the same time, copy the contents of ++ ExceptionInfo->ContextRecord (which, on Windows XP, happens ++ to be allocated in the guard page, where it will be ++ inaccessible as soon as we restore the PAGE_GUARD bit!) to ++ this new stack. */ ++ uintptr_t faulting_page_address = (uintptr_t)address & -0x1000; ++ uintptr_t new_safe_rsp = ((stk_extra_stack + stk_extra_stack_size) & -16); ++ CONTEXT *orig_context = ExceptionInfo->ContextRecord; ++ CONTEXT *safe_context = (CONTEXT *) (new_safe_rsp -= sizeof (CONTEXT)); /* make room */ ++ memcpy (safe_context, orig_context, sizeof (CONTEXT)); ++ new_safe_rsp -= 8; /* make room for arguments */ ++ new_safe_rsp &= -16; /* align */ ++ new_safe_rsp -= 4; /* make room for (unused) return address slot */ ++ ExceptionInfo->ContextRecord->Rsp = new_safe_rsp; ++ /* Call stack_overflow_handler(faulting_page_address,safe_context). */ ++ ExceptionInfo->ContextRecord->Rip = (uintptr_t)&stack_overflow_handler; ++ *(uintptr_t *)(new_safe_rsp + 4) = faulting_page_address; ++ *(uintptr_t *)(new_safe_rsp + 8) = (uintptr_t) safe_context; ++ return EXCEPTION_CONTINUE_EXECUTION; ++ } ++#if !MIXING_UNIX_SIGSEGV_AND_WIN32_STACKOVERFLOW_HANDLING || OLD_CYGWIN_WORKAROUND ++ if (ExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION) ++ { ++#if MIXING_UNIX_SIGSEGV_AND_WIN32_STACKOVERFLOW_HANDLING ++ /* Store the fault address. Then pass control to Cygwin's ++ exception filter, which will decide whether to recognize ++ a fault inside a "system call" (and return errno = EFAULT) ++ or to pass it on to the program (by invoking the Unix signal ++ handler). */ ++ last_seen_fault_address = (void *) ExceptionInfo->ExceptionRecord->ExceptionInformation[1]; ++#else ++ if (user_handler != (sigsegv_handler_t) NULL) ++ { ++ /* ExceptionInfo->ExceptionRecord->ExceptionInformation[0] is ++ 1 if it's a write access, 0 if it's a read access. But we ++ don't need this info because we don't have it on Unix ++ either. */ ++ void *address = (void *) ExceptionInfo->ExceptionRecord->ExceptionInformation[1]; ++ if ((*user_handler) (address, 1)) ++ return EXCEPTION_CONTINUE_EXECUTION; ++ } ++#endif ++ } ++#endif ++ } ++ } ++ return EXCEPTION_CONTINUE_SEARCH; ++} ++#else + { + #if 0 /* for debugging only */ + printf ("Exception!\n"); +@@ -250,7 +335,7 @@ + } + return EXCEPTION_CONTINUE_SEARCH; + } +- ++#endif + #if defined __CYGWIN__ && defined __i386__ + + /* In Cygwin programs, SetUnhandledExceptionFilter has no effect because Cygwin diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c41dd208c725 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,44 @@ +# Maintainer: Andrew Sun <adsun701@gmail.com> + +pkgname=mingw-w64-libsigsegv +_pkgname=libsigsegv +pkgver=2.12 +pkgrel=1 +arch=('any') +pkgdesc="Page fault detection library (mingw-w64)" +url="http://www.gnu.org/software/libsigsegv/" +license=('GPL2') +makedepends=('mingw-w64-configure') +depends=('mingw-w64-crt') +options=('!strip' '!buildflags' 'staticlibs') +source=("http://ftp.gnu.org/gnu/${_pkgname}/${_pkgname}-${pkgver}.tar.gz" + "0001-libsigsegv-2.11-fix-assembly.patch") +sha1sums=('df167811328b050d2b746bec3d88423edc5a8cbf' + '945d032622103b260b0397b07da8c0f5fdd78d42') + +_architectures="i686-w64-mingw32 x86_64-w64-mingw32" + +prepare() { + cd "${srcdir}/${_pkgname}-${pkgver}" + patch -Np1 -i "${srcdir}/0001-libsigsegv-2.11-fix-assembly.patch" + autoreconf -fiv +} + +build() { + cd "${srcdir}/${_pkgname}-${pkgver}" + for _arch in ${_architectures}; do + mkdir -p build-${_arch} && pushd build-${_arch} + ${_arch}-configure .. + make + popd + done +} + +package() { + for _arch in ${_architectures}; do + cd "${srcdir}/${_pkgname}-${pkgver}/build-${_arch}" + make DESTDIR="${pkgdir}" install + ${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll + ${_arch}-strip -g "${pkgdir}"/usr/${_arch}/lib/*.a + done +} |