Skip to content

Commit

Permalink
Apply original CFLAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
pasko committed Aug 13, 2014
1 parent e549054 commit 71d96e3
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 32 deletions.
2 changes: 1 addition & 1 deletion library.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ int64_t TimeDiffMicros(const struct timespec* start, const struct timespec* end)
return 1000000 * sec_diff + (end->tv_nsec - start->tv_nsec) / 1000;
}

void RunBenchmark() {
void __attribute__ ((visibility ("default"))) RunBenchmark() {
const size_t kNumIterations = 1024 * 1024 * 1024;
struct timespec start, end;

Expand Down
5 changes: 4 additions & 1 deletion library_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#include <stdio.h>

int __attribute__ ((visibility ("default"))) gLast;

int Helper(int i) {
return i + 5;
gLast = i + 5;
return gLast;
}
112 changes: 82 additions & 30 deletions maker
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,93 @@ ADB=$ANDROID_TOOLS/sdk/platform-tools/adb
GCC_VERSION=4.9
ANDROID_CC="$ANDROID_TOOLS/ndk/toolchains/arm-linux-androideabi-$GCC_VERSION/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc"
ANDROID_SYSROOT_FLAGS="--sysroot=$ANDROID_TOOLS/ndk/platforms/android-14/arch-arm"
ANDROID_STLPORT_FLAGS="-isystem$ANDROID_TOOLS/ndk//sources/cxx-stl/stlport/stlport"
ANDROID_LIBGCC_A="$ANDROID_TOOLS/ndk/toolchains/arm-linux-androideabi-$GCC_VERSION/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/$GCC_VERSION/libgcc.a"

CFLAGS="-Os -std=c99"
# CFLAGS="-Os -std=c99"

CFLAGS=" \
-fstack-protector \
--param=ssp-buffer-size=4 \
-fno-exceptions \
-fno-strict-aliasing \
-Wall \
-Wno-unused-parameter \
-Wno-missing-field-initializers \
-fvisibility=hidden \
-pipe \
-fPIC \
-Wno-unused-local-typedefs \
-march=armv7-a \
-mtune=generic-armv7-a \
-mfpu=vfpv3-d16 \
-mfloat-abi=softfp \
-mthumb \
-fno-tree-sra \
-fno-partial-inlining \
-fno-early-inlining \
-fno-tree-copy-prop \
-fno-tree-loop-optimize \
-fno-move-loop-invariants \
-fno-caller-saves \
-Wno-psabi \
-mthumb-interwork \
-ffunction-sections \
-funwind-tables \
-g \
-fstack-protector \
-fno-short-enums \
-finline-limit=64 \
-Wa,--noexecstack \
-Os \
-fno-ident \
-fdata-sections \
-ffunction-sections \
-fomit-frame-pointer \
-fno-unwind-tables \
-fno-asynchronous-unwind-tables \
-fno-rtti \
-fno-threadsafe-statics \
-fvisibility-inlines-hidden \
-Wsign-compare \
-Wno-abi \
-std=c99 \
-Wno-narrowing \
-Wno-literal-suffix"

LDFLAGS=""
LDFLAGS_SO_BEGIN="-shared \
-Wl,-z,now \
-Wl,-z,relro \
-Wl,--fatal-warnings \
-Wl,-z,noexecstack \
-fPIC \
-Wl,--gc-sections \
-fuse-ld=gold \
-nostdlib \
-Wl,--no-undefined \
$ANDROID_SYSROOT_FLAGS \
-Wl,--icf=safe \
-L$ANDROID_TOOLS/ndk//sources/cxx-stl/stlport/libs/armeabi-v7a \
-Wl,-shared,-Bsymbolic \
$ANDROID_TOOLS/ndk//platforms/android-14/arch-arm/usr/lib/crtbegin_so.o \
-Wl,-O1 \
-Wl,--as-needed"
-Wl,-z,now \
-Wl,-z,relro \
-Wl,--fatal-warnings \
-Wl,-z,noexecstack \
-fPIC \
-Wl,--gc-sections \
-fuse-ld=gold \
-nostdlib \
-Wl,--no-undefined \
$ANDROID_SYSROOT_FLAGS \
-Wl,--icf=safe \
-L$ANDROID_TOOLS/ndk//sources/cxx-stl/stlport/libs/armeabi-v7a \
-Wl,-shared,-Bsymbolic \
$ANDROID_TOOLS/ndk//platforms/android-14/arch-arm/usr/lib/crtbegin_so.o \
-Wl,-O1 \
-Wl,--as-needed"
LDFLAGS_SO_END=" \
-Wl,--warn-shared-textrel \
-Wl,--whole-archive \
-Wl,--no-whole-archive \
-landroid \
-ljnigraphics \
-llog \
-lGLESv2 \
-lstlport_static \
$ANDROID_LIBGCC_A \
-lc \
-ldl \
-lm \
$ANDROID_TOOLS/ndk//platforms/android-14/arch-arm/usr/lib/crtend_so.o"
-Wl,--warn-shared-textrel \
-Wl,--whole-archive \
-Wl,--no-whole-archive \
-landroid \
-ljnigraphics \
-llog \
-lGLESv2 \
-lstlport_static \
$ANDROID_LIBGCC_A \
-lc \
-ldl \
-lm \
$ANDROID_TOOLS/ndk//platforms/android-14/arch-arm/usr/lib/crtend_so.o \
-Wl,--fatal-warnings -Wl,-flto"

"$ANDROID_CC" $ANDROID_SYSROOT_FLAGS $CFLAGS -fPIC \
-c library.c -o library.o
Expand Down

0 comments on commit 71d96e3

Please sign in to comment.