summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoakim Sindholt <opensource@zhasha.com>2016-02-17 14:51:07 +0100
committerJoakim Sindholt <opensource@zhasha.com>2016-02-17 14:51:07 +0100
commit51886ad8050e57223abf72226746defefe071244 (patch)
treec1c71942085678b21d24ca59e526d1e55afd7aa6
parent35f2549b6327a3728e72eefbf048d35e36364737 (diff)
update compiler flags
-rw-r--r--bin/build-libc.sh2
-rw-r--r--bin/p9a.sh9
-rw-r--r--bin/p9c.sh64
-rw-r--r--src/compiler-rt.mk2
4 files changed, 34 insertions, 43 deletions
diff --git a/bin/build-libc.sh b/bin/build-libc.sh
index 57af0df..ac80b20 100644
--- a/bin/build-libc.sh
+++ b/bin/build-libc.sh
@@ -49,7 +49,7 @@ Linux)
cd "${SRCDIR}/musl" && \
make distclean ARCH=bug && \
CC="clang --target=${CLANGARCH} -integrated-as" \
- CFLAGS="-g -Os -pipe -fPIE -ftls-model=local-exec -fstack-protector-all" \
+ CFLAGS="-ggdb3 -Os -pipe -fPIE -ftls-model=local-exec -fstack-protector-all" \
GNUTARGET="${CLANGARCH}" ./configure \
--target="${MUSLARCH}" \
--prefix="${OBJDIR}" \
diff --git a/bin/p9a.sh b/bin/p9a.sh
index d0f5651..726840a 100644
--- a/bin/p9a.sh
+++ b/bin/p9a.sh
@@ -45,8 +45,6 @@ case "$objtype" in
;;
esac
-OPTS+=("-c")
-
shift $(($OPTIND - 1))
# mark the rest as files
while [ "$1" != "" ]
@@ -83,7 +81,10 @@ do
RNOPTS=("-o" "${obj}")
fi
- clang -integrated-as --target="${CLANGARCH}" -g ${RNOPTS[@]} ${OPTS[@]} \
- -x assembler-with-cpp -include "${DIR}/../src/assembly.h" "${f}"
+ clang \
+ -target "${CLANGARCH}" -integrated-as \
+ -nostdinc -ggdb3 -fPIE -ftls-model=local-exec -Wa,--noexecstack \
+ -include "${DIR}/../src/assembly.h" \
+ "${OPTS[@]}" "${RNOPTS[@]}" -c -x assembler-with-cpp "${f}"
if [ $? -ne 0 ]; then exit 1; fi
done
diff --git a/bin/p9c.sh b/bin/p9c.sh
index a31f3c5..9434e11 100644
--- a/bin/p9c.sh
+++ b/bin/p9c.sh
@@ -97,17 +97,23 @@ then
else
OPTS+=("-O0")
fi
-# asm instead of objects
+# asm syntax
+case "$objtype" in
+ amd64 | 386)
+ # intel asm syntax for intel processors
+ OPTS+=("-mllvm" "--x86-asm-syntax=intel")
+ ;;
+esac
+# asm-dependent options
if [ $USE_ASM == false ]
then
- OPTS+=("-c")
-else
- case "$objtype" in
- amd64 | 386)
- # intel asm syntax for intel processors
- OPTS+=("-mllvm" "--x86-asm-syntax=intel")
- ;;
- esac
+ # don't spam debug info on -S
+ OPTS+=("-ggdb3")
+ # use LTO
+ if [ $USE_LTO == true ]
+ then
+ OPTS+=("-flto")
+ fi
fi
shift $(($OPTIND - 1))
@@ -129,30 +135,6 @@ then
exit 1
fi
-TARG=""
-if [ -d "${DIR}/../${objtype}/include" ]
-then
- TARG="--target=${CLANGARCH}"
-
- # use LTO
- if [[ $USE_LTO == true && $USE_ASM == false ]]
- then
- OPTS+=("-flto")
- fi
-
- # turn on fortify
- OPTS+=("-isystem" "${DIR}/../src/fortify-headers/include")
- OPTS+=("-D_FORTIFY_SOURCE=1")
-
- # turn on stack protector
- OPTS+=("-fstack-protector-all")
-
- # use custom libc
- OPTS+=("-nostdlibinc")
- OPTS+=("-isystem" "${DIR}/../${objtype}/include")
- OPTS+=("-idirafter" "/usr/include")
-fi
-
for f in ${FILES[@]}
do
RNOPTS=()
@@ -173,11 +155,19 @@ do
fi
clang \
- "$TARG" -pipe -std=c11 -g -fPIE -ftls-model=local-exec \
+ -target "$CLANGARCH" \
+ -pipe -std=c11 -fPIE -ftls-model=local-exec \
-fdata-sections -ffunction-sections \
+ -fstack-protector-all \
+ -nostdlibinc \
+ -isystem "${DIR}/../src/fortify-headers/include" \
+ -isystem "${DIR}/../${objtype}/include" \
+ -I "${DIR}/../include" \
+ -idirafter "/usr/include" \
+ -include "${DIR}/../src/visibility.h" \
+ -Werror=declaration-after-statement \
-D_POSIX_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE \
- -D_XOPEN_SOURCE -Werror=declaration-after-statement \
- -I"${DIR}/../include" -I. -include "${DIR}/../src/visibility.h" \
- "${RNOPTS[@]}" "${OPTS[@]}" "${f}"
+ -D_XOPEN_SOURCE -D_FORTIFY_SOURCE=1 \
+ "${OPTS[@]}" "${RNOPTS[@]}" -c "${f}"
if [ $? -ne 0 ]; then exit 1; fi
done
diff --git a/src/compiler-rt.mk b/src/compiler-rt.mk
index 9da95cd..049be30 100644
--- a/src/compiler-rt.mk
+++ b/src/compiler-rt.mk
@@ -20,7 +20,7 @@ AR=ar
RANLIB=ranlib
INSTALL=install
-CFLAGS=-g -O3 -fomit-frame-pointer -Wa,--noexecstack \
+CFLAGS=-O3 -fomit-frame-pointer -Wa,--noexecstack \
-integrated-as -target $(CCTARGET) -fPIE -ftls-model=local-exec \
-nostdlibinc -isystem ../$(objtype)/include -include visibility.h \