util/mk1mf.pl: use LINK_CMD instead of LINK variable.

Trouble is that LINK variable assignment in make-file interferes with
LINK environment variable, which can be used to modify Microsoft's
LINK.EXE behaviour.

RT#4289

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit d44bb1c31ca00f4359090daa15659c0dd1a08f0d)

Resolved conflicts:
	util/pl/VC-32.pl

(cherry picked from commit 0fffd522426c7fc022894c8dd079dc2625c04096)
This commit is contained in:
Andy Polyakov 2016-02-03 18:21:00 +01:00
parent 9b6e183925
commit b0b9f693b4
9 changed files with 18 additions and 18 deletions

View File

@ -459,7 +459,7 @@ EX_LIBS=$ex_libs
# The OpenSSL directory # The OpenSSL directory
SRC_D=$src_dir SRC_D=$src_dir
LINK=$link LINK_CMD=$link
LFLAGS=$lflags LFLAGS=$lflags
RSC=$rsc RSC=$rsc

View File

@ -118,7 +118,7 @@ ___
{ {
local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
$ex.=' ws2_32.lib gdi32.lib'; $ex.=' ws2_32.lib gdi32.lib';
$ret.="\t\$(LINK) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; $ret.="\t\$(LINK_CMD) \$(MLFLAGS) $efile$target /def:ms/${Name}.def @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
} }
$ret.="\n"; $ret.="\n";
return($ret); return($ret);
@ -132,7 +132,7 @@ sub do_link_rule
$file =~ s/\//$o/g if $o ne '/'; $file =~ s/\//$o/g if $o ne '/';
$n=&bname($target); $n=&bname($target);
$ret.="$target: $files $dep_libs\n"; $ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n"; $ret.="\t\$(LINK_CMD) \$(LFLAGS) $files \$(APP_EX_OBJ), $target,, $libs\n\n";
return($ret); return($ret);
} }

View File

@ -98,7 +98,7 @@ sub do_link_rule
$file =~ s/\//$o/g if $o ne '/'; $file =~ s/\//$o/g if $o ne '/';
$n=&bname($target); $n=&bname($target);
$ret.="$target: $files $dep_libs\n"; $ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret); return($ret);
} }
1; 1;

View File

@ -99,7 +99,7 @@ sub do_lib_rule
{ {
local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':''; local($ex)=($target =~ /O_SSL/)?' $(L_CRYPTO)':'';
$ex.=' -lsocket'; $ex.=' -lsocket';
$ret.="\t\$(LINK) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n"; $ret.="\t\$(LINK_CMD) \$(SHLIB_CFLAGS) \$(MLFLAGS) $efile$target \$(SHLIB_EX_OBJ) \$(${Name}OBJ) $ex os2/${Name}.def\n";
$ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n"; $ret.="\temximp -o $out_def/$name.a os2/${Name}.def\n";
$ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n"; $ret.="\temximp -o $out_def/$name.lib os2/${Name}.def\n\n";
} }
@ -113,7 +113,7 @@ sub do_link_rule
$file =~ s/\//$o/g if $o ne '/'; $file =~ s/\//$o/g if $o ne '/';
$n=&bname($target); $n=&bname($target);
$ret.="$target: $files $dep_libs\n"; $ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n"; $ret.="\t\$(LINK_CMD) ${efile}$target \$(CFLAG) \$(LFLAGS) $files $libs\n\n";
return($ret); return($ret);
} }

View File

