summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2011-06-07 11:56:23 +0000
committerNils Wallménius <nils@rockbox.org>2011-06-07 11:56:23 +0000
commit331b23d15b765489a9abd344ddab9771125c3754 (patch)
tree39b809790113945740bec94cfbe27eb4113ef498
parentf9f96325e20be46d1cf12492818485f2f84c3c3a (diff)
downloadrockbox-331b23d15b765489a9abd344ddab9771125c3754.zip
rockbox-331b23d15b765489a9abd344ddab9771125c3754.tar.gz
rockbox-331b23d15b765489a9abd344ddab9771125c3754.tar.bz2
rockbox-331b23d15b765489a9abd344ddab9771125c3754.tar.xz
FS#12144, Use -fPIC -fvisibility=hidden only for plugins on sim and app builds and enable it for 32 bit too. Fixes linking errors on simbuilds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29983 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/codecs.make3
-rw-r--r--apps/plugins/doom/SOURCES1
-rw-r--r--apps/plugins/doom/doom.make1
-rw-r--r--apps/plugins/lua/Makefile2
-rw-r--r--apps/plugins/plugins.make3
-rw-r--r--apps/plugins/rockboy/SOURCES1
-rw-r--r--apps/plugins/rockboy/rockboy.make1
-rwxr-xr-xtools/configure39
8 files changed, 25 insertions, 26 deletions
diff --git a/apps/codecs/codecs.make b/apps/codecs/codecs.make
index be1a0e0..1a5dd8f 100644
--- a/apps/codecs/codecs.make
+++ b/apps/codecs/codecs.make
@@ -112,7 +112,8 @@ $(CODECDIR)/%.o: $(ROOTDIR)/apps/codecs/%.S
-I$(dir $<) $(CODECFLAGS) $(ASMFLAGS) -c $< -o $@
ifdef APP_TYPE
- CODECLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
+ CODECLDFLAGS = $(SHARED_LDFLAG) # <-- from Makefile
+ CODECFLAGS += $(SHARED_CFLAGS) # <-- from Makefile
else
CODECLDFLAGS = -T$(CODECLINK_LDS) -Wl,--gc-sections -Wl,-Map,$(CODECDIR)/$*.map
CODECFLAGS += -UDEBUG -DNDEBUG
diff --git a/apps/plugins/doom/SOURCES b/apps/plugins/doom/SOURCES
index 6cd69fa..470cbf1 100644
--- a/apps/plugins/doom/SOURCES
+++ b/apps/plugins/doom/SOURCES
@@ -1,3 +1,4 @@
+../../../firmware/libc/sscanf.c
info.c
doomdef.c
doomstat.c
diff --git a/apps/plugins/doom/doom.make b/apps/plugins/doom/doom.make
index 58a4708..07b553c 100644
--- a/apps/plugins/doom/doom.make
+++ b/apps/plugins/doom/doom.make
@@ -13,7 +13,6 @@ DOOMBUILDDIR := $(BUILDDIR)/apps/plugins/doom
ROCKS += $(DOOMBUILDDIR)/doom.rock
DOOM_SRC := $(call preprocess, $(DOOMSRCDIR)/SOURCES)
-DOOM_SRC += $(ROOTDIR)/firmware/libc/sscanf.c
DOOM_OBJ := $(call c2obj, $(DOOM_SRC))
# add source files to OTHER_SRC to get automatic dependencies
diff --git a/apps/plugins/lua/Makefile b/apps/plugins/lua/Makefile
index 09535ac..8568d79 100644
--- a/apps/plugins/lua/Makefile
+++ b/apps/plugins/lua/Makefile
@@ -55,7 +55,7 @@ ifdef APP_TYPE
# This is the SDL simulator version
$(OUTPUT): $(OBJS)
- $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_FLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
+ $(call PRINTS,LD $(@F))$(CC) $(CFLAGS) $(SHARED_LDFLAG) $(OBJS) -L$(BUILDDIR) -lplugin -o $@
ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
# 'x' must be kept or you'll have "Win32 error 5"
# $ fgrep 5 /usr/include/w32api/winerror.h | head -1
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make
index 3271c57..0c667aa 100644
--- a/apps/plugins/plugins.make
+++ b/apps/plugins/plugins.make
@@ -98,7 +98,8 @@ $(BUILDDIR)/apps/plugins/%.o: $(ROOTDIR)/apps/plugins/%.c
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -c $< -o $@
ifdef APP_TYPE
- PLUGINLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
+ PLUGINLDFLAGS = $(SHARED_LDFLAG) # <-- from Makefile
+ PLUGINFLAGS += $(SHARED_CFLAGS) # <-- from Makefile
else
PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
OVERLAYLDFLAGS = -T$(OVERLAYREF_LDS) -Wl,--gc-sections -Wl,-Map,$*.refmap
diff --git a/apps/plugins/rockboy/SOURCES b/apps/plugins/rockboy/SOURCES
index 8806b58..b289db2 100644
--- a/apps/plugins/rockboy/SOURCES
+++ b/apps/plugins/rockboy/SOURCES
@@ -1,3 +1,4 @@
+../../../firmware/libc/sscanf.c
cpu.c
emu.c
events.c
diff --git a/apps/plugins/rockboy/rockboy.make b/apps/plugins/rockboy/rockboy.make
index d7ae68c..4869ced 100644
--- a/apps/plugins/rockboy/rockboy.make
+++ b/apps/plugins/rockboy/rockboy.make
@@ -11,7 +11,6 @@ ROCKBOY_SRCDIR = $(APPSDIR)/plugins/rockboy
ROCKBOY_OBJDIR = $(BUILDDIR)/apps/plugins/rockboy
ROCKBOY_SRC := $(call preprocess, $(ROCKBOY_SRCDIR)/SOURCES)
-ROCKBOY_SRC += $(ROOTDIR)/firmware/libc/sscanf.c
ROCKBOY_OBJ := $(call c2obj, $(ROCKBOY_SRC))
OTHER_SRC += $(ROCKBOY_SRC)
diff --git a/tools/configure b/tools/configure
index 461e00c..b46037c 100755
--- a/tools/configure
+++ b/tools/configure
@@ -225,7 +225,8 @@ simcc () {
fi
# default share option, override below if needed
- SHARED_FLAG="-shared"
+ SHARED_LDFLAG="-shared"
+ SHARED_CFLAGS="-fPIC -fvisibility=hidden"
if [ "$win32crosscompile" = "yes" ]; then
LDOPTS="$LDOPTS -mconsole"
@@ -267,7 +268,7 @@ simcc () {
sigaltstack=`check_sigaltstack`
echo "Darwin host detected"
LDOPTS="$LDOPTS -ldl"
- SHARED_FLAG="-dynamiclib -Wl\,-single_module"
+ SHARED_LDFLAG="-dynamiclib -Wl\,-single_module"
;;
SunOS)
@@ -305,20 +306,11 @@ simcc () {
GCCOPTS="$GCCOPTS -I\$(SIMDIR)"
if test "X$win32crosscompile" != "Xyes"; then
- case `uname -m` in
- x86_64|amd64)
- # fPIC is needed to make shared objects link
- # setting visibility to hidden is necessary to avoid strange crashes
- # due to symbol clashing
- GCCOPTS="$GCCOPTS -fPIC -fvisibility=hidden"
- # x86_64 supports MMX by default
- ;;
-
- i686)
- echo "Enabling MMX support"
- GCCOPTS="$GCCOPTS -mmmx"
- ;;
- esac
+ if test "`uname -m`" = "i686"; then
+ echo "Enabling MMX support"
+ GCCOPTS="$GCCOPTS -mmmx"
+ fi
+ # x86_64 supports MMX by default
id=$$
cat >$tmpdir/conftest-$id.c <<EOF
@@ -532,7 +524,8 @@ maemocc () {
GCCOPTIMIZE=''
LDOPTS="-lm -ldl $LDOPTS"
GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs"
- SHARED_FLAG="-shared"
+ SHARED_LDFLAG="-shared"
+ SHARED_CFLAGS=''
endian="little"
thread_support="HAVE_SIGALTSTACK_THREADS"
@@ -626,7 +619,8 @@ pandoracc () {
GCCOPTIMIZE=''
LDOPTS="-lm -ldl $LDOPTS"
GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs"
- SHARED_FLAG="-shared"
+ SHARED_LDFLAG="-shared"
+ SHARED_CFLAGS=''
endian="little"
thread_support="HAVE_SIGALTSTACK_THREADS"
@@ -671,7 +665,8 @@ androidcc () {
--sysroot=$ANDROID_NDK_PATH/platforms/android-4/arch-arm"
LDOPTS="$LDOPTS -shared -nostdlib -ldl -llog"
endian="little"
- SHARED_FLAG="-shared"
+ SHARED_LDFLAG="-shared"
+ SHARED_CFLAGS=''
}
whichadvanced () {
@@ -3686,7 +3681,8 @@ sed > Makefile \
-e "s<@PLUGINS@<${plugins}<g" \
-e "s<@CODECS@<${swcodec}<g" \
-e "s<@PROFILE_OPTS@<${PROFILE_OPTS}<g" \
- -e "s<@SHARED_FLAG@<${SHARED_FLAG}<g" \
+ -e "s<@SHARED_LDFLAG@<${SHARED_LDFLAG}<g" \
+ -e "s<@SHARED_CFLAGS@<${SHARED_CFLAGS}<g" \
-e "s<@GCCOPTS@<${GCCOPTS}<g" \
-e "s<@TARGET_INC@<${TARGET_INC}<g" \
-e "s<@LDOPTS@<${LDOPTS}<g" \
@@ -3774,7 +3770,8 @@ export SIMDIR=\$(ROOTDIR)/uisimulator/sdl
export GCCOPTS=@GCCOPTS@
export TARGET_INC=@TARGET_INC@
export LOADADDRESS=@LOADADDRESS@
-export SHARED_FLAG=@SHARED_FLAG@
+export SHARED_LDFLAG=@SHARED_LDFLAG@
+export SHARED_CFLAGS=@SHARED_CFLAGS@
export LDOPTS=@LDOPTS@
export GLOBAL_LDOPTS=@GLOBAL_LDOPTS@
export GCCVER=@GCCVER@