From 9f323d310f21994e9656096365dcc3375ce92035 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Sat, 19 Jun 1993 08:14:23 +0000 Subject: [PATCH] (MAYBE_VMS_FUNCTION_PROLOGUE): adjust stack pointer by 4 prior to calling C$MAIN_ARGS... (MAYBE_VMS_FUNCTION_PROLOGUE): adjust stack pointer by 4 prior to calling C$MAIN_ARGS, otherwise POSIX edition of that routine dies. From-SVN: r4697 --- gcc/config/vax/vms.h | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/gcc/config/vax/vms.h b/gcc/config/vax/vms.h index 481e3bf8b6c..a52e8d5de8e 100644 --- a/gcc/config/vax/vms.h +++ b/gcc/config/vax/vms.h @@ -95,23 +95,27 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ * if we are running g++, and add the jsb if it is. In gcc there should never * be a space in the function name, and in g++ there is always a "(" in the * function name, thus there should never be any confusion. + * + * Adjusting the stack pointer by 4 before calling C$MAIN_ARGS is required + * when linking with the VMS POSIX version of the C run-time library; using + * `subl2 $4,r0' is adequate but we use `clrl -(sp)' instead. The extra 4 + * bytes could be removed after the call because STARTING_FRAME_OFFSET's + * setting of -4 will end up adding them right back again, but don't bother. */ #define MAYBE_VMS_FUNCTION_PROLOGUE(FILE) \ { extern char *current_function_name; \ - if (!strcmp ("main", current_function_name)) \ - fprintf(FILE, "\tjsb _C$MAIN_ARGS\n"); \ - else { \ - char *p = current_function_name; \ - while (*p != '\0') \ - if (*p == *__MAIN_NAME) \ - if (strncmp(p, __MAIN_NAME, (sizeof __MAIN_NAME)-1) == 0) {\ - fprintf(FILE, "\tjsb _C$MAIN_ARGS\n");\ - break; \ - } else \ - p++; \ - else \ - p++; \ - }; \ + char *p = current_function_name; \ + int is_main = strcmp ("main", p) == 0; \ + while (!is_main && *p != '\0') \ + { \ + if (*p == *__MAIN_NAME \ + && strncmp (p, __MAIN_NAME, sizeof __MAIN_NAME - sizeof "") == 0) \ + is_main = 1; \ + else \ + p++; \ + } \ + if (is_main) \ + fprintf (FILE, "\t%s\n\t%s\n", "clrl -(sp)", "jsb _C$MAIN_ARGS"); \ } /* This macro definition sets up a default value for `main' to return. */ -- 2.30.2