On Tue, Aug 4, 2009 at 9:13 PM, Bram Moolenaar wrote:

>> Hello,
>>
>> The build log is available at
>> http://kojipkgs.fedoraproject.org/packages/vim/7.2.245/1.fc12/data/logs/i686/build.log
>> and we were using -D_FORTIFY_SOURCE=2 to compile vim as you've already
>> suspected.
>>
>> This compile option comes from the RPM compile options and seems to take
>> precedence over your fortify changes from patch 44 as we now have
>> '-D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=1' on the gcc commandline.
>
> Ah, so the configure script is working, but not as expected.
>
> Where is the -D_FORTIFY_SOURCE=2 flag coming from?  Is it in $CFLAGS?
> If so then configure could filter it out.


The attached patch does what you suggest.

I tested with:

$ export CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2"
$ cd vim7/src
$ make distclean
$ autoconf
$ ./configure
$ make

... and -D_FORTIFY_SOURCE=1 is used when compiling.

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: configure.in
===================================================================
RCS file: /cvsroot/vim/vim7/src/configure.in,v
retrieving revision 1.74
diff -c -r1.74 configure.in
*** configure.in	22 Jul 2009 09:17:10 -0000	1.74
--- configure.in	4 Aug 2009 20:42:17 -0000
***************
*** 3233,3239 ****
    dnl declared as char x[1] but actually longer.  Introduced in gcc 4.0.
    AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
    if test "$gccmajor" -gt "3"; then
!     CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)
--- 3233,3239 ----
    dnl declared as char x[1] but actually longer.  Introduced in gcc 4.0.
    AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
    if test "$gccmajor" -gt "3"; then
!     CFLAGS=`echo "$CFLAGS -D_FORTIFY_SOURCE=1" | sed -e 's/-Wp,-D_FORTIFY_SOURCE=2//g' -e 's/-D_FORTIFY_SOURCE=2//g'`
      AC_MSG_RESULT(yes)
    else
      AC_MSG_RESULT(no)

Raspunde prin e-mail lui