* [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE
@ 2015-04-20 12:01 Dirk Gouders
2015-04-20 18:16 ` Ingo Molnar
0 siblings, 1 reply; 5+ messages in thread
From: Dirk Gouders @ 2015-04-20 12:01 UTC (permalink / raw
To: Arnaldo Carvalho de Melo
Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar, linux-kbuild,
linux-kernel
For example on Gentoo systems where _FORTIFY_SOURCE is set by default,
`make -C tools/perf' fails, because of the macro being redefined.
Fix that by a feature-check analogous to tools/perf/config/Makefile.
Signed-off-by: Dirk Gouders <dirk@gouders.net>
---
tools/lib/api/Makefile | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
index d8fe29f..acf9097 100644
--- a/tools/lib/api/Makefile
+++ b/tools/lib/api/Makefile
@@ -16,7 +16,14 @@ MAKEFLAGS += --no-print-directory
LIBFILE = $(OUTPUT)libapi.a
CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
-CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC
+CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fPIC
+
+ifeq ($(DEBUG),0)
+ ifeq ($(feature-fortify-source), 1)
+ CFLAGS += -D_FORTIFY_SOURCE=2
+ endif
+endif
+
CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
RM = rm -f
--
2.3.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE
2015-04-20 12:01 [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE Dirk Gouders
@ 2015-04-20 18:16 ` Ingo Molnar
2015-04-20 18:34 ` Dirk Gouders
0 siblings, 1 reply; 5+ messages in thread
From: Ingo Molnar @ 2015-04-20 18:16 UTC (permalink / raw
To: Dirk Gouders
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras,
Ingo Molnar, linux-kbuild, linux-kernel
* Dirk Gouders <dirk@gouders.net> wrote:
> For example on Gentoo systems where _FORTIFY_SOURCE is set by default,
> `make -C tools/perf' fails, because of the macro being redefined.
>
> Fix that by a feature-check analogous to tools/perf/config/Makefile.
>
> Signed-off-by: Dirk Gouders <dirk@gouders.net>
> ---
> tools/lib/api/Makefile | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
> index d8fe29f..acf9097 100644
> --- a/tools/lib/api/Makefile
> +++ b/tools/lib/api/Makefile
> @@ -16,7 +16,14 @@ MAKEFLAGS += --no-print-directory
> LIBFILE = $(OUTPUT)libapi.a
>
> CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
> -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC
> +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fPIC
> +
> +ifeq ($(DEBUG),0)
> + ifeq ($(feature-fortify-source), 1)
> + CFLAGS += -D_FORTIFY_SOURCE=2
> + endif
> +endif
So how about undefining it instead and re-defining it as
_FORTIFY_SOURCE=2?
Just in case a distro sets a weaker version - lets not accept that
weaker setting. We've always had the stronger version of it.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE
2015-04-20 18:16 ` Ingo Molnar
@ 2015-04-20 18:34 ` Dirk Gouders
2015-04-20 18:55 ` Bobby Powers
0 siblings, 1 reply; 5+ messages in thread
From: Dirk Gouders @ 2015-04-20 18:34 UTC (permalink / raw
To: Ingo Molnar
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Paul Mackerras,
Ingo Molnar, linux-kbuild, linux-kernel
Ingo Molnar <mingo@kernel.org> writes:
> * Dirk Gouders <dirk@gouders.net> wrote:
>
>> For example on Gentoo systems where _FORTIFY_SOURCE is set by default,
>> `make -C tools/perf' fails, because of the macro being redefined.
>>
>> Fix that by a feature-check analogous to tools/perf/config/Makefile.
>>
>> Signed-off-by: Dirk Gouders <dirk@gouders.net>
>> ---
>> tools/lib/api/Makefile | 9 ++++++++-
>> 1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/lib/api/Makefile b/tools/lib/api/Makefile
>> index d8fe29f..acf9097 100644
>> --- a/tools/lib/api/Makefile
>> +++ b/tools/lib/api/Makefile
>> @@ -16,7 +16,14 @@ MAKEFLAGS += --no-print-directory
>> LIBFILE = $(OUTPUT)libapi.a
>>
>> CFLAGS := $(EXTRA_WARNINGS) $(EXTRA_CFLAGS)
>> -CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -D_FORTIFY_SOURCE=2 -fPIC
>> +CFLAGS += -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fPIC
>> +
>> +ifeq ($(DEBUG),0)
>> + ifeq ($(feature-fortify-source), 1)
>> + CFLAGS += -D_FORTIFY_SOURCE=2
>> + endif
>> +endif
>
> So how about undefining it instead and re-defining it as
> _FORTIFY_SOURCE=2?
>
> Just in case a distro sets a weaker version - lets not accept that
> weaker setting. We've always had the stronger version of it.
Yes, I was suggesting something similar (but without founded reasoning),
some time ago [1].
Would the "undefining-approch" mean that we should modify the handling
of _FORTIFY_SOURCE in tools/perf/config/Makefile as well?
Dirk
[1] https://lkml.org/lkml/2013/5/22/186
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE
2015-04-20 18:34 ` Dirk Gouders
@ 2015-04-20 18:55 ` Bobby Powers
2015-04-21 7:46 ` Dirk Gouders
0 siblings, 1 reply; 5+ messages in thread
From: Bobby Powers @ 2015-04-20 18:55 UTC (permalink / raw
To: Dirk Gouders
Cc: Ingo Molnar, Arnaldo Carvalho de Melo, Peter Zijlstra,
Paul Mackerras, Ingo Molnar, linux-kbuild,
Kernel development list
Hi,
Dirk Gouders <dirk@gouders.net> wrote:
> Yes, I was suggesting something similar (but without founded reasoning),
> some time ago [1].
I submitted a patch for this a few days ago, but I didn't realize I
should CC linux-kbuild@ (my bad):
https://lkml.org/lkml/2015/4/18/71
yours,
Bobby
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE
2015-04-20 18:55 ` Bobby Powers
@ 2015-04-21 7:46 ` Dirk Gouders
0 siblings, 0 replies; 5+ messages in thread
From: Dirk Gouders @ 2015-04-21 7:46 UTC (permalink / raw
To: Bobby Powers
Cc: Ingo Molnar, Arnaldo Carvalho de Melo, Peter Zijlstra,
Paul Mackerras, Ingo Molnar, linux-kbuild,
Kernel development list
Bobby Powers <bobbypowers@gmail.com> writes:
> Hi,
>
> Dirk Gouders <dirk@gouders.net> wrote:
>> Yes, I was suggesting something similar (but without founded reasoning),
>> some time ago [1].
>
> I submitted a patch for this a few days ago, but I didn't realize I
> should CC linux-kbuild@ (my bad):
> https://lkml.org/lkml/2015/4/18/71
Thanks for the hint, Bobby, I really should have checked recent
archives.
I could not apply your patch against Linus' current tree, but tested it
with your change typed in, manually with positive result (as expected).
Dirk
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-21 7:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-20 12:01 [PATCH] tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE Dirk Gouders
2015-04-20 18:16 ` Ingo Molnar
2015-04-20 18:34 ` Dirk Gouders
2015-04-20 18:55 ` Bobby Powers
2015-04-21 7:46 ` Dirk Gouders
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 read-only IMAP folder(s) and NNTP newsgroup(s).