Force argv to be an array of long pointers on VMS

Reverts commit 087ca80ad83071dde0bb6bc1c28c743caa00eaf8

Instead of battling the odd format of argv given to main() in default
P64 mode, tell the compiler to make it an array of 64-bit pointers
when compiling in P64 mode.

A note is added in NOTES.VMS regarding minimum DEC C version.

Reviewed-by: Andy Polyakov <appro@openssl.org>
This commit is contained in:
Richard Levitte 2016-04-01 12:36:51 +02:00
parent 5902821d81
commit 368058d0a7
5 changed files with 19 additions and 24 deletions

View File

@ -1763,7 +1763,7 @@ sub vms_info {
"vms-alpha-p64" => { "vms-alpha-p64" => {
inherit_from => [ "vms-alpha" ], inherit_from => [ "vms-alpha" ],
cflags => cflags =>
add("/POINTER_SIZE=64", add("/POINTER_SIZE=64=ARGV",
sub { my @warnings = sub { my @warnings =
@{vms_info()->{disable_warns_p64}}; @{vms_info()->{disable_warns_p64}};
@warnings @warnings
@ -1796,7 +1796,7 @@ sub vms_info {
"vms-ia64-p64" => { "vms-ia64-p64" => {
inherit_from => [ "vms-ia64" ], inherit_from => [ "vms-ia64" ],
cflags => cflags =>
add("/POINTER_SIZE=64", add("/POINTER_SIZE=64=ARGV",
sub { my @warnings = sub { my @warnings =
@{vms_info()->{disable_warns_p64}}; @{vms_info()->{disable_warns_p64}};
@warnings @warnings

View File

@ -18,8 +18,9 @@
An ANSI C compiled is needed among other things. This means that An ANSI C compiled is needed among other things. This means that
VAX C is not and will not be supported. VAX C is not and will not be supported.
We have only tested with DEC C (a.k.a HP VMS C / VSI C), compiling We have only tested with DEC C (a.k.a HP VMS C / VSI C) and require
with a different ANSI C compiler may require some work. version 7.1 or later. Compiling with a different ANSI C compiler may
require some work.
Please avoid using C RTL feature logical names DECC$* when building Please avoid using C RTL feature logical names DECC$* when building
and testing OpenSSL. Most of all, they can be disruptive when and testing OpenSSL. Most of all, they can be disruptive when

View File

@ -445,15 +445,12 @@ typedef struct args_st {
char **argv; char **argv;
} ARGS; } ARGS;
#if defined(OPENSSL_SYS_VMS) && defined(__DECC) /*
# pragma pointer_size save * VMS C only for now, implemented in vms_decc_init.c
# pragma pointer_size 32 * If other C compilers forget to terminate argv with NULL, this function
typedef char **argv_t; * can be re-used.
# pragma pointer_size restore */
char **copy_argv(int *argc, argv_t argv); char **copy_argv(int *argc, char *argv[]);
#else
typedef char **argv_t;
#endif
# define PW_MIN_LENGTH 4 # define PW_MIN_LENGTH 4

View File

@ -216,7 +216,6 @@ int main(int argc, char *argv[])
FUNCTION f, *fp; FUNCTION f, *fp;
LHASH_OF(FUNCTION) *prog = NULL; LHASH_OF(FUNCTION) *prog = NULL;
char **copied_argv = NULL; char **copied_argv = NULL;
char **argv_alias = NULL;
char *p, *pname; char *p, *pname;
char buf[1024]; char buf[1024];
const char *prompt; const char *prompt;
@ -232,10 +231,8 @@ int main(int argc, char *argv[])
bio_out = dup_bio_out(FORMAT_TEXT); bio_out = dup_bio_out(FORMAT_TEXT);
bio_err = dup_bio_err(FORMAT_TEXT); bio_err = dup_bio_err(FORMAT_TEXT);
#if defined( OPENSSL_SYS_VMS) && defined(__DECC) #if defined(OPENSSL_SYS_VMS) && defined(__DECC)
copied_argv = argv_alias = copy_argv(&argc, argv); copied_argv = argv = copy_argv(&argc, argv);
#else
argv_alias = argv;
#endif #endif
p = getenv("OPENSSL_DEBUG_MEMORY"); p = getenv("OPENSSL_DEBUG_MEMORY");
@ -259,22 +256,22 @@ int main(int argc, char *argv[])
goto end; goto end;
prog = prog_init(); prog = prog_init();
pname = opt_progname(argv_alias[0]); pname = opt_progname(argv[0]);
/* first check the program name */ /* first check the program name */
f.name = pname; f.name = pname;
fp = lh_FUNCTION_retrieve(prog, &f); fp = lh_FUNCTION_retrieve(prog, &f);
if (fp != NULL) { if (fp != NULL) {
argv_alias[0] = pname; argv[0] = pname;
ret = fp->func(argc, argv_alias); ret = fp->func(argc, argv);
goto end; goto end;
} }
/* If there is stuff on the command line, run with that. */ /* If there is stuff on the command line, run with that. */
if (argc != 1) { if (argc != 1) {
argc--; argc--;
argv_alias++; argv++;
ret = do_cmd(prog, argc, argv_alias); ret = do_cmd(prog, argc, argv);
if (ret < 0) if (ret < 0)
ret = 0; ret = 0;
goto end; goto end;

View File

@ -106,7 +106,7 @@ decc_feat_t decc_feat_array[] = {
}; };
char **copy_argv(int *argc, argv_t argv) char **copy_argv(int *argc, char *argv[])
{ {
/*- /*-
* The note below is for historical purpose. On VMS now we always * The note below is for historical purpose. On VMS now we always