96ec1ef
--- support/configure.pl.orig	2021-10-03 13:58:33.371348375 -0600
96ec1ef
+++ support/configure.pl	2021-10-03 14:13:35.213311532 -0600
96ec1ef
@@ -1030,6 +1030,7 @@ int main() {
9647ad1
    }
9647ad1
 
9647ad1
    $LDsharedFLAGS=$Config::Config{lddlflags};
9647ad1
+   $LDsharedFLAGS =~ s/ -specs=\S+redhat-hardened-cc1//g;
9647ad1
 
9647ad1
    if ($^O eq "darwin") {
9647ad1
       # MacOS magic again: remove multi-architecture options for fat binaries
96ec1ef
@@ -1059,6 +1060,8 @@ int main() {
9647ad1
 
9647ad1
       if ($options{callable} ne ".none.") {
9647ad1
          $LDcallableFLAGS="$LDsharedFLAGS $Config::Config{ldflags}";
66e5d3d
+         $LDcallableFLAGS =~ s/ -specs=\S+redhat-hardened-ld(-errors)?//g;
9647ad1
+         $LDcallableFLAGS =~ s/ -Wl,-z,now//g;
9647ad1
          $LDsonameFLAGS = "-Wl,-soname,";
9647ad1
       } else {
9647ad1
          $LDcallableFLAGS="none";
96ec1ef
@@ -1762,10 +1765,17 @@ sub write_perl_specific_configuration_fi
be519eb
    my ($xsubpp) = grep { -e $_ } map { "$Config::Config{$_}/ExtUtils/xsubpp" } qw(privlib vendorlib);
be519eb
    my ($typemap) = grep { -e $_ } map { "$Config::Config{$_}/ExtUtils/typemap" } qw(privlib vendorlib);
9647ad1
 
be519eb
+   # Turn off the hardening flags
9647ad1
+   my $GlueFLAGS=$Config::Config{ccflags};
9647ad1
+   $GlueFLAGS =~ s/ -specs=\\S+redhat-hardened-cc1//g;
9647ad1
+   my $PerlFLAGS=$Config::Config{ccdlflags};
66e5d3d
+   $PerlFLAGS =~ s/ -specs=\\S+redhat-hardened-ld(-errors)?//g;
9647ad1
+   $PerlFLAGS =~ s/ -Wl,-z,now//g;
be519eb
+
9647ad1
    print $conf <<"---";
9647ad1
 PERL=$Config::Config{perlpath}
96ec1ef
-CXXglueFLAGS=$includePerlCore$Config::Config{archlibexp}/CORE $Config::Config{ccflags} $perlextraflags -DPerlVersion=$PerlVersion $no_warn
9647ad1
-LIBperlFLAGS=-L$Config::Config{archlib}/CORE -lperl $Config::Config{ccdlflags}
96ec1ef
+CXXglueFLAGS=$includePerlCore$Config::Config{archlibexp}/CORE $GlueFLAGS $perlextraflags -DPerlVersion=$PerlVersion $no_warn
9647ad1
+LIBperlFLAGS=-L$Config::Config{archlib}/CORE -lperl $PerlFLAGS
be519eb
 ExtUtils_xsubpp=$xsubpp
be519eb
 ExtUtils_typemap=$typemap
9647ad1
 ---