diff options
author | Tanzinul Islam <tanzinul.islam@gmail.com> | 2020-12-13 18:01:46 +0000 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2021-04-19 11:05:55 +0200 |
commit | 491a1e3363228e8276ee293a86acd7a961ffe9d3 (patch) | |
tree | ec0d2baa0debc8c08f0e75fbcb3cfa3792395803 /Configurations/windows-makefile.tmpl | |
parent | 16f2a44435fccbd7466b0659220c765a17e5d0c0 (diff) |
Link with .def files
MSVC's `link.exe` automatically finds `__cdecl` C functions (which are
decorated with a leading underscore by the compiler) when they are
mentioned in a `.def` file without the leading underscore. This is an
[under-documented feature][1] of MSVC's `link.exe`. C++Builder's
`ilink32.exe` doesn't do this, and thus needs the name-translation in
the `.def` file. Then `implib.exe` needs to be told to re-add it.
(The Clang-based `bcc32c.exe` doesn't implement the [`-vu` or `-u-`][2]
options to skip adding the leading underscore to `__cdecl` C function
names, so this is the only way to have things work with non-underscored
export names in the DLLs.)
[1]: https://github.com/MicrosoftDocs/cpp-docs/issues/2653
[2]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Options_Not_Supported_by_Clang-enhanced_C%2B%2B_Compilers#BCC32_Options_that_Are_Not_Supported_by_Clang-enhanced_C.2B.2B_Compilers
Also silence linker warnings on duplicate symbols and ensure that error-
case cleanup in link rules work in C++Builder's `make.exe`.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
Diffstat (limited to 'Configurations/windows-makefile.tmpl')
-rw-r--r-- | Configurations/windows-makefile.tmpl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl index bcb092d045..6ceab7e94d 100644 --- a/Configurations/windows-makefile.tmpl +++ b/Configurations/windows-makefile.tmpl @@ -878,7 +878,7 @@ $import: $dll $dll: $deps IF EXIST $full.manifest DEL /F /Q $full.manifest IF EXIST \$@ DEL /F /Q \$@ - \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) @<< $implib_flag || (DEL /Q \$(\@B).* $import; EXIT 1) + cmd /C "\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) @<< $implib_flag || (DEL /Q \$(\@B).* $import & EXIT 1)" $objs$target{ld_resp_delim}\$(LDOUTFLAG)$dll$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(LIB_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress << IF EXIST $dll.manifest \\ @@ -914,7 +914,7 @@ EOF return <<"EOF"; $dso: $deps IF EXIST $dso.manifest DEL /F /Q $dso.manifest - \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) @<< || (DEL /Q \$(\@B).* $dso_n.*; EXIT 1) + cmd /C "\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) @<< || (DEL /Q \$(\@B).* $dso_n.* & EXIT 1)" $objs$target{ld_resp_delim}\$(LDOUTFLAG)$dso$target{ldpostoutflag}$target{ld_resp_delim}$linklibs \$(DSO_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress << IF EXIST $dso.manifest \\ |