@ -314,7 +314,7 @@ sub do_lib_rule
if ($fips && $target =~ /O_CRYPTO/) if ($fips && $target =~ /O_CRYPTO/)
{ {
$ret.="$target: $objs \$(PREMAIN_DSO_EXE)"; $ret.="$target: $objs \$(PREMAIN_DSO_EXE)";
$ret.="\n\tSET FIPS_LINK=\$(LINK)\n"; $ret.="\n\tSET FIPS_LINK=\$(LINK_CMD)\n";
$ret.="\tSET FIPS_CC=\$(CC)\n"; $ret.="\tSET FIPS_CC=\$(CC)\n";
$ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
$ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n"; $ret.="\tSET PREMAIN_DSO_EXE=\$(PREMAIN_DSO_EXE)\n";
@ -328,7 +328,7 @@ sub do_lib_rule
else else
{ {
$ret.="$target: $objs"; $ret.="$target: $objs";
$ret.="\n\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n"; $ret.="\n\t\$(LINK_CMD) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex \$(EX_LIBS)\n<<\n";
} }
$ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n"; $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;2\n\n";
} }
@ -347,7 +347,7 @@ sub do_link_rule
{ {
$ret.=" \$(OBJ_D)${o}applink.obj" if $shlib; $ret.=" \$(OBJ_D)${o}applink.obj" if $shlib;
$ret.="\n"; $ret.="\n";
$ret.=" \$(LINK) \$(LFLAGS) $efile$target @<<\n\t"; $ret.=" \$(LINK_CMD) \$(LFLAGS) $efile$target @<<\n\t";
if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild) { if ($files =~ /O_FIPSCANISTER/ && !$fipscanisterbuild) {
$ret.= "\$(EX_LIBS) "; $ret.= "\$(EX_LIBS) ";
$ret.= "\$(OBJ_D)${o}applink.obj " if $shlib; $ret.= "\$(OBJ_D)${o}applink.obj " if $shlib;
@ -357,7 +357,7 @@ sub do_link_rule
elsif ($standalone == 2) elsif ($standalone == 2)
{ {
$ret.="\n"; $ret.="\n";
$ret.="\tSET FIPS_LINK=\$(LINK)\n"; $ret.="\tSET FIPS_LINK=\$(LINK_CMD)\n";
$ret.="\tSET FIPS_CC=\$(CC)\n"; $ret.="\tSET FIPS_CC=\$(CC)\n";
$ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n"; $ret.="\tSET FIPS_CC_ARGS=/Fo\$(OBJ_D)${o}fips_premain.obj \$(SHLIB_CFLAGS) -c\n";
$ret.="\tSET PREMAIN_DSO_EXE=\n"; $ret.="\tSET PREMAIN_DSO_EXE=\n";
@ -370,7 +370,7 @@ sub do_link_rule
else else
{ {
$ret.="\n"; $ret.="\n";
$ret.="\t\$(LINK) \$(LFLAGS) $efile$target @<<\n"; $ret.="\t\$(LINK_CMD) \$(LFLAGS) $efile$target @<<\n";
$ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n"; $ret.="\t\$(APP_EX_OBJ) $files $libs\n<<\n";
} }
$ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n"; $ret.="\tIF EXIST \$@.manifest mt -nologo -manifest \$@.manifest -outputresource:\$@;1\n\n";

View File

@ -78,7 +78,7 @@ sub do_link_rule
$file =~ s/\//$o/g if $o ne '/'; $file =~ s/\//$o/g if $o ne '/';
$n=&bname($target); $n=&bname($target);
$ret.="$target: $files $dep_libs\n"; $ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret); return($ret);
} }

View File

@ -506,22 +506,22 @@ sub do_link_rule
if ($gnuc) if ($gnuc)
{ {
$ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n"; $ret.="\t\$(MKLIB) $lib_flags \$(TMP_D)${o}\$(E_EXE).a \$(filter-out \$(TMP_D)${o}\$(E_EXE)${obj},$files)\n";
$ret.="\t\$(LINK) \$(LFLAGS) $def_file2\n"; $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file2\n";
$ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n"; $ret.="\t\@$mv \$(E_EXE)2.nlm \$(TEST_D)\n";
} }
else else
{ {
$ret.="\t\$(LINK) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n"; $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file2 $files \"$prelude\" $libs -o $target2\n";
} }
} }
if ($gnuc) if ($gnuc)
{ {
$ret.="\t\$(LINK) \$(LFLAGS) $def_file\n"; $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file\n";
$ret.="\t\@$mv \$(\@F) \$(TEST_D)\n"; $ret.="\t\@$mv \$(\@F) \$(TEST_D)\n";
} }
else else
{ {
$ret.="\t\$(LINK) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n"; $ret.="\t\$(LINK_CMD) \$(LFLAGS) $def_file $files \"$prelude\" $libs -o $target\n";
} }
$ret.="\n"; $ret.="\n";

View File

@ -31,7 +31,7 @@ sub do_link_rule
$file =~ s/\//$o/g if $o ne '/'; $file =~ s/\//$o/g if $o ne '/';
$n=&bname($target); $n=&bname($target);
$ret.="$target: $files $dep_libs\n"; $ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret); return($ret);
} }

View File

@ -76,7 +76,7 @@ sub do_link_rule
$file =~ s/\//$o/g if $o ne '/'; $file =~ s/\//$o/g if $o ne '/';
$n=&bname($target); $n=&bname($target);
$ret.="$target: $files $dep_libs\n"; $ret.="$target: $files $dep_libs\n";
$ret.="\t\$(LINK) ${efile}$target \$(LFLAGS) $files $libs\n\n"; $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n";
return($ret); return($ret);
} }