qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH for-2.0] configure: add option to disable -fstac


From: Noonan, Steven
Subject: Re: [Qemu-devel] [PATCH for-2.0] configure: add option to disable -fstack-protector flags
Date: Wed, 9 Apr 2014 02:29:58 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Apr 09, 2014 at 08:40:50AM +0100, Peter Maydell wrote:
> On 8 April 2014 21:47, Noonan, Steven <address@hidden> 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.

I think it's a warning being turned into an error with -Werror. In any
case, it's rightfully complaining, I'd forgotten that '-framework' was
link-only. It's been a while since I built anything serious outside of
command-line apps on Macs.

There are a few relevant command-line arguments that need to be utilized
correctly, though some might not matter in your case:

    -mmacosx-version-min=<version>
        -isysroot <SDK root path>
        -F<framework path>
        -framework <framework name>

The -mmacosx-version-min and -isysroot arguments only are significant if
you intend to redistribute the binary, as they determine what Mac OS X
SDK you're targeting.

For compile command lines, you would need -F arguments to help it
resolve the framework paths (excluding paths for system-provided
frameworks, such as CoreFoundation). Any #include directives for
framework headers would be written as <framework-name/header> e.g.

        #include <CoreFoundation/CoreFoundation.h>

Then for the link command line, you use the same -F arguments to set up
the framework search paths, then add -framework for linkage.

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]