Skip to content

Instantly share code, notes, and snippets.

@morsik
Last active December 10, 2015 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morsik/4363779 to your computer and use it in GitHub Desktop.
Save morsik/4363779 to your computer and use it in GitHub Desktop.
Index: cgame/cg_crash.c
===================================================================
--- cgame/cg_crash.c (revision 535)
+++ cgame/cg_crash.c (working copy)
@@ -151,11 +151,19 @@
//If we don't do this stack traces are less accurate.
#ifdef GLIBC_21
Crash_Printf("Stack frames: %Zd entries\n", size-1);
+#ifndef __x86_64__
array[1] = (void *)ctx->uc_mcontext.gregs[EIP];
#else
+ array[1] = (void *)ctx->uc_mcontext.gregs[RIP];
+#endif
+#else
Crash_Printf("Stack frames: %zd entries\n", size-1);
+#ifndef __x86_64__
array[1] = (void *)ctx->uc_mcontext.gregs[REG_EIP];
+#else
+ array[1] = (void *)ctx->uc_mcontext.gregs[REG_RIP];
#endif
+#endif
Crash_Printf("Backtrace:\n");
strings = (char **)backtrace_symbols(array, (int)size);
Index: game/g_crash.c
===================================================================
--- game/g_crash.c (revision 535)
+++ game/g_crash.c (working copy)
@@ -132,11 +132,19 @@
//If we don't do this stack traces are less accurate.
#ifdef GLIBC_21
G_LogPrintf("Stack frames: %Zd entries\n", size-1);
+ #ifndef __x86_64__
array[1] = (void *)ctx->uc_mcontext.gregs[EIP];
#else
+ array[1] = (void *)ctx->uc_mcontext.gregs[RIP];
+ #endif
+ #else
G_LogPrintf("Stack frames: %zd entries\n", size-1);
+ #ifndef __x86_64__
array[1] = (void *)ctx->uc_mcontext.gregs[REG_EIP];
+ #else
+ array[1] = (void *)ctx->uc_mcontext.gregs[REG_RIP];
#endif
+ #endif
G_LogPrintf("Backtrace:\n");
strings = (char **)backtrace_symbols(array, (int)size);
Index: SConstruct
===================================================================
--- SConstruct (revision 535)
+++ SConstruct (working copy)
@@ -87,12 +87,18 @@
# system detection -------------------------------
# CPU type
+
+march = 'i686'
+
cpu = commands.getoutput('uname -m')
dll_cpu = '???' # grmbl, alternative naming for .so
-exp = re.compile('.*i?86.*')
+exp = re.compile('.*i.86.*')
if exp.match(cpu):
cpu = 'x86'
dll_cpu = 'i386'
+elif cpu == 'x86_64':
+ dll_cpu = 'x86_64'
+ march = 'x86-64'
else:
cpu = commands.getoutput('uname -p')
if ( cpu == 'powerpc' ):
@@ -231,12 +237,6 @@
# for release build, further optimisations that may not work on all files
OPTCPPFLAGS = [ ]
-# pheno: make sure to compile a 32 bit object on a compiler
-# configured to compile 64 bit objects by default
-if( g_os == 'Linux' ):
- BASECPPFLAGS += [ '-m32' ]
- BASELINKFLAGS += [ '-m32' ]
-
if ( OS == 'Darwin' ):
# taken from xcode's default project settings
BASECPPFLAGS += [ '-D__MACOS__', '-Wno-long-double', '-arch', 'ppc', '-arch', 'i386', '-fasm-blocks', '-fpascal-strings', '-faltivec', '-Wno-unknown-pragmas' ]
@@ -261,7 +261,7 @@
# -fschedule-insns2: implicit at -O3
# -funroll-loops ?
# -mfpmath=sse -msse ?
- OPTCPPFLAGS = [ '-O3', '-march=i686', '-Winline', '-ffast-math', '-finline-functions', '-fschedule-insns2' ]
+ OPTCPPFLAGS = [ '-O3', '-march=%s' % march, '-Winline', '-ffast-math', '-finline-functions', '-fschedule-insns2' ]
elif ( OS == 'Darwin' ):
OPTCPPFLAGS = [ '-O3', '-falign-functions=16', '-falign-loops=16', '-finline' ]
else:
Index: SConscript.game
===================================================================
--- SConscript.game (revision 535)
+++ SConscript.game (working copy)
@@ -99,13 +99,7 @@
# optionally build with Lua API support
if( WITH_LUA_SUPPORT == '1' ):
local_env.Append( CPPDEFINES = ['LUA_SUPPORT'] )
- local_env.Append( CPPPATH = ['../../../lua-5.1.4/include'] )
-
- if( g_os == 'Linux' ):
- local_env.Append( LINKFLAGS = ['-Wl,-rpath=./'] )
-
- local_env.Append( LIBPATH = ['%s/lua-5.1.4/libs/%s' % ( GetLaunchDir(), g_os )] )
- local_env.Append( LIBS = ['lua5.1'] )
+ local_env.Append( LIBS = ['lua'] )
qagame_string += lua_string
# Jaybird - these lines are used to statically link c++'s dependencies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment