Message ID | CAFEAcA-H_CF277a=+6brx+2=aofdajkPxcNRLoTVmaxiwf+HqQ@mail.gmail.com |
---|---|
State | Superseded |
Headers | show |
On 8 April 2014 21:47, Noonan, Steven <snoonan@amazon.com> wrote: > On Tue, Apr 08, 2014 at 09:37:27PM +0100, Peter Maydell wrote: >> This is bad because we have that framework argument as part of our >> linker flags. Effectively this means that clang won't warn about the >> argument at link time but will warn for every .c->.o compile (as well >> as ending up with no stack protection). > > So -framework is designed to transparently add the appropriate -I and > -L/-l flags, pointing to the insides of a .framework bundle. > > To me, the -framework arguments belong in CFLAGS and LIBS, but not > LDFLAGS. In the context of QEMU's configure script, I think it'd be > QEMU_INCLUDES and LIBS. Unfortunately, putting "-framework CoreFoundation" in CFLAGS produces a different warning: manooth$ clang -o /tmp/zz9.o -Werror -fstack-protector -c /tmp/zz9.c -framework CoreFoundation clang: error: -framework CoreFoundation: 'linker' input unused which would seem to imply that you shouldn't be passing it on the .c->.o compile command line. thanks -- PMM
On 9 April 2014 10:29, Noonan, Steven <snoonan@amazon.com> wrote: > So in your case all you probably need is to drop the -framework > arguments from CFLAGS and plop them into LIBS, and you're probably good > to go. This is where they are already. The problem is that putting -framework on the linker command line causes clang to fail to reject -fsome-random-unknown-thing, which means we can't do configure detection of -fsomething arguments using compile_prog :-( I think the only thing we can do about this is to make sure that our configure code to check for -fsomething does a compile-only check and not a link. thanks -- PMM
diff --git a/configure b/configure index eb0e7bb..c85475f 100755 --- a/configure +++ b/configure @@ -1448,7 +1448,7 @@ done if test "$stack_protector" != "no" ; then gcc_flags="-fstack-protector-strong -fstack-protector-all" for flag in $gcc_flags; do - if compile_prog "-Werror $flag" "" ; then + if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC ; then QEMU_CFLAGS="$QEMU_CFLAGS $flag" LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag" break