FORTIFY_SOURCE

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

FORTIFY_SOURCE

Achim Gratz

Perl and Cygwin do not exactly play together at the moment, but I
haven't been able to track down where that happens.  Perl configure
recognizes FORTIFY_SOURCE=2 proceeds to integrate that knowledge into
Config_heavy.pl.  For whatever reason it decded to use
"-Wp,-D_FORTIFY_SOURCE=2" to do that (which works just fine).  But when
compiling something through ExtUtils::Embed in the just built perl that
option suddenly ends up as just "-Wp," and hangs up the compiler.  If I
rename the defined symbol to "FORCIFY_SOURCE" then it stays in the call
to gcc, so it's specific to that symbol.

I think that's happening somewhere in ExtUtils, but I'd like to ask if
maybe there is some magic going on from the Cygwin / gcc side to remove
that definition?


Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
Reply | Threaded
Open this post in threaded view
|

Re: FORTIFY_SOURCE

Achim Gratz
Achim Gratz writes:
> I think that's happening somewhere in ExtUtils, but I'd like to ask if
> maybe there is some magic going on from the Cygwin / gcc side to remove
> that definition?

OK, I finally found it in Embed.  EMbed compiles the tests without
optimization and tries to strip the definition, but doesn't expect the
leading "-Wp,".  I have still no idea where _that_ comes from.


Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
Reply | Threaded
Open this post in threaded view
|

Re: FORTIFY_SOURCE

Brian Inglis
On 2018-04-15 12:51, Achim Gratz wrote:
> Achim Gratz writes:
>> I think that's happening somewhere in ExtUtils, but I'd like to ask if
>> maybe there is some magic going on from the Cygwin / gcc side to remove
>> that definition?
>
> OK, I finally found it in Embed.  EMbed compiles the tests without
> optimization and tries to strip the definition, but doesn't expect the
> leading "-Wp,".  I have still no idea where _that_ comes from.

https://github.com/vim/vim/issues/2068 suggests it may come from PERL_CFLAGS

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
Reply | Threaded
Open this post in threaded view
|

Re: FORTIFY_SOURCE

Achim Gratz
Brian Inglis writes:
>> OK, I finally found it in Embed.  EMbed compiles the tests without
>> optimization and tries to strip the definition, but doesn't expect the
>> leading "-Wp,".  I have still no idea where _that_ comes from.
>
> https://github.com/vim/vim/issues/2068 suggests it may come from PERL_CFLAGS

Sure, the question is why they use this stage prefix suddenly when they
didn't before.


Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Q+, Q and microQ:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
Reply | Threaded
Open this post in threaded view
|

Re: FORTIFY_SOURCE

Brian Inglis
On 2018-04-15 13:08, Achim Gratz wrote:
> Brian Inglis writes:
>>> OK, I finally found it in Embed.  EMbed compiles the tests without
>>> optimization and tries to strip the definition, but doesn't expect the
>>> leading "-Wp,".  I have still no idea where _that_ comes from.
>>
>> https://github.com/vim/vim/issues/2068 suggests it may come from PERL_CFLAGS
>
> Sure, the question is why they use this stage prefix suddenly when they
> didn't before.

Someone who believes in being "explicit" took over or patched something from
someone who prefers staying "generic"; see http://wiki.c2.com/?HolyWar ;^>

You may already know and have tried: https://perldoc.perl.org/perlembed.html
suggests checking the output from:

$ perl -V
...
  Compiler:
    cc='gcc'
    ccflags ='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2
-pipe -Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86_64/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86_64/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1
-fwrapv -fno-strict-aliasing -fstack-protector-strong -D_FORTIFY_SOURCE=2'
    optimize='-O3'
    cppflags='-DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2
-pipe -Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86_64/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86_64/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1
-fwrapv -fno-strict-aliasing -fstack-protector-strong'
...
  Linker and Libraries:
    ld='g++'
    ldflags =' -Wl,--enable-auto-import -Wl,--export-all-symbols
-Wl,--enable-auto-image-base -fstack-protector-strong'
...
$ perl -MExtUtils::Embed -e ccopts -e ldopts; echo
Warning (mostly harmless): No library found for -lcrypt
   -Wl,--enable-auto-import -Wl,--export-all-symbols
-Wl,--enable-auto-image-base -fstack-protector-strong
-L/usr/lib/perl5/5.26/x86_64-cygwin-threads/CORE -lperl -lpthread -ldl
 -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE -ggdb -O2 -pipe
-Wimplicit-function-declaration
-fdebug-prefix-map=/mnt/share/maint/perl.x86_64/build=/usr/src/debug/perl-5.26.1-1
-fdebug-prefix-map=/mnt/share/maint/perl.x86_64/src/perl-5.26.1=/usr/src/debug/perl-5.26.1-1
-fwrapv -fno-strict-aliasing -fstack-protector-strong -D_FORTIFY_SOURCE=2
-I/usr/lib/perl5/5.26/x86_64-cygwin-threads/CORE

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
Reply | Threaded
Open this post in threaded view
|

Re: FORTIFY_SOURCE

Achim Gratz
In reply to this post by Achim Gratz
Achim Gratz writes:
> Brian Inglis writes:
>>> OK, I finally found it in Embed.  EMbed compiles the tests without
>>> optimization and tries to strip the definition, but doesn't expect the
>>> leading "-Wp,".  I have still no idea where _that_ comes from.

Tracing what the configury does it turns out it comes from cygport's
CFLAGS setting.

>> https://github.com/vim/vim/issues/2068 suggests it may come from PERL_CFLAGS
>
> Sure, the question is why they use this stage prefix suddenly when they
> didn't before.

The answer to that question is still open.  Why does cygport set this
symbol in this manner?  I am removing the "-Wp," and see what the build
does…


Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
Reply | Threaded
Open this post in threaded view
|

Re: FORTIFY_SOURCE

Richard Campbell-8
In reply to this post by Achim Gratz
> > Sure, the question is why they use this stage prefix suddenly when they
> > didn't before.
>
> The answer to that question is still open.  Why does cygport set this
> symbol in this manner?  I am removing the "-Wp," and see what the build
> does…

Yaakov added that symbol to lib/compilers.cygpart on February 20 along
with other security flags, in the "Add security flags to CFLAGS"
commit.

https://github.com/cygwinports/cygport/commit/48e7b6e94052ac58643fa3b7989bb7e1468389f7

The "-Wp" just means to pass -D_FORTIFY_SOURCE=2 through to the preprocessor.

Best regards,

-Richard Campbell.