-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathagcc
executable file
·97 lines (83 loc) · 2.69 KB
/
agcc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh
NDK_HOME=~/droid/android-ndk
# 8 - Froyo/2.2, 15 - Ice Cream Sandwich/4.0.3
PLATFORM_DIR=$NDK_HOME/platforms/android-15
if [ -n "$GOOGLE_PLATFORM" ]; then
PLATFORM_DIR=$NDK_HOME/platforms/android-$GOOGLE_PLATFORM
fi
case "$ARCH_NAME" in
x86)
TOOLCHAIN=$NDK_HOME/default-x86-toolchain
BIN=$TOOLCHAIN/bin
GCC=$BIN/i686-linux-android-gcc
ARCH_NAME=x86
;;
arm)
TOOLCHAIN=$NDK_HOME/default-arm-toolchain
BIN=$TOOLCHAIN/bin
GCC=$BIN/arm-linux-androideabi-gcc
ARCH_NAME=arm
;;
mips)
TOOLCHAIN=$NDK_HOME/default-mips-toolchain
BIN=$TOOLCHAIN/bin
GCC=$BIN/mipsel-linux-android-gcc
ARCH_NAME=mips
;;
*)
echo unknown architecture \"$ARCH_NAME\" >&2
exit 1
;;
esac
LIBGCC=~/droid/lib-$ARCH_NAME/libgcc.a
PLATFORM_LIB_DIR=$PLATFORM_DIR/arch-$ARCH_NAME/usr/lib/
PLATFORM_INCLUDE_DIR=$PLATFORM_DIR/arch-$ARCH_NAME/usr/include/
ANDROID_PORTS_INCLUDE=~/droid/include/
CRTBEGIN=$PLATFORM_LIB_DIR/crtbegin_dynamic.o
CRTEND=$PLATFORM_LIB_DIR/crtend_android.o
ENDLIBS=""
LINKERARGS=""
INCLUDEARGS=""
# devel package libraries
if [ -d ~/droid/data/local/lib-$ARCH_NAME ]; then
DATA_LIBDIR=~/droid/data/local/lib-$ARCH_NAME
LINKERARGS="-L$DATA_LIBDIR -Wl,-rpath-link=$DATA_LIBDIR"
fi
# devel package headers
if [ -d ~/droid/data/local/include ]; then
INCLUDEARGS="-I"`echo ~/droid/data/local/include`
fi
if echo " " "$*" | egrep -q -- '(^| )-shared '; then
# tell gcc to not use the built-in default libraries
LINKERARGS="$LINKERARGS -nostdlib"
# where to find the system libraries like bionic
LINKERARGS="$LINKERARGS -L$PLATFORM_LIB_DIR"
# link against bionic (libc)
LINKERARGS="$LINKERARGS -lc"
# tell ld where to find system libraries at link time
LINKERARGS="$LINKERARGS -Wl,-rpath-link=$PLATFORM_LIB_DIR"
# needed for things like __aeabi_ulcmp
ENDLIBS="$LIBGCC"
elif echo " " "$*" | egrep -q -- '(^| )-(c|S|E|nostdlib) '; then
# linker not used for these or we're passing our own linker arguments
LINKERARGS=""
else
# tell gcc to not use the built-in default libraries
LINKERARGS="$LINKERARGS -nostdlib"
# where to find the executable start/stop objects
LINKERARGS="$LINKERARGS $CRTBEGIN $CRTEND"
# where to find the system libraries like bionic
LINKERARGS="$LINKERARGS -L$PLATFORM_LIB_DIR"
# link against bionic (libc)
LINKERARGS="$LINKERARGS -lc"
# tell ld where to find system libraries at link time
LINKERARGS="$LINKERARGS -Wl,-rpath-link=$PLATFORM_LIB_DIR"
# needed for things like __aeabi_ulcmp
ENDLIBS="$LIBGCC"
fi
CMDARGS="$INCLUDEARGS -isystem $ANDROID_PORTS_INCLUDE -isystem $PLATFORM_INCLUDE_DIR $LINKERARGS"
if [ -n "$DEBUG_AGCC" ]; then
set -x
echo "STAR: $*"
fi
$GCC $CMDARGS "$@" $ENDLIBS