[openssl] master update
beldmit at gmail.com
beldmit at gmail.com
Mon Apr 19 09:11:04 UTC 2021
The branch master has been updated
via 5ae52001e115452ca285713feb1c2feaf07902ad (commit)
via daf98015aac8bf392cf95edf9a54d845c1c22fd7 (commit)
via 491a1e3363228e8276ee293a86acd7a961ffe9d3 (commit)
via 16f2a44435fccbd7466b0659220c765a17e5d0c0 (commit)
via 96d4ec6724a9ecc5d193172d0cf1a347f428372a (commit)
via 6afb36342d4bc63a774fd96088ededfc00401e1d (commit)
via 5fee3fe2760d65a141873601c4b7b9fd2fc5c7b1 (commit)
via c4f4cb14e3f06362c2ee9e0e480b816ab46f15b6 (commit)
via 55aa235e85e156bf71c339804ef317ad4d0f27a5 (commit)
via d5a6b54b49905cdb4edfe1e1caf9656896171cb6 (commit)
via 847f41d97c966707d45da5640792e3bd8f8d23fd (commit)
via 583a9f1f6b0d0842f8d63a21c335b24494fc67bc (commit)
via f1ee757daaf8ea1000c6558abd1ffc8ad5234c09 (commit)
via a8368d573e5b4553e7344dd37239da6d72480832 (commit)
via a75a87561b491fc9b96b15153eba1f5e142280c5 (commit)
via 830cd025b199fab165a378884fb5b4373799bde9 (commit)
via 8557bdde4836b4dc63ad305c9f3c648816a05e86 (commit)
via e15eff3aaabe17be37ec42ae7ca342cbf2a2733c (commit)
via 118faf5ffe2ba495407f482a8d8438b7d266815c (commit)
via 23f3242ffe8613411714eb9350275371059c7bfe (commit)
via 1bb381227b432676451ead3f9d4b92352464e9cc (commit)
from a4afa6c1d00c027a5afc8974a298e0f54607f1b5 (commit)
- Log -----------------------------------------------------------------
commit 5ae52001e115452ca285713feb1c2feaf07902ad
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Mon Dec 14 23:31:49 2020 +0000
Remove crypt32.lib from C++Builder configuration
`import32.lib` serves the purpose for most Windows API libraries, including this one. For example, with a GNU `grep` utility:
>tdump %BDS%\lib\win32c\release\import32.lib | grep -B 3 -A 1 CertOpenStore
171E32 COMENT Purge: Yes, List: Yes, Class: 160 (0A0h), SubClass: 1 (01h)
Dynamic link import (IMPDEF)
Imported by: name
Internal Name: CertOpenStore
Module Name: CRYPT32.dll
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit daf98015aac8bf392cf95edf9a54d845c1c22fd7
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sun Dec 13 18:04:43 2020 +0000
Link with uplink module
The Clang-based `bcc32c.exe` expects AT&T syntax for inline assembly.
References:
- http://docwiki.embarcadero.com/RADStudio/Sydney/en/Differences_Between_Clang-enhanced_C%2B%2B_Compilers_and_Previous-Generation_C%2B%2B_Compilers#Inline_Assembly
- https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
- https://sourceware.org/binutils/docs/as/i386_002dVariations.html
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 491a1e3363228e8276ee293a86acd7a961ffe9d3
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sun Dec 13 18:01:46 2020 +0000
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 at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 16f2a44435fccbd7466b0659220c765a17e5d0c0
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Thu Dec 10 14:53:07 2020 +0000
Generate dependency information
The Clang-based `bcc32c.exe` doesn't implement the `-Hp` option, so we
have to use [`cpp32.exe`][1] instead. Therefore, change the dependency-
emitting command to use `$(CPP)` instead of `$(CC)`, which which also
uncovered the [existing bug of `2>&1` before `> $dep`][2]. Also
C++Builder's `make.exe` doesn't implement `2>&1` in its command runner,
so wrap the whole line in a `cmd /C`.
[1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/CPP32.EXE,_the_C_Compiler_Preprocessor
[2]: https://ss64.com/nt/syntax-redirection.html
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 96d4ec6724a9ecc5d193172d0cf1a347f428372a
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Wed Dec 9 00:45:11 2020 +0000
Avoid more MSVC-specific C runtime library functions
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 6afb36342d4bc63a774fd96088ededfc00401e1d
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Wed Dec 9 00:29:14 2020 +0000
Build resource files
We need to compile with [brcc32.exe][1] and link with [ilink32.exe][2].
The latter expects the `.res` files to be given in the final comma-
separated section in the command line (after the `.def` file).
[1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/BRCC32.EXE,_the_Resource_Compiler
[2]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_ILINK32_and_ILINK64_on_the_Command_Line#Command-Line_Elements
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 5fee3fe2760d65a141873601c4b7b9fd2fc5c7b1
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sun Dec 6 23:04:45 2020 +0000
Support DLL builds + Fix C RTL variants
We need to generate a import library without the version in the
filename. MSVC's `link.exe` accommodates this with the [`/implib:`
option][1], while C++Builder needs a separate run of [`implib.exe`][2].
Also fix the variants of the [C runtime library and startup objects][3].
[1]: https://docs.microsoft.com/en-us/cpp/build/reference/implib-name-import-library?view=msvc-160
[2]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/IMPLIB.EXE,_the_Import_Library_Tool_for_Win32
[3]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Static_Runtime_Libraries
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit c4f4cb14e3f06362c2ee9e0e480b816ab46f15b6
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sat Nov 28 22:56:53 2020 +0000
Ensure cw32mt.lib and import32.lib are linked to in no-sock mode
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 55aa235e85e156bf71c339804ef317ad4d0f27a5
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sat Nov 28 02:21:03 2020 +0000
Document C++Builder usage in NOTES-WINDOWS.md
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit d5a6b54b49905cdb4edfe1e1caf9656896171cb6
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sat Nov 28 02:11:28 2020 +0000
Replace "ld_wildcard_args" with "bin_lflags"
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 847f41d97c966707d45da5640792e3bd8f8d23fd
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Fri Nov 27 14:22:38 2020 +0000
Add explanation + bugtracker link for quoted dependency workarounds
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 583a9f1f6b0d0842f8d63a21c335b24494fc67bc
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Thu Nov 26 15:38:40 2020 +0000
Use cmd.exe to export env vars before commands
Microsoft NMake runs the entire command block in a single `cmd.exe`
session, so environment variables exported with `set` are seen by the
following commands. C++Builder's `make.exe` doesn't use `cmd.exe` but
executes each command line separately. While it emulates only certain
shell features itself, `set` isn't one of them.
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit f1ee757daaf8ea1000c6558abd1ffc8ad5234c09
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Thu Nov 19 23:39:12 2020 +0000
Resurrect and modernize C++Builder config
Similar configuration to what was deleted in 8e56a422, updated for the
unified build scheme. Use the [Clang-based `bcc32c.exe`][1] to avoid a
[bug][2] with the old one, and increase the `tlib.exe` page size to 256.
Also avoid MSVC-specific C runtime library functions.
[1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/Win32_Clang-enhanced_Compilers
[2]: https://quality.embarcadero.com/browse/RSP-31630
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit a8368d573e5b4553e7344dd37239da6d72480832
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Thu Nov 19 23:25:22 2020 +0000
Avoid redirection to quoted filename
C++Builder's `make.exe` cannot handle a command output redirection to a
quoted filename, saying: "The system cannot find the file specified."
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit a75a87561b491fc9b96b15153eba1f5e142280c5
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Thu Nov 19 17:57:46 2020 +0000
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 at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 830cd025b199fab165a378884fb5b4373799bde9
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Mon Nov 16 22:52:44 2020 +0000
Ensure at least one command if no dependencies
C++Builder's `make.exe` complains if a target has no dependencies (e.g.
after variable expansion) and no lines of commands. Ensure there is a
blank command line if the dependency list is entirely made of variables.
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 8557bdde4836b4dc63ad305c9f3c648816a05e86
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sun Nov 15 20:57:49 2020 +0000
Avoid quoting dependency filepaths in build tree
C++Builder's `make.exe` has a bug in finding the rule of a quoted
dependency that doesn't exist in the filesystem. So for example:
A: "src\B" "out\C"
touch $@
out\C:
mkdir out
touch $@
leads to:
Fatal: '"out\C"' does not exist - don't know how to make it
This happens even with the `-N` option, and is different behavior from
Microsoft NMake which documents the feature of [quoted filepaths][1].
Commit cb663908 quoted all dependency filepaths, in case they are used
in a out-of-source build. The quoting is not done for target names,
however, which implies that the build directory is still expected to not
have spaces. It follows that we only need to quote non-generated source
files in dependency lists, since generated source files will be created
in the build directory.
Change the logic accordingly as a workaround, so that it works at least
for in-source builds with C++Builder's `make.exe`.
[1]: https://docs.microsoft.com/cpp/build/reference/long-filenames-in-a-makefile?view=msvc-160
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit e15eff3aaabe17be37ec42ae7ca342cbf2a2733c
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sat Nov 7 20:49:47 2020 +0000
Generalize delimiter in archiver response file
While [`lib.exe` of MSVC][1] expects newline-delimited response file
lines, [`tlib.exe` of C++Builder][2] expects lines to end with `&` in
order to read the next line.
[1]: https://docs.microsoft.com/cpp/build/reference/running-lib?view=msvc-160#lib-command-files
[2]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/TLIB.EXE,_the_Library_Manager#Response_Files
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 118faf5ffe2ba495407f482a8d8438b7d266815c
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sat Nov 7 14:11:05 2020 +0000
Avoid space between "-I" and include directory
The space is problematic with C++Builder (`bcc32.exe`). MSVC (`cl.exe`)
doesn't care.
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 23f3242ffe8613411714eb9350275371059c7bfe
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sat Nov 7 13:13:34 2020 +0000
Move VS Tools configuration to VC-common target
The Windows toolchain is composed of utilites from both the Windows SDK
and the Visual Studio Build Tools. Move the configuration of the latter
utilities into the `VC-common` template inside `10-main.conf`, while
leaving the former utilities in `BASE_Windows`. This allows for other
Windows compilers to be configured inheriting from `BASE_Windows`.
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
commit 1bb381227b432676451ead3f9d4b92352464e9cc
Author: Tanzinul Islam <tanzinul.islam at gmail.com>
Date: Sat Nov 7 12:52:30 2020 +0000
Avoid "&&" in windows-makefile.tmpl
The `make.exe` utility shipped with Embarcadero C++Builder has a special
meaning for the [`&&` operator in commands][1]. This meaning is retained
even in Microsoft NMake compatibility mode (`make -N`). Split all
commands using this shell (`cmd.exe`) operator into two commands.
[1]: http://docwiki.embarcadero.com/RADStudio/Sydney/en/MAKE_Rules_(Explicit_and_Implicit)_and_Commands#MAKE_Command_Operators
Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/13540)
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 2 +
Configurations/00-base-templates.conf | 8 --
Configurations/10-main.conf | 19 +++-
Configurations/50-cppbuilder.conf | 56 ++++++++++++
Configurations/platform/Windows/cppbuilder.pm | 16 ++++
Configurations/windows-makefile.tmpl | 126 +++++++++++++++-----------
Configure | 6 +-
NOTES-WINDOWS.md | 30 ++++++
apps/build.info | 2 +-
apps/cmp.c | 2 +-
apps/lib/apps.c | 2 +-
apps/lib/build.info | 2 +-
build.info | 2 +-
crypto/bio/bss_file.c | 2 +-
crypto/build.info | 2 +-
crypto/conf/conf_sap.c | 2 +-
crypto/init.c | 2 +-
ms/applink.c | 6 ++
ms/uplink.c | 19 +++-
test/build.info | 2 +-
test/conf_include_test.c | 4 +-
test/testutil/driver.c | 2 +-
util/add-depends.pl | 19 +++-
util/mkdef.pl | 8 +-
24 files changed, 254 insertions(+), 87 deletions(-)
create mode 100644 Configurations/50-cppbuilder.conf
create mode 100644 Configurations/platform/Windows/cppbuilder.pm
diff --git a/.gitignore b/.gitignore
index 7a07450106..b88ede1d59 100644
--- a/.gitignore
+++ b/.gitignore
@@ -212,6 +212,7 @@ providers/common/include/prov/der_sm2.h
*.exp
*.lib
*.pdb
+*.tds
*.ilk
*.def
*.rc
@@ -227,6 +228,7 @@ cscope.*
*.d
*.d.tmp
pod2htmd.tmp
+MAKE0[0-9][0-9][0-9].@@@
# Windows manifest files
*.manifest
diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf
index 1da5c5f0d0..0e5d38d5a6 100644
--- a/Configurations/00-base-templates.conf
+++ b/Configurations/00-base-templates.conf
@@ -108,14 +108,6 @@ my %targets=(
return ();
},
- LD => "link",
- LDFLAGS => "/nologo",
- ldoutflag => "/out:",
- AR => "lib",
- ARFLAGS => "/nologo",
- aroutflag => "/out:",
- RC => "rc",
- rcoutflag => "/fo",
MT => "mt",
MTFLAGS => "-nologo",
mtinflag => "-manifest ",
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 9529bbfe5c..f5e5754b3a 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -1275,10 +1275,22 @@ my %targets = (
inherit_from => [ "BASE_Windows" ],
template => 1,
CC => "cl",
- CPP => '$(CC) /EP /C',
+ CPP => '"$(CC)" /EP /C',
CFLAGS => "/W3 /wd4090 /nologo",
- LDFLAGS => add("/debug"),
coutflag => "/Fo",
+ cpp_depend_flags => "/Zs /showIncludes",
+ LD => "link",
+ LDFLAGS => "/nologo /debug",
+ ldoutflag => "/out:",
+ ldpostoutflag => "",
+ ld_resp_delim => "\n",
+ bin_lflags => "setargv.obj",
+ AR => "lib",
+ ARFLAGS => "/nologo",
+ aroutflag => "/out:",
+ ar_resp_delim => "\n",
+ RC => "rc",
+ rcoutflag => "/fo",
defines => add("OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN",
"UNICODE", "_UNICODE",
"_CRT_SECURE_NO_DEPRECATE",
@@ -1291,6 +1303,9 @@ my %targets = (
shared_defflag => '',
shared_ldflag => "/dll",
shared_target => "win-shared", # meaningless except it gives Configure a hint
+ lddefflag => "/def:",
+ ldresflag => " ",
+ ld_implib_flag => "/implib:",
thread_scheme => "winthreads",
dso_scheme => "win32",
perl_platform => 'Windows::MSVC',
diff --git a/Configurations/50-cppbuilder.conf b/Configurations/50-cppbuilder.conf
new file mode 100644
index 0000000000..1c47a4c2be
--- /dev/null
+++ b/Configurations/50-cppbuilder.conf
@@ -0,0 +1,56 @@
+my %targets = (
+ "BC-32" => {
+ inherit_from => [ "BASE_Windows" ],
+ sys_id => "WIN32",
+ bn_ops => "BN_LLONG",
+ thread_scheme => "winthreads",
+ cc => "bcc32c",
+ CPP => "cpp32 -oCON -Sc -Sr",
+ defines => add("WIN32_LEAN_AND_MEAN", "OPENSSL_SYS_WIN32",
+ "L_ENDIAN", "DSO_WIN32", "_stricmp=stricmp",
+ "_strnicmp=strnicmp", "_malloca=malloc",
+ "_freea=free", "_setmode=setmode"),
+ cflags => picker(default => add("-q -c",
+ threads("-tM"),
+ shared("-tR")),
+ debug => "-Od -v -vi- -D_DEBUG",
+ release => "-O2"),
+ bin_cflags => "-tWC",
+ lib_cflags => shared("-tWD -D_WINDLL -D_DLL"),
+ coutflag => "-o",
+ cpp_depend_flags => "-Hp",
+ LD => "ilink32",
+ LDFLAGS => picker(default => "-x -Gn -q -w-dup",
+ debug => '-j"$(BDS)\lib\win32c\debug" ' .
+ '-L"$(BDS)\lib\win32c\debug" -v',
+ release => '-j"$(BDS)\lib\win32c\release" ' .
+ '-L"$(BDS)\lib\win32c\release"'),
+ bin_lflags => "-ap -Tpe c0x32.obj wildargs.obj",
+ ldoutflag => ",",
+ ldpostoutflag => ",,",
+ ld_resp_delim => " +\n",
+ ex_libs => add(sub {
+ my @ex_libs = ("import32.lib",
+ ($disabled{shared}
+ ? ($disabled{threads} ? "cw32.lib" : "cw32mt.lib")
+ : ($disabled{threads} ? "cw32i.lib" : "cw32mti.lib")));
+ push @ex_libs, "ws2_32.lib" unless $disabled{sock};
+ return join(" ", @ex_libs);
+ }),
+ AR => "tlib",
+ ARFLAGS => "/P256 /N /u",
+ ar_resp_delim => " &\n",
+ RC => "brcc32",
+ RCFLAGS => '-i"$(BDS)\include\windows\sdk"',
+ rcoutflag => "-fo",
+ shared_target => "win-shared",
+ shared_ldflag => "-aa -Tpd c0d32.obj",
+ lddefflag => ",",
+ ldresflag => ",",
+ ld_implib_rule => 'implib -a $< $**',
+ dso_scheme => "win32",
+ shared_defflag => '',
+ perl_platform => 'Windows::cppbuilder',
+ uplink_arch => 'common',
+ }
+);
diff --git a/Configurations/platform/Windows/cppbuilder.pm b/Configurations/platform/Windows/cppbuilder.pm
new file mode 100644
index 0000000000..b4d208d6d4
--- /dev/null
+++ b/Configurations/platform/Windows/cppbuilder.pm
@@ -0,0 +1,16 @@
+package platform::Windows::cppbuilder;
+
+use vars qw(@ISA);
+
+require platform::Windows::MSVC;
+ at ISA = qw(platform::Windows::MSVC);
+
+sub pdbext { '.tds' }
+
+# C++Builder's Clang-based compilers prepend an underscore to __cdecl-convention
+# C functions, and the linker needs those as the InternalName in the .def file.
+sub export2internal {
+ return "_$_[1]";
+}
+
+1;
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 050d618a23..6ceab7e94d 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -29,7 +29,7 @@
sub dependmagic {
my $target = shift;
- return "$target: build_generated\n\t\$(MAKE) /\$(MAKEFLAGS) depend && \$(MAKE) /\$(MAKEFLAGS) _$target\n_$target";
+ return "$target: build_generated\n\t\$(MAKE) /\$(MAKEFLAGS) depend\n\t\$(MAKE) /\$(MAKEFLAGS) _$target\n_$target";
}
'';
-}
@@ -226,10 +226,10 @@ libdir={- file_name_is_absolute($libdir)
##### User defined commands and flags ################################
CC="{- $config{CC} -}"
-CPP="{- $config{CPP} -}"
+CPP={- $config{CPP} -}
CPPFLAGS={- our $cppflags1 = join(" ",
(map { "-D".$_} @{$config{CPPDEFINES}}),
- (map { " -I ".$_} @{$config{CPPINCLUDES}}),
+ (map { " -I".$_} @{$config{CPPINCLUDES}}),
@{$config{CPPFLAGS}}) -}
CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
LD="{- $config{LD} -}"
@@ -388,11 +388,15 @@ PROCESSOR= {- $config{processor} -}
build_docs: build_html_docs
build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
-
+ @
build_generated: $(GENERATED_MANDATORY)
+ @
build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
+ @
build_modules_nodep: $(MODULES)
+ @
build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
+ @
# Kept around for backward compatibility
build_apps build_tests: build_programs
@@ -411,19 +415,14 @@ all: build_sw build_docs
test: tests
{- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep copy-utils
@{- output_off() if $disabled{tests}; "" -}
- set SRCTOP=$(SRCDIR)
- set BLDTOP=$(BLDDIR)
- set PERL=$(PERL)
- set FIPSKEY=$(FIPSKEY)
- "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
+ cmd /C "set "SRCTOP=$(SRCDIR)" & set "BLDTOP=$(BLDDIR)" & set "PERL=$(PERL)" & set "FIPSKEY=$(FIPSKEY)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)"
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@$(ECHO) "Tests are not supported with your chosen Configure options"
@{- output_on() if !$disabled{tests}; "" -}
list-tests:
@{- output_off() if $disabled{tests}; "" -}
- @set SRCTOP=$(SRCDIR)
- @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
+ @cmd /C "set "SRCTOP=$(SRCDIR)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" list"
@{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
@$(ECHO) "Tests are not supported with your chosen Configure options"
@{- output_on() if !$disabled{tests}; "" -}
@@ -621,7 +620,7 @@ reconfigure reconf:
{-
use File::Basename;
- use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
+ use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs file_name_is_absolute/;
# Helper function to figure out dependencies on libraries
# It takes a list of library names and outputs a list of dependencies
@@ -640,16 +639,23 @@ $args{target}: $deps
EOF
}
+ # This function (and the next) avoids quoting paths of generated dependencies
+ # (in the build tree), but quotes paths of non-generated dependencies (in the
+ # source tree). This is a workaround for a limitation of C++Builder's make.exe
+ # in handling quoted paths: https://quality.embarcadero.com/browse/RSP-31756
sub generatesrc {
my %args = @_;
my $gen0 = $args{generator}->[0];
my $gen_args = join('', map { " $_" }
@{$args{generator}}[1..$#{$args{generator}}]);
- my $gen_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}});
- my $incs = join("", map { " -I \"$_\"" } @{$args{incs}});
+ my $gen_incs = join("", map { " -I\"$_\"" } @{$args{generator_incs}});
+ my $incs = join("", map { " -I\"$_\"" } @{$args{incs}});
my $defs = join("", map { " -D".$_ } @{$args{defs}});
my $deps = @{$args{deps}} ?
- '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
+ join(' ',
+ map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
+ (@{$args{generator_deps}}, @{$args{deps}}))
+ : '';
if ($args{src} =~ /\.html$/) {
#
@@ -704,22 +710,22 @@ EOF
if ($args{src} =~ /\.S$/) {
return <<"EOF";
$target: "$gen0" $deps
- set ASM=\$(AS)
- $generator \$@.S
- \$(CPP) $incs $cppflags $defs \$@.S > \$@.i && move /Y \$@.i \$@
+ cmd /C "set "ASM=\$(AS)" & $generator \$@.S"
+ \$(CPP) $incs $cppflags $defs \$@.S > \$@.i
+ move /Y \$@.i \$@
del /Q \$@.S
EOF
}
# Otherwise....
return <<"EOF";
$target: "$gen0" $deps
- set ASM=\$(AS)
- $generator \$@
+ cmd /C "set "ASM=\$(AS)" & $generator \$@"
EOF
}
return <<"EOF";
$target: "$gen0" $deps
- \$(CPP) $incs $cppflags $defs "$gen0" > \$@.i && move /Y \$@.i \$@
+ \$(CPP) $incs $cppflags $defs "$gen0" > \$@.i
+ move /Y \$@.i \$@
EOF
} elsif ($gen0 =~ m|^.*\.in$|) {
#
@@ -785,8 +791,10 @@ EOF
? platform->asm($x) : $x }
( @{$args{srcs}} );
my $srcs = '"'.join('" "', @srcs).'"';
- my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
- my $incs = join("", map { ' -I "'.$_.'"' } @{$args{incs}});
+ my $deps = join(' ',
+ map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ }
+ (@srcs, @{$args{deps}}));
+ my $incs = join("", map { ' -I"'.$_.'"' } @{$args{incs}});
my $defs = join("", map { " -D".$_ } @{$args{defs}});
my $cflags = { shlib => ' $(LIB_CFLAGS)',
lib => ' $(LIB_CFLAGS)',
@@ -819,7 +827,8 @@ EOF
} elsif ($srcs[0] =~ /.S$/) {
return <<"EOF";
$obj: $deps
- \$(CC) /EP -D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm && \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm
+ \$(CC) /EP -D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm
+ \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm
EOF
}
my $recipe = <<"EOF";
@@ -827,7 +836,7 @@ $obj: $deps
\$(CC) $cflags $defs -c \$(COUTFLAG)\$\@ $srcs
EOF
$recipe .= <<"EOF" unless $disabled{makedepend};
- \$(CC) $cflags $defs /Zs /showIncludes $srcs 2>&1 > $dep
+ cmd /C "\$(CPP) $cflags $defs $target{cpp_depend_flags} $srcs > $dep 2>&1"
EOF
return $recipe;
}
@@ -839,31 +848,38 @@ EOF
my %args = @_;
my $lib = $args{lib};
my @objs = map { platform->convertext($_) }
- grep { platform->isobj($_) || platform->isres($_) }
+ grep { platform->isobj($_) }
+ @{$args{objs}};
+ my @ress = map { platform->convertext($_) }
+ grep { platform->isres($_) }
@{$args{objs}};
my @defs = map { platform->def($_) }
grep { platform->isdef($_) }
@{$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 $deps = join(" ", @objs, @defs, @deps);
+ my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
+ my $objs = join($target{ld_resp_delim}, @objs);
+ my $ress = join($target{ld_resp_delim}, @ress);
+ my $deps = join(" ", @objs, @ress, @defs, @deps);
my $import = platform->sharedlib_import($lib);
my $dll = platform->sharedlib($lib);
- my $shared_def = join("", map { " /def:$_" } @defs);
+ my $shared_def = $target{lddefflag} . join("", @defs);
+ my $implib_rule = $target{ld_implib_rule} || "";
+ my $implib_flag = $target{ld_implib_flag}
+ ? "$target{ld_implib_flag}$import"
+ : "";
return <<"EOF"
# The import library may look like a static library, but it is not.
# We MUST make the import library depend on the DLL, in case someone
# mistakenly removes the latter.
$import: $dll
+ $implib_rule
$dll: $deps
IF EXIST $full.manifest DEL /F /Q $full.manifest
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)
+ 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 \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll
@@ -880,23 +896,26 @@ EOF
my $dso = platform->dso($args{module});
my $dso_n = platform->dsoname($args{module});
my @objs = map { platform->convertext($_) }
- grep { platform->isobj($_) || platform->isres($_) }
+ grep { platform->isobj($_) }
+ @{$args{objs}};
+ my @ress = map { platform->convertext($_) }
+ grep { platform->isres($_) }
@{$args{objs}};
my @defs = map { platform->def($_) }
grep { platform->isdef($_) }
@{$args{objs}};
my @deps = compute_lib_depends(@{$args{deps}});
- my $objs = join("\n", @objs);
- my $linklibs = join("", map { "$_\n" } @deps);
- my $deps = join(" ", @objs, @defs, @deps);
- my $shared_def = join("", map { " /def:$_" } @defs);
+ die "More than one exported symbols list" if scalar @defs > 1;
+ my $objs = join($target{ld_resp_delim}, @objs);
+ my $ress = join($target{ld_resp_delim}, @ress);
+ my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
+ my $deps = join(" ", @objs, @ress, @defs, @deps);
+ my $shared_def = $target{lddefflag} . join("", @defs);
return <<"EOF";
$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)
+ 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 \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso.manifest \$(MTOUTFLAG)$dso
@@ -906,7 +925,7 @@ EOF
my %args = @_;
my $lib = platform->staticlib($args{lib});
my @objs = map { platform->obj($_) } @{$args{objs}};
- my $objs = join("\n", @objs);
+ my $objs = join($target{ar_resp_delim}, @objs);
my $deps = join(" ", @objs);
return <<"EOF";
$lib: $deps
@@ -919,19 +938,20 @@ EOF
my %args = @_;
my $bin = platform->bin($args{bin});
my @objs = map { platform->convertext($_) }
- grep { platform->isobj($_) || platform->isres($_) }
+ grep { platform->isobj($_) }
+ @{$args{objs}};
+ my @ress = map { platform->convertext($_) }
+ grep { platform->isres($_) }
@{$args{objs}};
my @deps = compute_lib_depends(@{$args{deps}});
- my $objs = join("\n", @objs);
- my $linklibs = join("", map { "$_\n" } @deps);
- my $deps = join(" ", @objs, @deps);
+ my $objs = join($target{ld_resp_delim}, @objs);
+ my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps);
+ my $deps = join(" ", @objs, @ress, @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}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress
<<
IF EXIST $bin.manifest \\
\$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin
@@ -947,7 +967,7 @@ EOF
return <<"EOF";
$script: $sources
"\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
- "-o$target{build_file}" $sources > "$script"
+ "-o$target{build_file}" $sources > \$@
EOF
}
sub generatedir {
diff --git a/Configure b/Configure
index e36c5d93aa..76c27bacb8 100755
--- a/Configure
+++ b/Configure
@@ -1533,10 +1533,10 @@ unless ($disabled{asm}) {
# Check for makedepend capabilities.
if (!$disabled{makedepend}) {
- if ($config{target} =~ /^(VC|vms)-/) {
- # For VC- and vms- targets, there's nothing more to do here. The
+ if ($config{target} =~ /^(VC|BC|vms)-/) {
+ # For VC-, BC- and vms- targets, there's nothing more to do here. The
# functionality is hard coded in the corresponding build files for
- # cl (Windows) and CC/DECC (VMS).
+ # cl/cpp32 (Windows) and CC/DECC (VMS).
} elsif (($predefined_C{__GNUC__} // -1) >= 3
&& !($predefined_C{__APPLE_CC__} && !$predefined_C{__clang__})) {
# We know that GNU C version 3 and up as well as all clang
diff --git a/NOTES-WINDOWS.md b/NOTES-WINDOWS.md
index dca13a7260..7ca8de299e 100644
--- a/NOTES-WINDOWS.md
+++ b/NOTES-WINDOWS.md
@@ -2,6 +2,8 @@ Notes for Windows platforms
===========================
- [Native builds using Visual C++](#native-builds-using-visual-c++)
+ - [Native builds using Embarcadero C++Builder](
+ #native-builds-using-embarcadero-c++-builder)
- [Native builds using MinGW](#native-builds-using-mingw)
- [Linking native applications](#linking-native-applications)
- [Hosted builds using Cygwin](#hosted-builds-using-cygwin)
@@ -13,6 +15,8 @@ There are various options to build and run OpenSSL on the Windows platforms.
To build a native OpenSSL you can either use:
Microsoft Visual C++ (MSVC) C compiler on the command line
+or
+ Embarcadero C++Builder
or
MinGW cross compiler
run on the GNU-like development environment MSYS2
@@ -119,6 +123,32 @@ Special notes for Universal Windows Platform builds, aka VC-*-UWP
"vcvarsall.bat" before you compile. For example, if you want to build
"arm64" builds, you should run "vcvarsall.bat x86_arm64 uwp".
+Native builds using Embarcadero C++Builder
+=========================================
+
+This toolchain (a descendant of Turbo/Borland C++) is an alternative to MSVC.
+OpenSSL currently includes an experimental 32-bit configuration targeting the
+Clang-based compiler (bcc32c.exe) in v10.3.3 Community Edition.
+<https://www.embarcadero.com/products/cbuilder/starter>
+
+ 1. Install Perl.
+
+ 2. Open the RAD Studio Command Prompt.
+
+ 3. Go to the root of the OpenSSL source directory and run:
+ perl Configure BC-32 --prefix=%CD%
+
+ 4. make -N
+
+ 5. make -N test
+
+ 6. Build your program against this OpenSSL:
+ * Set your include search path to the "include" subdirectory of OpenSSL.
+ * Set your library search path to the OpenSSL source directory.
+
+Note that this is very experimental. Support for 64-bit and other Configure
+options is still pending.
+
Native builds using MinGW
=========================
diff --git a/apps/build.info b/apps/build.info
index 146e9009f5..06759b2f94 100644
--- a/apps/build.info
+++ b/apps/build.info
@@ -71,7 +71,7 @@ IF[{- !$disabled{apps} -}]
# always depend on a changed configuration.
DEPEND[progs.c]=../configdata.pm
- IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+ IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}]
GENERATE[openssl.rc]=../util/mkrc.pl openssl
SOURCE[openssl]=openssl.rc
ENDIF
diff --git a/apps/cmp.c b/apps/cmp.c
index 50282315d8..644fb545d2 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -20,7 +20,7 @@
#include "cmp_mock_srv.h"
/* tweaks needed due to missing unistd.h on Windows */
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__BORLANDC__)
# define access _access
#endif
#ifndef F_OK
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index df4edfb837..7eadf5a4b5 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -50,7 +50,7 @@ static int WIN32_rename(const char *from, const char *to);
# include <conio.h>
#endif
-#if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32)
+#if defined(OPENSSL_SYS_MSDOS) && !defined(_WIN32) || defined(__BORLANDC__)
# define _kbhit kbhit
#endif
diff --git a/apps/lib/build.info b/apps/lib/build.info
index c352f7086d..340ce29b09 100644
--- a/apps/lib/build.info
+++ b/apps/lib/build.info
@@ -1,5 +1,5 @@
# Auxiliary program source
-IF[{- $config{target} =~ /^(?:VC-|mingw)/ -}]
+IF[{- $config{target} =~ /^(?:VC-|mingw|BC-)/ -}]
# It's called 'init', but doesn't have much 'init' in it...
$AUXLIBAPPSSRC=win32_init.c
ENDIF
diff --git a/build.info b/build.info
index f631d6c780..6c91e22309 100644
--- a/build.info
+++ b/build.info
@@ -79,7 +79,7 @@ IF[{- defined $target{shared_defflag} -}]
GENERATE[libssl.ld]=util/libssl.num libssl
ENDIF
-IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}]
GENERATE[libcrypto.rc]=util/mkrc.pl libcrypto
GENERATE[libssl.rc]=util/mkrc.pl libssl
diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c
index 981a5e7b59..41c3a59665 100644
--- a/crypto/bio/bss_file.c
+++ b/crypto/bio/bss_file.c
@@ -216,7 +216,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
# define _IOB_ENTRIES 20
# endif
/* Safety net to catch purely internal BIO_set_fp calls */
-# if defined(_MSC_VER) && _MSC_VER>=1900
+# if (defined(_MSC_VER) && _MSC_VER>=1900) || defined(__BORLANDC__)
if (ptr == stdin || ptr == stdout || ptr == stderr)
BIO_clear_flags(b, BIO_FLAGS_UPLINK_INTERNAL);
# elif defined(_IOB_ENTRIES)
diff --git a/crypto/build.info b/crypto/build.info
index 3b78431f80..3e1c295aea 100644
--- a/crypto/build.info
+++ b/crypto/build.info
@@ -131,6 +131,6 @@ INCLUDE[armv4cpuid.o]=.
GENERATE[s390xcpuid.S]=s390xcpuid.pl
INCLUDE[s390xcpuid.o]=.
-IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-|BC-)/ -}]
SHARED_SOURCE[../libcrypto]=dllmain.c
ENDIF
diff --git a/crypto/conf/conf_sap.c b/crypto/conf/conf_sap.c
index 4188f9113a..5cd018c167 100644
--- a/crypto/conf/conf_sap.c
+++ b/crypto/conf/conf_sap.c
@@ -15,7 +15,7 @@
#include <openssl/asn1.h>
#include <openssl/engine.h>
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__BORLANDC__)
# define strdup _strdup
#endif
diff --git a/crypto/init.c b/crypto/init.c
index bf5c17da6d..788abe52e8 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -89,7 +89,7 @@ DEFINE_RUN_ONCE_STATIC(ossl_init_register_atexit)
fprintf(stderr, "OPENSSL_INIT: ossl_init_register_atexit()\n");
#endif
#ifndef OPENSSL_SYS_UEFI
-# ifdef _WIN32
+# if defined(_WIN32) && !defined(__BORLANDC__)
/* We use _onexit() in preference because it gets called on DLL unload */
if (_onexit(win32atexit) == NULL)
return 0;
diff --git a/ms/applink.c b/ms/applink.c
index d19966a33e..2cf3a92f18 100644
--- a/ms/applink.c
+++ b/ms/applink.c
@@ -38,6 +38,12 @@
# include <io.h>
# include <fcntl.h>
+# ifdef __BORLANDC__
+ /* _lseek in <io.h> is a function-like macro so we can't take its address */
+# undef _lseek
+# define _lseek lseek
+# endif
+
static void *app_stdin(void)
{
return stdin;
diff --git a/ms/uplink.c b/ms/uplink.c
index 8c61a7ed1d..f924eb3e58 100644
--- a/ms/uplink.c
+++ b/ms/uplink.c
@@ -99,14 +99,29 @@ void OPENSSL_Uplink(volatile void **table, int index)
table[index] = func;
}
-#if defined(_MSC_VER) && defined(_M_IX86)
-# define LAZY(i) \
+#if (defined(_MSC_VER) || defined(__BORLANDC__)) && defined(_M_IX86)
+# if defined(_MSC_VER)
+# define LAZY(i) \
__declspec(naked) static void lazy##i (void) { \
_asm push i \
_asm push OFFSET OPENSSL_UplinkTable \
_asm call OPENSSL_Uplink \
_asm add esp,8 \
_asm jmp OPENSSL_UplinkTable+4*i }
+# elif defined(__BORLANDC__) && defined(__clang__)
+void *OPENSSL_UplinkTable[26]; /* C++Builder requires declaration before use */
+# define LAZY(i) \
+__declspec(naked) static void lazy##i (void) { \
+ __asm__("pushl $" #i "; " \
+ "pushl %0; " \
+ "call %P1; " \
+ "addl $8, %%esp; " \
+ "jmp *%2 " \
+ : /* no outputs */ \
+ : "i" (OPENSSL_UplinkTable), \
+ "i" (OPENSSL_Uplink), \
+ "m" (OPENSSL_UplinkTable[i])); }
+# endif
# if APPLINK_MAX>25
# error "Add more stubs..."
diff --git a/test/build.info b/test/build.info
index b31e5dedd5..8043f0d3be 100644
--- a/test/build.info
+++ b/test/build.info
@@ -5,7 +5,7 @@
# be useful here.
#
# Auxiliary program source (copied from ../apps/build.info)
-IF[{- $config{target} =~ /^(?:VC-|mingw)/ -}]
+IF[{- $config{target} =~ /^(?:VC-|mingw|BC-)/ -}]
# It's called 'init', but doesn't have much 'init' in it...
$AUXLIBAPPSSRC=../apps/lib/win32_init.c
ENDIF
diff --git a/test/conf_include_test.c b/test/conf_include_test.c
index 0cf8d49740..a38c4913d2 100644
--- a/test/conf_include_test.c
+++ b/test/conf_include_test.c
@@ -16,7 +16,9 @@
#ifdef _WIN32
# include <direct.h>
# define DIRSEP "/\\"
-# define chdir _chdir
+# ifndef __BORLANDC__
+# define chdir _chdir
+# endif
# define DIRSEP_PRESERVE 0
#elif !defined(OPENSSL_NO_POSIX_IO)
# include <unistd.h>
diff --git a/test/testutil/driver.c b/test/testutil/driver.c
index 0b50e2ae16..702f7b2caa 100644
--- a/test/testutil/driver.c
+++ b/test/testutil/driver.c
@@ -19,7 +19,7 @@
#include "platform.h" /* From libapps */
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__BORLANDC__)
# define strdup _strdup
#endif
diff --git a/util/add-depends.pl b/util/add-depends.pl
index 1a87cdd364..6fdc5e5ef4 100644
--- a/util/add-depends.pl
+++ b/util/add-depends.pl
@@ -161,8 +161,7 @@ my %procedures = (
},
'VC' =>
sub {
- # For the moment, we only support Visual C on native Windows, or
- # compatible compilers. With those, the flags /Zs /showIncludes
+ # On Windows, with Microsoft Visual C the flags /Zs /showIncludes
# give us the necessary output to be able to create dependencies
# that nmake (or any 'make' implementation) should be able to read,
# with a bit of help. The output we're interested in looks like
@@ -170,6 +169,15 @@ my %procedures = (
#
# Note: including file: {whatever header file}
#
+ # With Embarcadero C++Builder's preprocessor (cpp32.exe) the -Hp
+ # flag gives us the preprocessed output annotated with the following
+ # note whenever a #include file is read:
+ #
+ # Including ->->{whatever header file}
+ #
+ # where each "->" indicates the nesting level of the #include. The
+ # logic here is otherwise the same as the 'VC' case.
+ #
# Since there's no object file name at all in that information,
# we must construct it ourselves.
@@ -180,13 +188,14 @@ my %procedures = (
# warnings, so we simply discard anything that doesn't start with
# the Note:
- if (/^Note: including file: */) {
+ if (/^Note: including file: */ or /^Including (->)*/) {
(my $tail = $') =~ s/\s*\R$//;
# VC gives us absolute paths for all include files, so to
# remove system header dependencies, we need to check that
- # they don't match $abs_srcdir or $abs_blddir.
- $tail = canonpath($tail);
+ # they don't match $abs_srcdir or $abs_blddir. C++Builder gives
+ # us relative paths when possible, so convert to absolute paths.
+ $tail = rel2abs($tail);
unless (defined $depconv_cache{$tail}) {
my $dep = $tail;
diff --git a/util/mkdef.pl b/util/mkdef.pl
index a4772e9c8f..3207040e25 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -295,12 +295,16 @@ sub writer_windows {
; Definition file for the DLL version of the $libname library from OpenSSL
;
-LIBRARY $libname
+LIBRARY "$libname"
EXPORTS
_____
for (@_) {
- print " ",$_->name(),"\n";
+ print " ",$_->name();
+ if (platform->can('export2internal')) {
+ print "=". platform->export2internal($_->name());
+ }
+ print "\n";
}
}
More information about the openssl-commits
mailing list