summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Sindholt <opensource@zhasha.com>2016-02-17 13:35:46 +0100
committerJoakim Sindholt <opensource@zhasha.com>2016-02-17 13:35:46 +0100
commit35f2549b6327a3728e72eefbf048d35e36364737 (patch)
treeeff24ae092c591444ded1537f890ef85dd295cde
parent7c923730de6bef0a9eca2fa8c1a941537a0a17b4 (diff)
update compiler-rt
by replacing their fucking retarded build build systems
-rw-r--r--bin/build-libc.sh10
-rw-r--r--mkfile5
-rw-r--r--src/clang_linux_builtin_386.mk24
-rw-r--r--src/clang_linux_builtin_amd64.mk24
-rw-r--r--src/clang_linux_builtin_arm.mk24
m---------src/compiler-rt0
-rw-r--r--src/compiler-rt.mk62
7 files changed, 66 insertions, 83 deletions
diff --git a/bin/build-libc.sh b/bin/build-libc.sh
index 68b88ac..57af0df 100644
--- a/bin/build-libc.sh
+++ b/bin/build-libc.sh
@@ -68,17 +68,11 @@ Linux)
if [[ ! -e "$OBJDIR/compiler-rt-revision" ||
"$(cat "$OBJDIR/compiler-rt-revision")" != "$COMPILERRTREV" ]]
then
- cd "${SRCDIR}/compiler-rt" && \
- cp ../clang_linux_builtin_${objtype}.mk make/platform/ && \
- rm -rf clang_linux_builtin_$objtype && \
- make -j$NJOBS clang_linux_builtin_$objtype && \
- mkdir -p "$OBJDIR/lib" && \
- cp clang_linux_builtin_$objtype/builtins-$MUSLARCH/libcompiler_rt.a "$OBJDIR/lib/" && \
+ make -C "${SRCDIR}" -f compiler-rt.mk -j${NJOBS} install &&
echo "$COMPILERRTREV" > "$OBJDIR/compiler-rt-revision"
if [ ! $? -eq 0 ]; then exit 2; fi
- rm -rf "$SRCDIR/compiler-rt/clang_linux_builtin_$objtype"
- rm -f "$SRCDIR/compiler-rt/make/platform/clang_linux_builtin_${objtype}.mk"
+ make -C "${SRCDIR}" -f compiler-rt.mk clean
fi
exit 0
diff --git a/mkfile b/mkfile
index adcbd47..ee6e315 100644
--- a/mkfile
+++ b/mkfile
@@ -6,11 +6,10 @@ libc:V:
clean:V:
for a in 386 amd64 arm mips power power64 sparc spim; do
(cd $a && rm -rf bin include lib musl-revision compiler-rt-revision)
- rm -rf src/compiler-rt/clang_linux_builtin_$a
- rm -f src/compiler-rt/make/platform/clang_linux_builtin_${a}.mk
done
for f in include/*; do
if [ "$f" != "include/u.h" ]; then rm -rf "$f"; fi
done
- (cd src/musl && make distclean ARCH=bug >/dev/null)
+ make -C src/musl distclean ARCH=bug >/dev/null
+ make -C src -f compiler-rt.mk clean >/dev/null
rm -f src/build-lock
diff --git a/src/clang_linux_builtin_386.mk b/src/clang_linux_builtin_386.mk
deleted file mode 100644
index dde8441..0000000
--- a/src/clang_linux_builtin_386.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-Description := Static runtime libraries for clang/Linux.
-
-###
-
-CC := clang
-Arch := unknown
-Configs := builtins-i386
-
-CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer -fPIE -ftls-model=local-exec \
- -integrated-as --sysroot $(ProjSrcRoot) \
- -isystem $(ProjSrcRoot)/../../386/include \
- -include $(ProjSrcRoot)/../visibility.h
-
-Arch.builtins-i386 := i386
-CFLAGS.builtins-i386 := $(CFLAGS) -target i686-linux-gnu
-FUNCTIONS.builtins-i386 := $(CommonFunctions) $(ArchFunctions.i386)
-
-# Always use optimized variants.
-OPTIMIZED := 1
-
-# We don't need to use visibility hidden on Linux.
-VISIBILITY_HIDDEN := 1
-
-SHARED_LIBRARY_SUFFIX := so
diff --git a/src/clang_linux_builtin_amd64.mk b/src/clang_linux_builtin_amd64.mk
deleted file mode 100644
index 5b2da49..0000000
--- a/src/clang_linux_builtin_amd64.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-Description := Static runtime libraries for clang/Linux.
-
-###
-
-CC := clang
-Arch := unknown
-Configs := builtins-x86_64
-
-CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer -fPIE -ftls-model=local-exec \
- -integrated-as --sysroot $(ProjSrcRoot) \
- -isystem $(ProjSrcRoot)/../../amd64/include \
- -include $(ProjSrcRoot)/../visibility.h
-
-Arch.builtins-x86_64 := x86_64
-CFLAGS.builtins-x86_64 := $(CFLAGS) -target x86_64-linux-gnu
-FUNCTIONS.builtins-x86_64 := $(CommonFunctions) $(ArchFunctions.x86_64)
-
-# Always use optimized variants.
-OPTIMIZED := 1
-
-# We don't need to use visibility hidden on Linux.
-VISIBILITY_HIDDEN := 1
-
-SHARED_LIBRARY_SUFFIX := so
diff --git a/src/clang_linux_builtin_arm.mk b/src/clang_linux_builtin_arm.mk
deleted file mode 100644
index 50c980e..0000000
--- a/src/clang_linux_builtin_arm.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-Description := Static runtime libraries for clang/Linux.
-
-###
-
-CC := clang
-Arch := unknown
-Configs := builtins-armhf
-
-CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer -fPIE -ftls-model=local-exec \
- -integrated-as --sysroot $(ProjSrcRoot) \
- -isystem $(ProjSrcRoot)/../../arm/include \
- -include $(ProjSrcRoot)/../visibility.h
-
-Arch.builtins-armhf := armv7
-CFLAGS.builtins-armhf := $(CFLAGS) -target armv7a-linux-eabihf
-FUNCTIONS.builtins-armhf := $(CommonFunctions) $(ArchFunctions.armv7)
-
-# Always use optimized variants.
-OPTIMIZED := 1
-
-# We don't need to use visibility hidden on Linux.
-VISIBILITY_HIDDEN := 1
-
-SHARED_LIBRARY_SUFFIX := so
diff --git a/src/compiler-rt b/src/compiler-rt
-Subproject 967dd466a2ce2afad1c5d755c40b5a6d2812a60
+Subproject 0ab085c67585346958e8f1d3a3413c543b0196b
diff --git a/src/compiler-rt.mk b/src/compiler-rt.mk
new file mode 100644
index 0000000..9da95cd
--- /dev/null
+++ b/src/compiler-rt.mk
@@ -0,0 +1,62 @@
+ifeq ($(objtype),arm)
+CRTARCH=armv6m
+CCTARGET=armv7a-linux-eabihf
+endif
+ifeq ($(objtype),amd64)
+CRTARCH=x86_64
+CCTARGET=x86_64-linux-gnu
+endif
+ifeq ($(objtype),386)
+CRTARCH=i386
+CCTARGET=i686-linux-gnu
+endif
+ifeq ($(objtype),power)
+CRTARCH=ppc
+CCTARGET=powerpc-ellcc-gnu
+endif
+
+CC=clang
+AR=ar
+RANLIB=ranlib
+INSTALL=install
+
+CFLAGS=-g -O3 -fomit-frame-pointer -Wa,--noexecstack \
+ -integrated-as -target $(CCTARGET) -fPIE -ftls-model=local-exec \
+ -nostdlibinc -isystem ../$(objtype)/include -include visibility.h \
+
+DESTDIR=../$(objtype)
+
+SRCS_BASE=$(wildcard compiler-rt/lib/builtins/*.c)
+OBJS_BASE=$(SRCS_BASE:.c=.o)
+
+SRCS_ARCH=$(wildcard compiler-rt/lib/builtins/$(CRTARCH)/*.[csS])
+OBJS_ARCH=$(patsubst %,%.o,$(basename $(SRCS_ARCH)))
+
+REPLACE=$(sort $(subst /$(CRTARCH)/,/,$(OBJS_ARCH)))
+OBJS=$(filter-out $(REPLACE), $(sort $(OBJS_BASE) $(OBJS_ARCH)))
+
+TARG=libcompiler_rt.a
+
+all: $(TARG)
+
+$(TARG): $(OBJS)
+ rm -f $@
+ $(AR) rc $@ $(OBJS)
+ $(RANLIB) $@
+
+.c.o:
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.s.o:
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+.S.o:
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(DESTDIR)$(PREFIX)/lib/$(TARG): $(TARG)
+ $(INSTALL) -D -m 644 $< $@
+
+install: $(DESTDIR)$(PREFIX)/lib/$(TARG)
+
+clean:
+ rm -f $(OBJS_BASE) $(wildcard compiler-rt/lib/builtins/*/*.o) $(TARG)