Linux: Fix the exeption check up a bit, and mess with the configure.ac file. It should now be possible to compile with versions of gcc lower then 4.3, though I haven't tested that.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1210 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-17 09:23:32 +00:00
parent ac00db5dd5
commit 0391b76015
4 changed files with 157 additions and 87 deletions

View File

@ -11,8 +11,14 @@
#Optimized, but a devbuild
export PCSX2OPTIONS="--enable-devbuild --prefix `pwd`"
#Debug / Devbuild version
#export PCSX2OPTIONS="--enable-debug --enable-devbuild --prefix `pwd`"
#Debug version (which now implies a devbuild)
#export PCSX2OPTIONS="--enable-debug --prefix `pwd`"
#Normal, but unoptimized
#export PCSX2OPTIONS="--disable-optimization --prefix `pwd`"
#Normal, with warnings
#export PCSX2OPTIONS="--enable-warnings --prefix `pwd`"
#ZeroGS Normal mode
export ZEROGSOPTIONS="--enable-sse2"
@ -27,6 +33,7 @@ option=$@
export PCSX2PLUGINS="`pwd`/bin/plugins"
curdir=`pwd`
echo
echo "Building the Pcsx2 Suite."
echo "Note: binaries generated are 32 bit, and require 32 bit versions of all dependencies."
cd ${curdir}/plugins
@ -38,6 +45,7 @@ echo Error with building plugins
exit 1
fi
echo
echo "Building Pcsx2."
echo "Note: binaries generated are 32 bit, and require 32 bit versions of all dependencies."
cd ${curdir}/pcsx2

View File

@ -26,7 +26,7 @@ static uptr current_offset = 0;
static uptr offset_counter = 0;
bool Slots[5] = { false, false, false, false, false };
void InstallLinuxExceptionHandler()
__noinline void InstallLinuxExceptionHandler()
{
struct sigaction sa;
@ -36,15 +36,25 @@ void InstallLinuxExceptionHandler()
sigaction(SIGSEGV, &sa, NULL);
}
void ReleaseLinuxExceptionHandler()
__noinline void ReleaseLinuxExceptionHandler()
{
// Code this later.
// This may be called too early or something, since implementing it causes all games to segfault.
// I'll look in to it. --arcum42
}
__noinline void KillLinuxExceptionHandler()
{
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESETHAND;
//sa.sa_sigaction = &SysPageFaultExceptionFilter;
sigaction(SIGSEGV, &sa, NULL);
}
static const uptr m_pagemask = getpagesize()-1;
// Linux implementation of SIGSEGV handler. Bind it using sigaction().
void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * )
__noinline void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * )
{
// get bad virtual address
uptr offset = (u8*)info->si_addr - psM;
@ -60,6 +70,7 @@ void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * )
if (offset_counter > 500)
{
DevCon::Status( "Offset 0x%x endlessly repeating. Aborting.", params offset );
KillLinuxExceptionHandler();
assert( false );
}
}
@ -69,6 +80,7 @@ void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * )
// Bad mojo! Completely invalid address.
// Instigate a crash or abort emulation or something.
DevCon::Status( "Offset 0x%x invalid. Legit SIGSEGV. Aborting.", params offset );
KillLinuxExceptionHandler();
assert( false );
}
@ -205,7 +217,6 @@ void OnStates_Load(GtkMenuItem *menuitem, gpointer user_data)
}
sscanf(name, "Slot %d", &i);
//if (States_Load(i)) ExecuteCpu();
States_Load(i);
RefreshMenuSlots();
}
@ -218,8 +229,6 @@ void OnLoadOther_Ok(GtkButton* button, gpointer user_data)
File = (gchar*)gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
strcpy(str, File);
gtk_widget_destroy(FileSel);
//if (States_Load(str)) ExecuteCpu();
States_Load(str);
RefreshMenuSlots();
}
@ -399,13 +408,13 @@ namespace HostSys
{
// Breakpoint this to trap potentially inappropriate use of page protection, which would
// be caused by failed aligned directives on global vars.
/*if( (baseaddr & m_pagemask) != 0 )
if( ((uptr)baseaddr & m_pagemask) != 0 )
{
Console::Error(
"*PCSX2/Linux Warning* Inappropriate use of page protection detected.\n"
"\tbaseaddr not page aligned: 0x%08X", params (uptr)baseaddr
);
}*/
}
int lnxmode = 0;

View File

@ -18,7 +18,7 @@
#
#Normal
#export PCSX2OPTIONS="--enable-debug --enable-devbuild --enable-sse3 --enable-sse4 --prefix `pwd`"
#export PCSX2OPTIONS="--prefix `pwd`"
echo ---------------
echo Building Pcsx2

View File

