[nginx] Perl: pass additional linker options to perl module.

Konstantin Pavlov thresh at nginx.com
Thu Sep 22 14:50:30 UTC 2016


details:   http://hg.nginx.org/nginx/rev/0d2956dfc4e6
branches:  
changeset: 6700:0d2956dfc4e6
user:      Konstantin Pavlov <thresh at nginx.com>
date:      Tue Sep 20 22:11:23 2016 +0300
description:
Perl: pass additional linker options to perl module.

Previously flags passed by --with-ld-opt were not used when building perl
module, which meant hardening flags provided by package build systems were not
applied.

diffstat:

 auto/lib/perl/conf                |  4 +++-
 auto/lib/perl/make                |  1 +
 auto/make                         |  1 +
 src/http/modules/perl/Makefile.PL |  2 ++
 4 files changed, 7 insertions(+), 1 deletions(-)

diffs (49 lines):

diff -r 9cf2dce316e5 -r 0d2956dfc4e6 auto/lib/perl/conf
--- a/auto/lib/perl/conf	Tue Sep 20 15:07:16 2016 +0300
+++ b/auto/lib/perl/conf	Tue Sep 20 22:11:23 2016 +0300
@@ -28,8 +28,10 @@ if test -n "$NGX_PERL_VER"; then
         exit 1;
     fi
 
+    NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts`
+    NGX_PM_LDFLAGS=`$NGX_PERL -MConfig -e 'print $Config{lddlflags}'`
+
     NGX_PERL_CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`"
-    NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts`
 
     # gcc 4.1/4.2 warn about unused values in pTHX_
     NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \
diff -r 9cf2dce316e5 -r 0d2956dfc4e6 auto/lib/perl/make
--- a/auto/lib/perl/make	Tue Sep 20 15:07:16 2016 +0300
+++ b/auto/lib/perl/make	Tue Sep 20 22:11:23 2016 +0300
@@ -35,6 +35,7 @@ cat << END                              
 
 	cd $NGX_OBJS/src/http/modules/perl \\
 		&& NGX_PM_CFLAGS="\$(NGX_PM_CFLAGS) -g $NGX_CC_OPT" \\
+			NGX_PM_LDFLAGS="$NGX_LD_OPT \$(NGX_PM_LDFLAGS)" \\
 			NGX_INCS="$CORE_INCS $NGX_OBJS $HTTP_INCS" \\
 			NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\
 		$NGX_PERL Makefile.PL \\
diff -r 9cf2dce316e5 -r 0d2956dfc4e6 auto/make
--- a/auto/make	Tue Sep 20 15:07:16 2016 +0300
+++ b/auto/make	Tue Sep 20 22:11:23 2016 +0300
@@ -31,6 +31,7 @@ END
 if test -n "$NGX_PERL_CFLAGS"; then
     echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS                   >> $NGX_MAKEFILE
     echo NGX_PM_CFLAGS = $NGX_PM_CFLAGS                       >> $NGX_MAKEFILE
+    echo NGX_PM_LDFLAGS = $NGX_PM_LDFLAGS                     >> $NGX_MAKEFILE
 fi
 
 
diff -r 9cf2dce316e5 -r 0d2956dfc4e6 src/http/modules/perl/Makefile.PL
--- a/src/http/modules/perl/Makefile.PL	Tue Sep 20 15:07:16 2016 +0300
+++ b/src/http/modules/perl/Makefile.PL	Tue Sep 20 22:11:23 2016 +0300
@@ -16,6 +16,8 @@ WriteMakefile(
     CCFLAGS           => "$ENV{NGX_PM_CFLAGS}",
     OPTIMIZE          => '-O',
 
+    LDDLFLAGS         => "$ENV{NGX_PM_LDFLAGS}",
+
     INC               => join(" ", map {
                              m#^/# ? "-I $_" : "-I ../../../../../$_"
                          } (split /\s+/, $ENV{NGX_INCS})),



More information about the nginx-devel mailing list