public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* tools/lib/lk: redefinition of _FORTIFY_SOURCE (gcc-4.7.2)
@ 2013-05-22 10:00 Dirk Gouders
  2013-05-22 11:18 ` Borislav Petkov
  2013-05-22 11:22 ` Dirk Gouders
  0 siblings, 2 replies; 6+ messages in thread
From: Dirk Gouders @ 2013-05-22 10:00 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: Jiri Olsa, linux-kernel

Hello Borislav,

I am having problems with building liblk, but opposed to the recent
problem that Jiri noticed (commit b28b130719af6 Fix _FORTIFY_SOURCE
builds) I am getting errors because _FORTIFY_SOURCE is redefined:

<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
debugfs.c:1:0: note: this is the location of the previous definition
cc1: all warnings being treated as errors

I guess this is because of different gcc versions being in use.
With gcc-4.7.2 _FORTIFY_SOURCE is defined as

$ gcc -E -dM - < /dev/null | grep -i fortify
#define _FORTIFY_SOURCE ((defined __OPTIMIZE__ && __OPTIMIZE__ > 0) ? 2 : 0)

gcc-4.6.4 uses

#define _FORTIFY_SOURCE 2

and would complain if we set _FORTIFY_SOURCE to something other than 2.

gcc-4.2.2 seems to use no definition of _FORTIFY_SOURCE, by default.

What probably might help in any case is undefining _FORTIFY_SOURCE before
defining it, because as far as I know, there is no problem with
undefining something that is not yet defined, but I could imagine,
others might have more elegant suggestions:

CFLAGS = -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS) $(EXTRA_CFLAGS) -fPIC

Dirk

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-05-23 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22 10:00 tools/lib/lk: redefinition of _FORTIFY_SOURCE (gcc-4.7.2) Dirk Gouders
2013-05-22 11:18 ` Borislav Petkov
2013-05-22 11:27   ` Dirk Gouders
2013-05-22 13:50     ` Borislav Petkov
2013-05-23 20:32   ` Dirk Gouders
2013-05-22 11:22 ` Dirk Gouders

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox