diff options
Diffstat (limited to 'util/xcompile')
-rwxr-xr-x | util/xcompile/xcompile | 64 |
1 files changed, 57 insertions, 7 deletions
diff --git a/util/xcompile/xcompile b/util/xcompile/xcompile index ff067d2f6a..3fb0cb7591 100755 --- a/util/xcompile/xcompile +++ b/util/xcompile/xcompile @@ -208,6 +208,45 @@ detect_special_flags() { testcc "$GCC" "$CFLAGS_GCC -Wcalloc-transposed-args" && CFLAGS_GCC="$CFLAGS_GCC -Wcalloc-transposed-args" + testcc "$GCC" "$CFLAGS_GCC -Wno-unused-parameter" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-unused-parameter" + + testcc "$GCC" "$CFLAGS_GCC -Wno-sign-compare" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-sign-compare" + + testcc "$GCC" "$CFLAGS_GCC -Wno-empty-body" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-empty-body" + + testcc "$GCC" "$CFLAGS_GCC -Wno-missing-field-initializers" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-missing-field-initializers" + + testcc "$GCC" "$CFLAGS_GCC -Wno-override-init" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-override-init" + + testcc "$GCC" "$CFLAGS_GCC -Wno-ignored-qualifiers" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-ignored-qualifiers" + + testcc "$GCC" "$CFLAGS_GCC -Wno-shift-negative-value" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-shift-negative-value" + + testcc "$GCC" "$CFLAGS_GCC -Wno-unused-but-set-parameter" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-unused-but-set-parameter" + + testcc "$GCC" "$CFLAGS_GCC -Wno-type-limits" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-type-limits" + + testcc "$GCC" "$CFLAGS_GCC -Wno-cast-function-type" && + CFLAGS_GCC="$CFLAGS_GCC -Wno-cast-function-type" + + testcc "$GCC" "$CFLAGS_GCC -Wextra" && + CFLAGS_GCC="$CFLAGS_GCC -Wextra" + + # Disable warning on segments with RWX. + # All loadable sections are placed in the same segment for simplicity. + testld "$GCC" "$FLAGS_GCC" "${GCCPREFIX}ld${LINKER_SUFFIX}" \ + "$LDFLAGS --no-warn-rwx-segments" && \ + LDFLAGS="$LDFLAGS --no-warn-rwx-segments" + case "$architecture" in x86) ;; @@ -217,6 +256,11 @@ detect_special_flags() { testld "$GCC" "$FLAGS_GCC" "${GCCPREFIX}ld${LINKER_SUFFIX}" \ "$LDFLAGS --fix-cortex-a53-843419" && \ LDFLAGS_ARM64_A53_ERRATUM_843419+=" --fix-cortex-a53-843419" + # https://bugs.llvm.org/show_bug.cgi?id=30792 + # LLVM/clang runs into problems when encountering SIMD registers in assembly + # with -mgeneral-regs-only. -mno-implicit-float achieves the same though. + CFLAGS_GCC="$CFLAGS_GCC -mgeneral-regs-only" && + CFLAGS_CLANG="$CFLAGS_CLANG -mno-implicit-float" ;; riscv) testcc "$GCC" "$FLAGS_GCC -march=rv64iadc_zicsr_zifencei" && @@ -260,13 +304,20 @@ fi cat <<EOF # Clang -CLANG_CC_${TARCH}:=${CLANG} -CLANG_CFLAGS_${TARCH}:=${CFLAGS_CLANG} -CLANG_CFLAGS_${TARCH}+=-Qunused-arguments -m${TWIDTH} +CLANG_CC_${TARCH} := ${CLANG} +CLANG_CFLAGS_${TARCH} := ${CFLAGS_CLANG} +CLANG_CFLAGS_${TARCH} += -Qunused-arguments +CLANG_CFLAGS_${TARCH} += -m${TWIDTH} # tone down clang compiler warnings -CLANG_CFLAGS_${TARCH}+=-Wno-unused-variable -Wno-unused-function -Wno-tautological-compare -CLANG_CFLAGS_${TARCH}+=-Wno-shift-overflow -Wno-address-of-packed-member -Wno-initializer-overrides -CLANG_CFLAGS_${TARCH}+=-fbracket-depth=2048 -mllvm -asm-macro-max-nesting-depth=1000 +CLANG_CFLAGS_${TARCH} += -Wno-unused-variable +CLANG_CFLAGS_${TARCH} += -Wno-unused-function +CLANG_CFLAGS_${TARCH} += -Wno-tautological-compare +CLANG_CFLAGS_${TARCH} += -Wno-shift-overflow +CLANG_CFLAGS_${TARCH} += -Wno-address-of-packed-member +CLANG_CFLAGS_${TARCH} += -Wno-initializer-overrides +CLANG_CFLAGS_${TARCH} += -fbracket-depth=2048 +CLANG_CFLAGS_${TARCH} += -mllvm +CLANG_CFLAGS_${TARCH} += -asm-macro-max-nesting-depth=1000 CLANG_COMPILER_RT_${TARCH}:=${CC_RT_CLANG} CLANG_COMPILER_RT_FLAGS_${TARCH}:=${CC_RT_EXTRA_CLANG} # Leak the target arch into the preprocessor flags with clang. @@ -408,7 +459,6 @@ arch_config_ppc64() { TWIDTH="64" TSUPP="ppc64" TABI="linux-gnu" # there is no generic ABI on ppc64 - CC_RT_EXTRA_GCC="-mcpu=power8 -mbig-endian" } # Right now, the clang reference toolchain is not building compiler-rt builtins |