@ -1,4 +1,4 @@
AC_INIT(pcsx2,0.9.6,zerofrog@gmail.com)
AC_INIT(pcsx2,0.9.6,arcum42@gmail.com)
AM_INIT_AUTOMAKE(pcsx2,0.9.6)
AC_PROG_CC([gcc g++ cl KCC CC cxx cc++ xlC aCC c++])
@ -11,6 +11,81 @@ dnl necessary for compiling assembly
AM_PROG_AS
AC_CONFIG_MACRO_DIR([m4])
if test "x$GCC" = "xyes"; then
dnl get gcc version
AC_MSG_CHECKING([gcc version])
gccver=$($CC -dumpversion)
gccvermajor=$(echo $gccver | cut -d . -f1)
gccverminor=$(echo $gccver | cut -d . -f2)
gccverrevision=$(echo $gccver | cut -d . -f3)
gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor "*" 10 + $gccverrevision)
AC_MSG_RESULT($gccver)
fi
AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings], [Add warning flags when compiling]),
warnings=$enableval,warnings=no)
AC_ARG_ENABLE(customcflags, AC_HELP_STRING([--enable-customcflags], [Use custom CFLAGS]),
customcflags=$enableval,customcflags=no)
AC_ARG_ENABLE(optimization, AC_HELP_STRING([--disable-optimization], [No optimizations when compiling]),
optimization=$enableval,optimization=yes)
AC_ARG_ENABLE(unsupportedspeedfreak, AC_HELP_STRING([--enable-unsupportedspeedfreak], [Set the compiler to do unreasonable optimizations that will probably make all your games crash.]),
unsupportedspeedfreak=$enableval,unsupportedspeedfreak=no)
dnl Check for debug build
AC_MSG_CHECKING(debug build)
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]),
debug=$enableval,debug=no)
if test "x$debug" == "xyes"
then
AC_DEFINE(_DEBUG,1,[_DEBUG])
AC_DEFINE(PCSX2_DEVBUILD,1,[PCSX2_DEVBUILD])
MYOBJDIR="Debug"
optimization="no"
warnings="yes"
else
AC_DEFINE(NDEBUG,1,[NDEBUG])
MYOBJDIR="Release"
fi
AC_MSG_RESULT($debug)
dnl Check for dev build
AC_MSG_CHECKING(for development build)
AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]),
devbuild=$enableval,devbuild=no)
if test "x$debug" == "xyes"
then
dnl Force devbuild on, because Debug mode never seems to stay working properly without Devbuild on.
devbuild=yes
fi
if test "x$devbuild" == "xyes"
then
AC_DEFINE(PCSX2_DEVBUILD,1,[PCSX2_DEVBUILD])
MYOBJDIR="Dev"
nowarnings="no"
fi
AC_MSG_RESULT($devbuild)
AC_ARG_ENABLE(nls, AC_HELP_STRING([--disable-nls], [Disable nls support]),
nls=$enableval,nls=yes)
if test "x$nls" == xyes
then
AC_CHECK_HEADER([libintl.h], [AC_DEFINE(ENABLE_NLS,1,[__x86_64__])])
fi
AC_ARG_ENABLE(local-inis, AC_HELP_STRING([--enable-local-inis], [Enable local plugin inis]),
localinis=$enableval, localinis=no)
if test "x$localinis" == xyes
then
AC_DEFINE(LOCAL_PLUGIN_INIS)
fi
svnrev="`svn info | grep Revision:`"
if test -n "${svnrev}" ; then
@ -23,69 +98,60 @@ else
[Define to be the subversion revision number])
fi
AC_ARG_ENABLE(customcflags, AC_HELP_STRING([--enable-customcflags], [Use custom CFLAGS]),
customcflags=$enableval,customcflags=no)
if test "x$customcflags" == xno
if test "x$customcflags" == "xno"
then
CFLAGS=
CPPFLAGS=
CXXFLAGS=
CCASFLAGS=
else
DEBUG_FLAGS=" -O0 -g "
CFLAGS=
CPPFLAGS=
CXXFLAGS=
CCASFLAGS=
fi
WARNING_FLAGS="-Wno-format -Wno-unused-parameter -Wno-unused-value -Wunused-variable "
EXTRA_WARNING_FLAGS="-Wall -Wextra"
NORMAL_FLAGS=" -pipe -msse -msse2 -O2 ${WARNING_FLAGS}"
# These optimizations seem to cause issues with GCC 4.3.3, so we'll turn them off. Comment if not on 4.3+
NORMAL_FLAGS+=" -fno-guess-branch-probability -fno-dse -fno-tree-dse "
WARNING_FLAGS=
NORMAL_FLAGS=
DEBUG_FLAGS+=" -g -msse -msse2 ${EXTRA_WARNING_FLAGS} ${WARNING_FLAGS} "
dnl Check for debug build
AC_MSG_CHECKING(debug build)
AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [debug build]),
debug=$enableval,debug=no)
if test "x$debug" == xyes
if test "x$warnings" == "xyes"
then
AC_DEFINE(_DEBUG,1,[_DEBUG])
CFLAGS+=" ${DEBUG_FLAGS} -Xlinker -zmuldefs -m32 "
CXXFLAGS+=" ${DEBUG_FLAGS} -fpermissive -Xlinker -zmuldefs -m32 "
CCASFLAGS+=" -D_DEBUG ${DEBUG_FLAGS} -m32 "
MYOBJDIR="Debug"
WARNING_FLAGS+=" -Wall -Wextra -Wunused-variable "
fi
WARNING_FLAGS+=" -Wno-format -Wno-unused-parameter -Wno-unused-value "
NORMAL_FLAGS+=" -msse -msse2 ${WARNING_FLAGS} "
if test "x$unsupportedspeedfreak" == "xyes"
then
dnl Don't even try to get support for this.
NORMAL_FLAGS+=" -pipe -O3 -march=native -funroll-loops -ffast-math "
else
AC_DEFINE(NDEBUG,1,[NDEBUG])
CFLAGS+=" ${NORMAL_FLAGS} -m32 "
if test "x$optimization" == "xyes"
then
NORMAL_FLAGS+=" -pipe -O2 "
else
NORMAL_FLAGS+=" -O0 "
fi
fi
if test "x$unsupportedspeedfreak" == "xno"
then
dnl These optimizations seem to cause issues with GCC 4.3.3, so we'll turn them off.
dnl I really need to run some tests and see if they are still needed.
if test "$gccvernum" -ge "433"; then
NORMAL_FLAGS+=" -fno-guess-branch-probability -fno-dse -fno-tree-dse "
fi
fi
CFLAGS+=" ${NORMAL_FLAGS} -Xlinker -zmuldefs -m32 "
CXXFLAGS+=" ${NORMAL_FLAGS} -fpermissive -Xlinker -zmuldefs -m32 "
CCASFLAGS+=" ${NORMAL_FLAGS} -m32 "
MYOBJDIR="Release"
CCASFLAGS+=" ${NORMAL_FLAGS} -m32 "
if test "x$debug" == "xyes"
then
CFLAGS+=" -g "
CXXFLAGS+=" -g "
CCASFLAGS+=" -D_DEBUG "
fi
AC_MSG_RESULT($debug)
AC_CHECK_FUNCS([ _aligned_malloc _aligned_free ], AC_DEFINE(HAVE_ALIGNED_MALLOC))
#AC_MSG_CHECKING(turn on microVU)
#AC_ARG_ENABLE(microVU, AC_HELP_STRING([--enable-microVU], [Turns on the currently incomplete microVU files - Not a good idea]),
# microVU=$enableval,microVU=no)
#if test "x$microVU" == xyes
#then
# AC_DEFINE(PCSX2_MICROVU,1,[PCSX2_MICROVU])
#fi
#AC_MSG_RESULT($microVU)
dnl Check for dev build
AC_MSG_CHECKING(for development build)
AC_ARG_ENABLE(devbuild, AC_HELP_STRING([--enable-devbuild], [Special Build for developers that simplifies testing and adds extra checks]),
devbuild=$enableval,devbuild=no)
if test "x$devbuild" == xyes
then
AC_DEFINE(PCSX2_DEVBUILD,1,[PCSX2_DEVBUILD])
MYOBJDIR=$MYOBJDIR"Dev"
fi
AC_MSG_RESULT($devbuild)
dnl gtk
AC_MSG_CHECKING(gtk+)
AC_CHECK_PROG(GTK_CONFIG, pkg-config, pkg-config)
@ -95,20 +161,6 @@ dnl AC_CHECK_LIB(pthread,main,[LIBS="$LIBS -lpthread"])
AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"])
AC_CHECK_LIB(z,main,[LIBS="$LIBS -lz"])
AC_ARG_ENABLE(nls, AC_HELP_STRING([--disable-nls], [Disable nls support]),
nls=$enableval,nls=yes)
if test "x$nls" == xyes
then
AC_CHECK_HEADER([libintl.h], [AC_DEFINE(ENABLE_NLS,1,[__x86_64__])])
fi
AC_ARG_ENABLE(local-inis, AC_HELP_STRING([--enable-local-inis], [Enable local plugin inis]),
localinis=$enableval, localinis=no)
if test "x$localinis" == xyes
then
AC_DEFINE(LOCAL_PLUGIN_INIS)
fi
AC_OUTPUT([
Makefile
CDVD/Makefile
@ -126,11 +178,12 @@ AC_OUTPUT([
dnl bindir = pcsx2exe
echo "Configuration:"
echo " Target system type: $target"
echo " Debug build? $debug"
echo " Dev build? $devbuild"
echo " nls support? $nls"
echo " local plugin inis? $localinis"
echo " custom cflags? $customcflags"
echo " memcpy_fast? $memcpyfast"
#echo " microVU? $microVU"
echo " Target system type: $target"
echo " Debug build? $debug"
echo " Dev build? $devbuild"
echo " NLS support? $nls"
echo " Local plugin inis? $localinis"
echo " Custom cflags? $customcflags"
echo " Compiler warnings? $warnings"
echo " Compiler optimizations? $optimization"