Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt building OpenSSL 3.0 for VMS #15317

Closed
wants to merge 12 commits into from

Conversation

levitte
Copy link
Member

@levitte levitte commented May 18, 2021

The biggest part of adapting the build of OpenSSL 3.0 to VMS was to deal with a larger and varying number of inclusion directories.

With pre-3.0, these directories were relatively few, so its descrip.mms (what Unix folks call "Makefile") did a few dirty hacks using logical names and that was that, and the command line was still kept within the command line length limit (which is pretty short).
With 3.0, the strategy needed to be changed. Fortunately, the VMS C compiler has the qualifier /FIRST_INCLUDE (corresponding to gcc's -include flag) and a useful pragma, #pragma include_directory "/path/to/header/files", so what we do is to automatically generate header files with the appropriate inclusion directories for diverse cases, and use them when compiling.

The rest of the changes is simply playing catch-up with what has happened with the Unix and Windows Makefile templates.

A consequence of this is that many of the rather special variables in descrip.mms are removed, as going through them is pretty cumbersome and benefits no one. Instead, a set of useful perl variables are set up in descrip.mms.tmpl, and are used directly by the perl fragments

Fixes #14247

Note that this does not include diverse C source file changes that are needed to build without errors. Those will come in a separate PR.

VMS C can be notoriously informative about certain things, such as
unsupported pragmas.  The case here is that it doesn't support
"#pragma once", and since we use those quite a lot, that's a lot of
repeated information.  We simply turn that warning off.
Get it back in sync with the other templates, and correct a few syntax
errors that have crept in.

Fixes openssl#14247
VMS unpackers will typically convert any period ('.') in directory
names to underscores, since the period is a path separator on VMS,
just like '/' is a path separator on Unix.  Our fallback mechanism
needs to account for that.
It was looking in the wrong place in %unified_info to determine if the
library would be installed or not.
`use lib` needs Unix formatted paths.  For VMS, it means that we must
make sure to convert paths, and we may as well generalise it.

In this case, we need to adapt the functions sourcedir() and sourcefile()
Instead of what we used to do, put all include directories in a number
of DCL variables and generate the /INCLUDE qualifier value on the
command line, we instead generate VMS C specific header files with
include directory pragmas, to be used with the VMS C's /FIRST_INCLUDE
qualifier.  This also shortens the command line, the size of which is
limited.

VMS C needs to have those include directories specified in a Unix
form, to be able to safely merge #include paths with them when
searching through them.

Fixes openssl#14247
crypto/ec/curve448/ has a series of inclusions that throws VMS C
off, so we compensate for it the same way as we have done before.

Fixes openssl#14247
We have pretty long symbol names, so they need to be shortened to fit
in the linker's 31 character limit on symbols.

Symbol name shortening with the VMS C compiler works in such a way
that a symbol name that's longer than 31 characters is mangled into
its first original 22 characters, followed by a dollar sign and the
32-bit CRC of the original symbol name in hexadecimal.
@levitte levitte added branch: master Merge to master branch approval: review pending This pull request needs review by a committer labels May 18, 2021
@levitte
Copy link
Member Author

levitte commented May 18, 2021

Windows failure fixed

A bit of quoting is all that's needed, and it doesn't hurt other platforms.
@levitte
Copy link
Member Author

levitte commented May 18, 2021

Small tweak added, please re-approve

@t-j-h
Copy link
Member

t-j-h commented May 18, 2021

Still approved

@levitte levitte added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels May 18, 2021
@t8m t8m closed this May 18, 2021
@t8m t8m reopened this May 18, 2021
@levitte levitte added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels May 19, 2021
openssl-machine pushed a commit that referenced this pull request May 19, 2021
VMS C can be notoriously informative about certain things, such as
unsupported pragmas.  The case here is that it doesn't support
"#pragma once", and since we use those quite a lot, that's a lot of
repeated information.  We simply turn that warning off.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
Get it back in sync with the other templates, and correct a few syntax
errors that have crept in.

Fixes #14247

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
VMS unpackers will typically convert any period ('.') in directory
names to underscores, since the period is a path separator on VMS,
just like '/' is a path separator on Unix.  Our fallback mechanism
needs to account for that.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
It was looking in the wrong place in %unified_info to determine if the
library would be installed or not.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
`use lib` needs Unix formatted paths.  For VMS, it means that we must
make sure to convert paths, and we may as well generalise it.

In this case, we need to adapt the functions sourcedir() and sourcefile()

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
Instead of what we used to do, put all include directories in a number
of DCL variables and generate the /INCLUDE qualifier value on the
command line, we instead generate VMS C specific header files with
include directory pragmas, to be used with the VMS C's /FIRST_INCLUDE
qualifier.  This also shortens the command line, the size of which is
limited.

VMS C needs to have those include directories specified in a Unix
form, to be able to safely merge #include paths with them when
searching through them.

Fixes #14247

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
crypto/ec/curve448/ has a series of inclusions that throws VMS C
off, so we compensate for it the same way as we have done before.

Fixes #14247

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
We have pretty long symbol names, so they need to be shortened to fit
in the linker's 31 character limit on symbols.

Symbol name shortening with the VMS C compiler works in such a way
that a symbol name that's longer than 31 characters is mangled into
its first original 22 characters, followed by a dollar sign and the
32-bit CRC of the original symbol name in hexadecimal.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
openssl-machine pushed a commit that referenced this pull request May 19, 2021
A bit of quoting is all that's needed, and it doesn't hurt other platforms.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from #15317)
@levitte
Copy link
Member Author

levitte commented May 19, 2021

Merged

58ad786 Turn off VMS C's info about unsupported pragmas
2211905 Configurations/descrip.mms.tmpl: Diverse updates
a2625c0 Fix OpenSSL::fallback for VMS
a1181fb Fix The VMS variant of platform->staticname()
0c1428f Fix configdata.pm.in's "use lib" for VMS
cfc73c2 Thrown away all special descrip.mms variables
0cbb6f6 Configurations/descrip.mms.tmpl: Change strategy for include directories
8ba3a15 Configurations/descrip.mms.tmpl: Add another inclusion hack
31be74d VMS need to build DSO with name shortening, because of provider code
bba402e Tweak apps/build.info for VMS

@levitte levitte closed this May 19, 2021
@levitte levitte deleted the adapt-3.0-to-vms branch May 19, 2021 10:40
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
VMS C can be notoriously informative about certain things, such as
unsupported pragmas.  The case here is that it doesn't support
"#pragma once", and since we use those quite a lot, that's a lot of
repeated information.  We simply turn that warning off.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
Get it back in sync with the other templates, and correct a few syntax
errors that have crept in.

Fixes openssl#14247

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
VMS unpackers will typically convert any period ('.') in directory
names to underscores, since the period is a path separator on VMS,
just like '/' is a path separator on Unix.  Our fallback mechanism
needs to account for that.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
It was looking in the wrong place in %unified_info to determine if the
library would be installed or not.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
`use lib` needs Unix formatted paths.  For VMS, it means that we must
make sure to convert paths, and we may as well generalise it.

In this case, we need to adapt the functions sourcedir() and sourcefile()

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
Instead of what we used to do, put all include directories in a number
of DCL variables and generate the /INCLUDE qualifier value on the
command line, we instead generate VMS C specific header files with
include directory pragmas, to be used with the VMS C's /FIRST_INCLUDE
qualifier.  This also shortens the command line, the size of which is
limited.

VMS C needs to have those include directories specified in a Unix
form, to be able to safely merge #include paths with them when
searching through them.

Fixes openssl#14247

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
crypto/ec/curve448/ has a series of inclusions that throws VMS C
off, so we compensate for it the same way as we have done before.

Fixes openssl#14247

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
We have pretty long symbol names, so they need to be shortened to fit
in the linker's 31 character limit on symbols.

Symbol name shortening with the VMS C compiler works in such a way
that a symbol name that's longer than 31 characters is mangled into
its first original 22 characters, followed by a dollar sign and the
32-bit CRC of the original symbol name in hexadecimal.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
devnexen pushed a commit to devnexen/openssl that referenced this pull request Jul 7, 2021
A bit of quoting is all that's needed, and it doesn't hurt other platforms.

Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from openssl#15317)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Merge to master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenSSL 3.0 currently doesn't build on OpenVMS, adaptation needed
3 participants