Use --sysroot option properly with arm-linux-androideabi-4.4.3
Also fixes documentation (it's --sysroot=<path> instead of -sysroot <path>)
Change-Id: I0552f2d7b07737ca0cf1daf2725ee00d737222c3
diff --git a/docs/STANDALONE-TOOLCHAIN.html b/docs/STANDALONE-TOOLCHAIN.html
index 1fba9aa..cfe56f1 100644
--- a/docs/STANDALONE-TOOLCHAIN.html
+++ b/docs/STANDALONE-TOOLCHAIN.html
@@ -52,18 +52,17 @@
2/ Invoking the compiler (the hard way):
----------------------------------------
-Invoke the compiler using the -sysroot option to indicate where the system
+Invoke the compiler using the --sysroot option to indicate where the system
files for the platform you're targetting are located. For example, do:
- export CC="$NDK/toolchains/<name>/prebuilt/<system>/bin/<prefix>gcc -sysroot
-$SYSROOT"
+ export CC="$NDK/toolchains/<name>/prebuilt/<system>/bin/<prefix>gcc --sysroot=$SYSROOT"
$CC -o foo.o -c foo.c
Where <name> is the toolchain's name, <system> is the host tag for your system,
and <prefix> is a toolchain-specific prefix. For example, if you are on Linux
using the NDK r5 toolchain, you would use:
- export CC="$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -sysroot $SYSROOT"
+ export CC="$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=$SYSROOT"
As you can see, this is rather verbose, but it works!
@@ -94,7 +93,7 @@
in other words, they can be installed in any location, or even
moved if you need to.
-NOTE: You can still use the -sysroot option with the new toolchain, but it
+NOTE: You can still use the --sysroot option with the new toolchain, but it
is now simply optional!
diff --git a/toolchains/arm-linux-androideabi-4.4.3/setup.mk b/toolchains/arm-linux-androideabi-4.4.3/setup.mk
index ce35edd..a5b906d 100644
--- a/toolchains/arm-linux-androideabi-4.4.3/setup.mk
+++ b/toolchains/arm-linux-androideabi-4.4.3/setup.mk
@@ -121,6 +121,7 @@
$(TARGET_CXX) \
-Wl,-soname,$(notdir $@) \
-shared \
+ --sysroot=$(call host-path,$(SYSROOT)) \
$(call host-path, $(PRIVATE_OBJECTS)) \
$(call whole-archive-list-flags,$(PRIVATE_WHOLE_STATIC_LIBRARIES)) \
$(call host-path,\
@@ -133,9 +134,10 @@
endef
define cmd-build-executable
-$(TARGET_CC) \
+$(TARGET_CXX) \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
+ --sysroot=$(call host-path,$(SYSROOT)) \
$(call host-path, $(PRIVATE_OBJECTS)) \
$(call whole-archive-list-flags,$(PRIVATE_WHOLE_STATIC_LIBRARIES)) \
$(call host-path,\