tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE
PATCH 1/1 tools/lib/api/Makefile: Add feature check for _FORTIFY_SOURCE
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.
--- tools/lib/api/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/lib/api/Makefile +8 -1
@@ -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
Signature · 1 line
2.3.5
Quoted 16 lines · Dirk Gouders
For example on Gentoo systems where
_FORTIFY_SOURCEis set by default, `make -Ctools/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 <[email protected]>--- tools/lib/api/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/lib/api/Makefile +0
-0@@ -16,7 +16,14 @@ MAKEFLAGS += --no-print-directory LIBFILE = $(OUTPUT)libapi.a
tools/lib/api/Makefile MAKEFLAGS += --no-print-directory · line 25
Quoted 10 lines
tools/lib/api/Makefile +7
-1CFLAGS := $(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
Quoted 32 lines · Ingo Molnar
Quoted 16 lines · Dirk Gouders
For example on Gentoo systems where
_FORTIFY_SOURCEis set by default, `make -Ctools/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 <[email protected]>--- tools/lib/api/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)tools/lib/api/Makefile +0
-0@@ -16,7 +16,14 @@ MAKEFLAGS += --no-print-directory LIBFILE = $(OUTPUT)libapi.atools/lib/api/Makefile MAKEFLAGS += --no-print-directory · line 25
Quoted 10 lines
tools/lib/api/Makefile +7
-1CFLAGS := $(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 +endifSo how about undefining it instead and re-defining it as _FORTIFY_SOURCE=2?
Quoted 2 lines
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
Hi,
Quoted 2 lines · Dirk Gouders
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
Quoted 9 lines · Bobby Powers
Hi,
Quoted 2 lines · Dirk Gouders
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