aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-12 00:22:29 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-12 00:22:29 -0500
commit0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 (patch)
tree6eaef0d8a720fa3da580de87b647fff796fe80b3 /tools
downloadmusl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.zip
musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.gz
musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.bz2
initial check-in, version 0.5.0v0.5.0
Diffstat (limited to 'tools')
-rw-r--r--tools/gen-musl-gcc.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/gen-musl-gcc.sh b/tools/gen-musl-gcc.sh
new file mode 100644
index 0000000..89f7f4d
--- /dev/null
+++ b/tools/gen-musl-gcc.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+printf '#!/bin/sh\n\nlibc_prefix="%s"\n' "$1"
+
+cat <<"EOF"
+libc_lib=$libc_prefix/lib
+libc_inc=$libc_prefix/include
+libc_crt="$libc_lib/crt1.o"
+libc_start="$libc_lib/crti.o"
+libc_end="$libc_lib/crtn.o"
+
+gcc_inc=$libc_inc
+libgcc="`gcc \"$@\" -print-file-name=libgcc.a`"
+
+gcc -wrapper sh,-c,'
+x= ; y= ; z= ; s= ; for i ; do
+ [ "$z" ] || set -- ; z=1
+ case "$i" in
+ -shared) s=1 ; set -- "$@" -shared ;;
+ -Lxxxxxx) x=1 ;;
+ -xxxxxx) x= ; [ "$s" ] || set -- "$@" "'"$libc_start"'" "'"$libc_crt"'" ;;
+ -l*) [ "$y" ] || set -- "$@" '"$libc_end"' ; set -- "$@" "$i" ; y=1 ;;
+ *) [ "$x" ] || set -- "$@" "$i" ;;
+ esac
+done
+exec "$0" "$@"
+' -std=gnu99 -nostdinc -nostdlib \
+ -isystem "$libc_inc" -isystem "$gcc_inc" \
+ -Wl,-xxxxxx "$@" -L"$libc_lib" -lc "$libgcc" -Lxxxxxx -Wl,-nostdlib
+EOF