Generalize link rule in windows-makefile.tmpl

C++Builder's [`ilink32.exe`][1] expects its different types of input /
output files to be in a particular sequence and comma-separated -- even
in the response file as experimentation revealed, contrary to what is
documented. The lines of the response file need to end with `+`.

Also [`setargv.obj`][2] is MSVC-specific. The C++Builder equivalent is
[`wildargs.obj`][3].

[1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_ILINK32_and_ILINK64_on_the_Command_Line
[2]: https://docs.microsoft.com/en-us/cpp/c-language/expanding-wildcard-arguments?view=msvc-160
[3]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Wildcard_Arguments

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
This commit is contained in:
Tanzinul Islam 2020-11-19 17:57:46 +00:00 committed by Dmitry Belyavskiy
parent 830cd025b1
commit a75a87561b
2 changed files with 13 additions and 14 deletions

View File

@ -1281,6 +1281,9 @@ my %targets = (
LD => "link",
LDFLAGS => "/nologo /debug",
ldoutflag => "/out:",
ldpostoutflag => "",
ld_resp_delim => "\n",
ld_wildcard_args => "setargv.obj",
AR => "lib",
ARFLAGS => "/nologo",
aroutflag => "/out:",

View File

@ -858,8 +858,8 @@ EOF
@{$args{objs}};
my @deps = compute_lib_depends(@{$args{deps}});
die "More than one exported symbols list" if scalar @defs > 1;
my $linklibs = join("", map { "$_\n" } @deps);
my $objs = join("\n", @objs);
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
my $objs = join($target{ld_resp_delim}, @objs);
my $deps = join(" ", @objs, @defs, @deps);
my $import = platform->sharedlib_import($lib);
my $dll = platform->sharedlib($lib);
@ -874,8 +874,7 @@ $dll: $deps
IF EXIST \$@ DEL /F /Q \$@
\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
/implib:$import \$(LDOUTFLAG)$dll$shared_def @<< || (DEL /Q \$(\@B).* $import; EXIT 1)
$objs
$linklibs\$(LIB_EX_LIBS)
$objs$target{ld_resp_delim}$linklibs\$(LIB_EX_LIBS)
<<
IF EXIST $dll.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll
@ -898,8 +897,8 @@ EOF
grep { platform->isdef($_) }
@{$args{objs}};
my @deps = compute_lib_depends(@{$args{deps}});
my $objs = join("\n", @objs);
my $linklibs = join("", map { "$_\n" } @deps);
my $objs = join($target{ld_resp_delim}, @objs);
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
my $deps = join(" ", @objs, @defs, @deps);
my $shared_def = join("", map { " /def:$_" } @defs);
return <<"EOF";
@ -907,8 +906,7 @@ $dso: $deps
IF EXIST $dso.manifest DEL /F /Q $dso.manifest
\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \\
\$(LDOUTFLAG)$dso$shared_def @<< || (DEL /Q \$(\@B).* $dso_n.*; EXIT 1)
$objs
$linklibs \$(DSO_EX_LIBS)
$objs$target{ld_resp_delim}$linklibs \$(DSO_EX_LIBS)
<<
IF EXIST $dso.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso.manifest \$(MTOUTFLAG)$dso
@ -934,16 +932,14 @@ EOF
grep { platform->isobj($_) || platform->isres($_) }
@{$args{objs}};
my @deps = compute_lib_depends(@{$args{deps}});
my $objs = join("\n", @objs);
my $linklibs = join("", map { "$_\n" } @deps);
my $objs = join($target{ld_resp_delim}, @objs);
my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
my $deps = join(" ", @objs, @deps);
return <<"EOF";
$bin: $deps
IF EXIST $bin.manifest DEL /F /Q $bin.manifest
\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin @<<
$objs
setargv.obj
$linklibs\$(BIN_EX_LIBS)
\$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) @<<
$objs$target{ld_resp_delim}$target{ld_wildcard_args}$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)
<<
IF EXIST $bin.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin