aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYotam Barnoy2010-08-31 15:24:08 +0000
committerYotam Barnoy2010-08-31 15:24:08 +0000
commitb5a17ca628e984fa13190c64fb5caef6108369ca (patch)
tree1a050aa7a615667131d7e05fcd167858879f99a1
parentc0b119feda86ea4bc3246868e59e583354656d70 (diff)
downloadscummvm-rg350-b5a17ca628e984fa13190c64fb5caef6108369ca.tar.gz
scummvm-rg350-b5a17ca628e984fa13190c64fb5caef6108369ca.tar.bz2
scummvm-rg350-b5a17ca628e984fa13190c64fb5caef6108369ca.zip
PSP: fix BS2 crash by disabling strict aliasing
The problem that caused the crash in BS2 had to do with GCC making improper assumptions about our code. Specifically, the alignment trick we use for READ_UINT32/16 allows some targets(e.g. MIPS) to generate better code, but it also goes against ANSI C aliasing rules, which prohibit the sharing of addresses between a struct and another variable value. Using -fno-strict-aliasing tells GCC not to assume strict ANSI C aliasing and also unfortunately prevents it from making some good optimizations. This change is probably needed for other platforms as well -- the crash on the PSP was simply a very rare coincidence. svn-id: r52473
-rw-r--r--backends/platform/psp/Makefile2
-rwxr-xr-xconfigure2
2 files changed, 2 insertions, 2 deletions
diff --git a/backends/platform/psp/Makefile b/backends/platform/psp/Makefile
index 617ef7c8cc..249d99c04b 100644
--- a/backends/platform/psp/Makefile
+++ b/backends/platform/psp/Makefile
@@ -66,7 +66,7 @@ endif
# Variables for common Scummvm makefile
CXX = psp-g++
-CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti
+CXXFLAGS = -O3 -Wall -Wno-multichar -fno-exceptions -fno-rtti -fno-strict-aliasing
DEFINES = -D__PSP__ -DNONSTANDARD_PORT -DDISABLE_TEXT_CONSOLE -DDISABLE_COMMAND_LINE -DUSE_ZLIB -DDISABLE_DOSBOX_OPL -DUSE_RGB_COLOR
LDFLAGS :=
diff --git a/configure b/configure
index ab33fee136..d737b6ecad 100755
--- a/configure
+++ b/configure
@@ -1485,7 +1485,7 @@ case $_host_os in
DEFINES="$DEFINES -D_EE -D__PLAYSTATION2__"
;;
psp)
- CXXFLAGS="$CXXFLAGS -O3 -I$PSPSDK/include -D_PSP_FW_VERSION=150"
+ CXXFLAGS="$CXXFLAGS -O3 -I$PSPSDK/include -D_PSP_FW_VERSION=150 -fno-strict-aliasing"
;;
solaris*)
DEFINES="$DEFINES -DSOLARIS -DSYSTEM_NOT_SUPPORTING_D_TYPE"