With this patch CFLAGS and LDFLAGS are separated, so CFLAGS only used when compiling and LDFLAGS only used when linking. This would silence many clang's warnings about unused arguments. 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