public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>,
	David Rientjes <rientjes@google.com>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Ralf Baechle <ralf@linux-mips.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Arjan van de Ven <arjan@linux.intel.com>,
	James Hogan <james.hogan@imgtec.com>,
	Michal Marek <mmarek@suse.cz>, Paul Mundt <lethal@linux-sh.org>,
	Shawn Guo <shawn.guo@linaro.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-kbuild <linux-kbuild@vger.kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>,
	"linux-tip-commits@vger.kernel.org"
	<linux-tip-commits@vger.kernel.org>
Subject: Re: [patch core/stackprotector] stackprotector: Fix build when compiler lacks support
Date: Wed, 1 Jan 2014 23:28:08 +0100	[thread overview]
Message-ID: <20140101222808.GB19648@free.fr> (raw)
In-Reply-To: <CA+55aFzS2bTXSDabNhsZXhpVWP9toqtubB3jrNVWF-FaQrmz-w@mail.gmail.com>

Linus, All,

On 2014-01-01 11:33 -0800, Linus Torvalds spake thusly:
> On Wed, Jan 1, 2014 at 3:42 AM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> >
> > On 2013-12-31 16:16 -0800, Linus Torvalds spake thusly:
> >>
> >> What we really really want to do is to have some way to add config
> >> options based on shell scripts and compiler support. That would also
> >> get rid of a lot of Makefile trickery etc.
> >>
> >> Then we could just make CC_STACKPROTECTOR_STRONG depend on
> >> CC_SUPPORTS_STACKPROTECTOR_STRONG or whatever.
> >
> > Sam Ravnborg suggested somethink along those lines back in July:
> >     http://marc.info/?l=linux-kbuild&m=137399785206527&w=2
> > and a tentative implementation:
> >     http://marc.info/?l=linux-kbuild&m=137409581406434&w=2
> 
> Ack. Looks good to me. I've wanted this for a long time for other
> reasons, we should finally just do it.
> 
> That said, we should make sure that the shell execution thing gets
> access to $(CC) etc variables that we have in

This requires exporting them from the Makefiles (they are, in Makefile:391
and below).

> > Basically, that would give something like:
> >
> >     config CC_SUPPORTS_STACKPROTECTOR_STRONG
> >         bool
> >         option exec="some/script/to/test-gcc -fstack-protector-strong"
> 
> For the compiler options, it would hopefully be sufficient to just do
> something like
> 
>   config CC_SUPPORTS_STACKPROTECTOR_STRONG
>       bool
>       option exec="$CC -fstack-protector-strong -c empty.c"
> 
> or something like that. No?

This is an implementation detail, but the original patch expected the
result to be 'y' or 'n' (or empty=='n') on stdout. That way, it could
also be used to fill-in config options that are strings, or ints. Hence
the use of a script.

But H. Peter suggested it should only return a boolean, which seems
entirely reasonable, given the purpose of this. In this case, using 'y'
or 'n' from stdout, or 0 or !0 from the exit code are equally easy.

Also, using a single shell script allows to fix/enhance all of those
calls in a single place, and avoids duplicating all the check logic in
every tests (eg. who is going to create empty.c in your example? Clean
up the output file?). And since kconfig is run from the top-level of the
Linux source tree (even for out-of-tree builds), we can safely use a
path relative to that to call our script(s).

I'll wait a bit until the end of the holiday season before I poke Sam
again on this.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  parent reply	other threads:[~2014-01-01 22:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-19 19:35 [PATCH v5] provide -fstack-protector-strong build option Kees Cook
2013-12-19 19:35 ` [PATCH v5 1/2] create HAVE_CC_STACKPROTECTOR for centralized use Kees Cook
2013-12-19 19:35 ` [PATCH v5 2/2] provide -fstack-protector-strong build option Kees Cook
     [not found]   ` <tip-8779657d29c0ebcc0c94ede4df2f497baf1b563f@git.kernel.org>
2013-12-30 21:37     ` [patch core/stackprotector] stackprotector: Fix build when compiler lacks support David Rientjes
2013-12-31  0:45       ` Kees Cook
2014-01-01  0:16         ` Linus Torvalds
2014-01-01 11:42           ` Yann E. MORIN
2014-01-01 19:33             ` Linus Torvalds
2014-01-01 19:50               ` H. Peter Anvin
2014-01-01 22:28               ` Yann E. MORIN [this message]
2014-01-05 22:13                 ` Sam Ravnborg
2013-12-31 14:39       ` Arjan van de Ven

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=20140101222808.GB19648@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=james.hogan@imgtec.com \
    --cc=keescook@chromium.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mingo@kernel.org \
    --cc=mmarek@suse.cz \
    --cc=peterz@infradead.org \
    --cc=ralf@linux-mips.org \
    --cc=rientjes@google.com \
    --cc=sam@ravnborg.org \
    --cc=sfr@canb.auug.org.au \
    --cc=shawn.guo@linaro.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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