Commit 6b6fc64711 for openssl.org
commit 6b6fc647116d61ea8c1250b4ad55b7696dad7b6a
Author: Jakub Zelenka <jakub.zelenka@openssl.foundation>
Date: Fri Apr 10 21:31:19 2026 +0200
Add WRAP build.info variable
This is used for adding per target --wrap ld flags for each listed
function.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Thu Jul 9 17:39:12 2026
(Merged from https://github.com/openssl/openssl/pull/30788)
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index f27517e565..19455e2b11 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -2021,6 +2021,13 @@ EOF
push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
}
}
+ my $wrapflags = '';
+ if (defined $unified_info{wraps}->{$args{bin}}) {
+ $wrapflags = join(' ',
+ map { "-Wl,--wrap=$_" }
+ @{$unified_info{wraps}->{$args{bin}}});
+ $wrapflags = ' ' . $wrapflags;
+ }
my $linkflags = join("", map { $_." " } @linkdirs);
my $linklibs = join("", map { $_." " } @linklibs);
my $cmd = '$(CC)';
@@ -2038,7 +2045,7 @@ EOF
return <<"EOF";
$bin: $deps
rm -f $bin
- \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
+ \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS)$wrapflags \\
-o $bin \\
$objs \\
$linklibs\$(BIN_EX_LIBS)
diff --git a/Configure b/Configure
index 30671d0af5..d3e6563c07 100755
--- a/Configure
+++ b/Configure
@@ -2141,6 +2141,7 @@ if ($builder eq "unified") {
my %includes = ();
my %defines = ();
my %depends = ();
+ my %wraps = ();
my %generate = ();
my %imagedocs = ();
my %htmldocs = ();
@@ -2396,6 +2397,11 @@ if ($builder eq "unified") {
\$attributes{depends}, $+{ATTRIBS},
tokenize($expand_variables->($+{VALUE})))
if !@skip || $skip[$#skip] > 0; },
+ qr/^\s* WRAP ${index_re} \s* = \s* ${value_re} \s* $/x
+ => sub { $push_to->(\%wraps, $expand_variables->($+{INDEX}),
+ undef, undef,
+ tokenize($expand_variables->($+{VALUE})))
+ if !@skip || $skip[$#skip] > 0; },
qr/^\s* GENERATE ${index_re} ${attribs_re} \s* = \s* ${value_re} \s* $/x
=> sub { $push_to->(\%generate, $expand_variables->($+{INDEX}),
\$attributes{generate}, $+{ATTRIBS},
@@ -2682,6 +2688,13 @@ if ($builder eq "unified") {
}
}
+ foreach my $dest (keys %wraps) {
+ my $ddest = cleanfile($buildd, $dest, $blddir);
+ foreach my $fn (@{$wraps{$dest}}) {
+ push @{$unified_info{wraps}->{$ddest}}, $fn;
+ }
+ }
+
foreach my $section (keys %imagedocs) {
foreach (@{$imagedocs{$section}}) {
my $imagedocs = cleanfile($buildd, $_, $blddir);