develooper Front page | perl.perl5.porters | Postings from July 2014

_FORTIFY_SOURCE

Thread Next
From:
Dave Mitchell
Date:
July 2, 2014 10:05
Subject:
_FORTIFY_SOURCE
Message ID:
20140702100447.GG15476@iabyn.com
Since this commit:

    commit 1284d934d2a3f111f67da43b3004875ce4124284
    Author:     Jarkko Hietaniemi <jhi@iki.fi>
    AuthorDate: Sat Jun 28 18:30:13 2014 -0400
    Commit:     Jarkko Hietaniemi <jhi@iki.fi>
    CommitDate: Mon Jun 30 09:17:11 2014 -0400

        Add -D_FORTIFY_SOURCE=2 when applicable.
        
        Added only if available (gcc 4.*) and not already there.
        
        Not already there might be explicit via ccflags, or less explicitly
        via cppsymbols: for example in OS X 10.5+ the -D_FORTIFY_SOURCE=2
        is already the default with the system cc (gcc earlier, now clang).
        
        Some Linux distros (e.g. Fedora) also have enabled it for years,
        either for all user code, or for their own builds.

my system's been very noisy on non-optimised builds e.g.:


$ make sv.o
cc -c -DPERL_CORE -D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -ggdb -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -std=c89 -g -Wall -ansi -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings sv.c
In file included from /usr/include/sys/types.h:25:0,
                 from perl.h:687,
                 from sv.c:32:
/usr/include/features.h:327:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
    ^

Presumably as the warning says, _FORTIFY_SOURCE should only be added on
optimising builds??
 
-- 
"Strange women lying in ponds distributing swords is no basis for a system
of government. Supreme executive power derives from a mandate from the
masses, not from some farcical aquatic ceremony."
    -- Dennis, "Monty Python and the Holy Grail"

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About