- castrate libexecinfo on mips64 as

__builtin_return_address() and __builtin_frame_address()
can't have a !0 argument on mips.

with a hint from miod@
ok aja@ (sorry for making your eyes bleed..!)
This commit is contained in:
jasper 2009-10-09 15:10:13 +00:00
parent 834cee5261
commit ab9f5b91e3
5 changed files with 73 additions and 8 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.3 2009/04/09 15:03:06 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.4 2009/10/09 15:10:13 jasper Exp $
COMMENT= clone of backtrace facility found in the GNU libc
DISTNAME= libexecinfo-1.1
PKGNAME= ${DISTNAME}p1
PKGNAME= ${DISTNAME}p2
CATEGORIES= devel
SHARED_LIBS= execinfo 0.0
@ -22,6 +22,19 @@ EXTRACT_SUFX= .tar.bz2
WANTLIB= m
# Hack that allows this lib to build on mips64, although
# it essentially turns this lib into an empty shell...
# ...too many ports require it to mark it NOT_FOR_ARCHS
.if ${MACHINE_ARCH} == "mips64"
EXTRA_CFLAGS= -D__BUILTIN_HACK
# See bsd.lib.mk:162
PKG_ARGS+= -Dno_mips64=0
.else
PKG_ARGS+= -Dno_mips64=1
.endif
MAKE_FLAGS+= EXTRA_CFLAGS=${EXTRA_CFLAGS}
MAKE_ENV= LIBDIR=${PREFIX}/lib \
LIBexecinfo_MAJOR=${LIBexecinfo_VERSION:R} \
LIBexecinfo_MINOR=${LIBexecinfo_VERSION:E}

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2008/10/21 17:01:24 ajacoutot Exp $
--- Makefile.orig Mon Dec 10 22:07:49 2007
+++ Makefile Mon Dec 10 22:08:07 2007
@@ -30,8 +30,8 @@ SRCS= stacktraverse.c stacktraverse.h execinfo.c execi
$OpenBSD: patch-Makefile,v 1.2 2009/10/09 15:10:13 jasper Exp $
--- Makefile.orig Mon Jul 19 07:19:55 2004
+++ Makefile Tue Oct 6 23:12:02 2009
@@ -30,13 +30,15 @@ SRCS= stacktraverse.c stacktraverse.h execinfo.c execi
INCS= execinfo.h
@ -12,3 +12,10 @@ $OpenBSD: patch-Makefile,v 1.1.1.1 2008/10/21 17:01:24 ajacoutot Exp $
NOPROFILE= yes
DPADD= ${LIBM}
LDADD= -lm
+
+CFLAGS+= ${EXTRA_CFLAGS}
#WARNS?= 4

View File

@ -0,0 +1,43 @@
$OpenBSD: patch-stacktraverse_c,v 1.1 2009/10/09 15:10:13 jasper Exp $
__builtin_return_address() and __builtin_frame_address()
can't have a !0 argument on mips.
--- stacktraverse.c.orig Mon Jul 19 07:09:36 2004
+++ stacktraverse.c Tue Oct 6 23:18:58 2009
@@ -7,6 +7,9 @@ getreturnaddr(int level)
{
switch(level) {
+#ifdef __BUILTIN_HACK
+ case 0: return __builtin_return_address(0);
+#else
case 0: return __builtin_return_address(1);
case 1: return __builtin_return_address(2);
case 2: return __builtin_return_address(3);
@@ -135,6 +138,7 @@ getreturnaddr(int level)
case 125: return __builtin_return_address(126);
case 126: return __builtin_return_address(127);
case 127: return __builtin_return_address(128);
+#endif
default: return NULL;
}
}
@@ -148,6 +152,9 @@ getframeaddr(int level)
{
switch(level) {
+#ifdef __BUILTIN_HACK
+ case 0: return __builtin_frame_address(0);
+#else
case 0: return __builtin_frame_address(1);
case 1: return __builtin_frame_address(2);
case 2: return __builtin_frame_address(3);
@@ -276,6 +283,7 @@ getframeaddr(int level)
case 125: return __builtin_frame_address(126);
case 126: return __builtin_frame_address(127);
case 127: return __builtin_frame_address(128);
+#endif
default: return NULL;
}
}

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PFRAG.no_mips64,v 1.1 2009/10/09 15:10:14 jasper Exp $
lib/libexecinfo_pic.a

View File

@ -1,8 +1,8 @@
@comment $OpenBSD: PLIST,v 1.2 2009/04/09 15:03:06 ajacoutot Exp $
@comment $OpenBSD: PLIST,v 1.3 2009/10/09 15:10:14 jasper Exp $
%%SHARED%%
include/execinfo.h
include/stacktraverse.h
lib/libexecinfo.a
lib/libexecinfo_pic.a
%%no_mips64%%
share/doc/libexecinfo/
share/doc/libexecinfo/README