From dd32f429246bdfb929d5bebd1aa268d5eecd8de4 Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 15 Oct 2014 15:32:41 +0000 Subject: [PATCH 7/7] configure.ac: If the compiler supports -Qunused-arguments, use it when running the compiler on .s files. --- configure.ac | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/configure.ac b/configure.ac index afad32c..b662f39 100644 --- a/configure.ac +++ b/configure.ac @@ -367,6 +367,15 @@ AC_C_BIGENDIAN GCC_AS_CFI_PSEUDO_OP +AC_CACHE_CHECK([if compiler supports -Qunused-arguments], +[libffi_cv_c_unused_arguments], +[CFLAGS_hold=$CFLAGS +CFLAGS="$CFLAGS -Qunused-arguments" +AC_COMPILE_IFELSE([[int i;]], +[libffi_cv_c_unused_arguments=yes], +[libffi_cv_c_unused_arguments=no]) +CFLAGS=$CFLAGS_hold]) + if test x$TARGET = xSPARC; then AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], libffi_cv_as_sparc_ua_pcrel, [ @@ -403,9 +412,14 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64 libffi_cv_as_x86_pcrel, [ libffi_cv_as_x86_pcrel=no echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s + CFLAGS_hold=$CFLAGS + if test "$libffi_cv_c_unused_arguments" = yes; then + CFLAGS="$CFLAGS -Qunused-arguments" + fi if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then libffi_cv_as_x86_pcrel=yes fi + CFLAGS=$CFLAGS_hold ]) if test "x$libffi_cv_as_x86_pcrel" = xyes; then AC_DEFINE(HAVE_AS_X86_PCREL, 1, @@ -489,10 +503,15 @@ EOF libffi_cv_as_x86_64_unwind_section_type=no # we ensure that we can compile _and_ link an assembly file containing an @unwind section # since the compiler can support it and not the linker (ie old binutils) + CFLAGS_hold=$CFLAGS + if test "$libffi_cv_c_unused_arguments" = yes; then + CFLAGS="$CFLAGS -Qunused-arguments" + fi if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \ $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then libffi_cv_as_x86_64_unwind_section_type=yes fi + CFLAGS=$CFLAGS_hold ]) if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, -- 1.8.4.2