From 2b3f03c46211ad3699e2a72f9054861ba7933d52 Mon Sep 17 00:00:00 2001 From: Dmitry Golovin Date: Tue, 10 Jan 2017 12:26:27 +0200 Subject: [PATCH 3464/3464] improvements for building with clang 1. Tests for excess-precision=standard and rounding-math are disabled for clang. The problem is that those tests pass, but do no good: every compilation commands produce two warnings about unsupported optimization flags. 2. LDFLAGS (added to --help) variable is only used for linking, CFLAGS is only used for compiling, none of them are used for assembly. This suppresses all unused argument warnings. --- Makefile | 4 ++-- configure | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8246b78..508878c 100644 --- a/Makefile +++ b/Makefile @@ -142,7 +142,7 @@ CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $< ifeq ($(ADD_CFI),yes) AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ - else - AS_CMD = $(CC_CMD) + AS_CMD = $(CC) -c -o $@ $< endif obj/%.o: $(srcdir)/%.s @@ -164,7 +164,7 @@ obj/%.lo: $(srcdir)/%.c $(GENH) $(IMPH) $(CC_CMD) lib/libc.so: $(LOBJS) $(LDSO_OBJS) - $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \ + $(CC) $(LDFLAGS_ALL) -nostdlib -shared \ -Wl,-e,_dlstart -o $@ $(LOBJS) $(LDSO_OBJS) $(LIBCC) lib/libc.a: $(AOBJS) diff --git a/configure b/configure index c2db298..9f01ae5 100755 --- a/configure +++ b/configure @@ -39,6 +39,7 @@ Optional features: Some influential environment variables: CC C compiler command [detected] CFLAGS C compiler flags [-Os -pipe ...] + LDFLAGS linker flags [none] CROSS_COMPILE prefix for cross compiler and tools [none] LIBCC compiler runtime library [detected] @@ -337,9 +338,17 @@ tryflag CFLAGS_C99FSE -std=c99 tryflag CFLAGS_C99FSE -nostdinc tryflag CFLAGS_C99FSE -ffreestanding \ || tryflag CFLAGS_C99FSE -fno-builtin + +# +# Do not check for excess-precision=standard and rounding-math on clang +# because the test doesn't fail, but clang shows them as +# unsupported optimization flags +# +if test "$cc_family" != clang ; then tryflag CFLAGS_C99FSE -fexcess-precision=standard \ || { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; } tryflag CFLAGS_C99FSE -frounding-math +fi # # We may use the may_alias attribute if __GNUC__ is defined, so -- 2.7.4