From: "Noonan, Steven" <snoonan@amazon.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Laurent Desnogues <laurent.desnogues@gmail.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Steven Noonan <steven@uplinklabs.net>,
QEMU Developers <qemu-devel@nongnu.org>,
Anthony Liguori <aliguori@amazon.com>
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 [thread overview]
Message-ID: <20140409092956.GA10358@amazon.com> (raw)
In-Reply-To: <CAFEAcA9UOCOkj1aR0Qc9snwfEPX6BfLPgHre7Jt8jkrEv0pa5w@mail.gmail.com>
On Wed, Apr 09, 2014 at 08:40:50AM +0100, Peter Maydell wrote:
> 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.
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.
next prev parent reply other threads:[~2014-04-09 9:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-28 16:19 [Qemu-devel] [PATCH for-2.0] configure: add option to disable -fstack-protector flags Paolo Bonzini
2014-03-28 17:41 ` Laurent Desnogues
2014-03-28 17:51 ` Paolo Bonzini
2014-03-28 18:04 ` Noonan, Steven
2014-03-28 20:53 ` Brad Smith
2014-03-31 20:50 ` Peter Maydell
2014-04-08 20:37 ` Peter Maydell
2014-04-08 20:47 ` Noonan, Steven
2014-04-09 7:40 ` Peter Maydell
2014-04-09 9:29 ` Noonan, Steven [this message]
2014-04-09 9:34 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140409092956.GA10358@amazon.com \
--to=snoonan@amazon.com \
--cc=aliguori@amazon.com \
--cc=laurent.desnogues@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=steven@uplinklabs.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).