aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-03-26 09:35:18 +0000
committerTristan Gingold <gingold@gcc.gnu.org>2012-03-26 09:35:18 +0000
commit4b12e93df87d277dd252b39c364953502615a35d (patch)
treea973198f8cc041f46894699052afb7913081bb3a /gcc
parentdb9f46a92723506a064fba0b58e27fd1c2f1a1d8 (diff)
downloadgcc-4b12e93df87d277dd252b39c364953502615a35d.zip
gcc-4b12e93df87d277dd252b39c364953502615a35d.tar.gz
gcc-4b12e93df87d277dd252b39c364953502615a35d.tar.bz2
vms.h (LINK_SPEC): Simplify.
libgcc/ 2012-03-26 Tristan Gingold <gingold@adacore.com> * config/alpha/vms.h (LINK_SPEC): Simplify. (STARTFILE_SPEC): Remove -mvms-return-codes handling. (NAME__MAIN, SYMBOL__MAIN): Remove. (VMS_DEBUG_MAIN_POINTER): Remove. * config/ia64/vms.h: Likewise. * config/alpha/alpha.c (alpha_start_function): Move vms_debug_main code to vms.c. Call vms_start_function. * config/ia64/ia64.c (ia64_start_function): Likewise. * config/vms/vms-protos.h (vms_start_function): Declare. * config/vms/vms.c (vms_start_function): New function. * config/vms/vms.h (MATH_LIBRARY): Define. (VMS_DEBUG_MAIN_POINTER): Define. gcc/ 2012-03-26 Tristan Gingold <gingold@adacore.com> * config/alpha/vms.h (LINK_SPEC): Simplify. (STARTFILE_SPEC): Remove -mvms-return-codes handling. (NAME__MAIN, SYMBOL__MAIN): Remove. (VMS_DEBUG_MAIN_POINTER): Remove. * config/ia64/vms.h: Likewise. * config/alpha/alpha.c (alpha_start_function): Move vms_debug_main code to vms.c. Call vms_start_function. * config/ia64/ia64.c (ia64_start_function): Likewise. * config/vms/vms-protos.h (vms_start_function): Declare. * config/vms/vms.c (vms_start_function): New function. * config/vms/vms.h (MATH_LIBRARY): Define. (VMS_DEBUG_MAIN_POINTER): Define. From-SVN: r185791
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/config/alpha/alpha.c9
-rw-r--r--gcc/config/alpha/vms.h15
-rw-r--r--gcc/config/ia64/ia64.c12
-rw-r--r--gcc/config/ia64/vms.h14
-rw-r--r--gcc/config/vms/vms-protos.h1
-rw-r--r--gcc/config/vms/vms.c42
-rw-r--r--gcc/config/vms/vms.h7
8 files changed, 72 insertions, 43 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bc16917..daa9b83 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2012-03-26 Tristan Gingold <gingold@adacore.com>
+
+ * config/alpha/vms.h (LINK_SPEC): Simplify.
+ (STARTFILE_SPEC): Remove -mvms-return-codes handling.
+ (NAME__MAIN, SYMBOL__MAIN): Remove.
+ (VMS_DEBUG_MAIN_POINTER): Remove.
+ * config/ia64/vms.h: Likewise.
+ * config/alpha/alpha.c (alpha_start_function): Move vms_debug_main
+ code to vms.c. Call vms_start_function.
+ * config/ia64/ia64.c (ia64_start_function): Likewise.
+ * config/vms/vms-protos.h (vms_start_function): Declare.
+ * config/vms/vms.c (vms_start_function): New function.
+ * config/vms/vms.h (MATH_LIBRARY): Define.
+ (VMS_DEBUG_MAIN_POINTER): Define.
+
2012-03-26 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/52629
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 46c620b..c52fc50 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -7866,14 +7866,7 @@ alpha_start_function (FILE *file, const char *fnname,
int i;
#if TARGET_ABI_OPEN_VMS
- if (vms_debug_main
- && strncmp (vms_debug_main, fnname, strlen (vms_debug_main)) == 0)
- {
- targetm.asm_out.globalize_label (asm_out_file, VMS_DEBUG_MAIN_POINTER);
- ASM_OUTPUT_DEF (asm_out_file, VMS_DEBUG_MAIN_POINTER, fnname);
- switch_to_section (text_section);
- vms_debug_main = NULL;
- }
+ vms_start_function (fnname);
#endif
alpha_fnname = fnname;
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index b1d46b5..8caec54 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -43,8 +43,6 @@ along with GCC; see the file COPYING3. If not see
builtin_define ("__IEEE_FLOAT"); \
} while (0)
-#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
-
#undef PCC_STATIC_STRUCT_RETURN
#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
@@ -279,21 +277,14 @@ do { \
#else
/* Link with vms-dwarf2.o if -g (except -g0). This causes the
VMS link to pull all the dwarf2 debug sections together. */
-#define LINK_SPEC "%{g:-g vms-dwarf2.o%s} %{g0} %{g1:-g1 vms-dwarf2.o%s} \
-%{g2:-g2 vms-dwarf2.o%s} %{g3:-g3 vms-dwarf2.o%s} %{shared} %{v} %{map}"
+#define LINK_SPEC "%{g0} %{g*:-g vms-dwarf2.o%s} %{shared} %{v} %{map}"
#endif
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
-"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
- crtbegin.o%s} \
+#define STARTFILE_SPEC "%{!shared:crt0.o%s crtbegin.o%s} \
%{!static:%{shared:crtbeginS.o%s}}"
-#define ENDFILE_SPEC \
-"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
-
-#define NAME__MAIN "__gccmain"
-#define SYMBOL__MAIN __gccmain
+#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
#define INIT_SECTION_ASM_OP "\t.section LIB$INITIALIZE,GBL,NOWRT"
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 5b2d748..98a6120c 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -3649,16 +3649,8 @@ void
ia64_start_function (FILE *file, const char *fnname,
tree decl ATTRIBUTE_UNUSED)
{
-#if VMS_DEBUGGING_INFO
- if (vms_debug_main
- && debug_info_level > DINFO_LEVEL_NONE
- && strncmp (vms_debug_main, fnname, strlen (vms_debug_main)) == 0)
- {
- targetm.asm_out.globalize_label (asm_out_file, VMS_DEBUG_MAIN_POINTER);
- ASM_OUTPUT_DEF (asm_out_file, VMS_DEBUG_MAIN_POINTER, fnname);
- dwarf2out_vms_debug_main_pointer ();
- vms_debug_main = 0;
- }
+#if TARGET_ABI_OPEN_VMS
+ vms_start_function (fnname);
#endif
fputs ("\t.proc ", file);
diff --git a/gcc/config/ia64/vms.h b/gcc/config/ia64/vms.h
index 1908c47..3e0c653 100644
--- a/gcc/config/ia64/vms.h
+++ b/gcc/config/ia64/vms.h
@@ -30,8 +30,6 @@ along with GCC; see the file COPYING3. If not see
#undef TARGET_DEFAULT
#define TARGET_DEFAULT (MASK_DWARF2_ASM | MASK_GNU_AS)
-#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"
-
#undef MAX_OFILE_ALIGNMENT
#define MAX_OFILE_ALIGNMENT 524288 /* 8 x 2^16 by DEC Ada Test CD40VRA */
@@ -55,19 +53,16 @@ do { \
} while (0)
#undef STARTFILE_SPEC
-#define STARTFILE_SPEC \
-"%{!shared:%{mvms-return-codes:vcrt0.o%s} %{!mvms-return-codes:pcrt0.o%s} \
- crtbegin.o%s} \
+#define STARTFILE_SPEC "%{!shared:crt0.o%s crtbegin.o%s} \
%{!static:%{shared:crtinitS.o%s crtbeginS.o%s}}"
#undef ENDFILE_SPEC
-#define ENDFILE_SPEC \
-"%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
+#define ENDFILE_SPEC "%{!shared:crtend.o%s} %{!static:%{shared:crtendS.o%s}}"
#define LINK_GCC_C_SEQUENCE_SPEC "%G"
#undef LINK_SPEC
-#define LINK_SPEC "%{g*} %{map} %{save-temps} %{shared} %{v}"
+#define LINK_SPEC "%{g0} %{g*:-g} %{map} %{save-temps} %{shared} %{v}"
#undef LIB_SPEC
#define LIB_SPEC ""
@@ -89,9 +84,6 @@ do { \
#undef TARGET_INIT_LIBFUNCS
#define TARGET_INIT_LIBFUNCS ia64_vms_init_libfuncs
-#define NAME__MAIN "__gccmain"
-#define SYMBOL__MAIN __gccmain
-
#define CTOR_LIST_BEGIN asm (".global\tLIB$INITIALIZE#\n"); \
STATIC func_ptr __CTOR_LIST__[1] \
__attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr)))) \
diff --git a/gcc/config/vms/vms-protos.h b/gcc/config/vms/vms-protos.h
index ff97c31..dcff824 100644
--- a/gcc/config/vms/vms-protos.h
+++ b/gcc/config/vms/vms-protos.h
@@ -31,4 +31,5 @@ extern section *vms_function_section (tree decl ATTRIBUTE_UNUSED,
enum node_frequency freq ATTRIBUTE_UNUSED,
bool startup ATTRIBUTE_UNUSED,
bool exit ATTRIBUTE_UNUSED);
+extern void vms_start_function (const char *fname);
#endif /* TREE_CODE */
diff --git a/gcc/config/vms/vms.c b/gcc/config/vms/vms.c
index 4a7386f..a85fb3f 100644
--- a/gcc/config/vms/vms.c
+++ b/gcc/config/vms/vms.c
@@ -23,8 +23,9 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tree.h"
#include "vms-protos.h"
-#include "tm.h"
#include "ggc.h"
+#include "target.h"
+#include "output.h"
/* Correlation of standard CRTL names with DECCRTL function names. */
@@ -194,4 +195,43 @@ vms_function_section (tree decl ATTRIBUTE_UNUSED,
return NULL;
}
+/* Additionnal VMS specific code for start_function. */
+
+/* Must be kept in sync with libgcc/config/vms/vms-ucrt0.c */
+#define VMS_MAIN_FLAGS_SYMBOL "__gcc_main_flags"
+#define MAIN_FLAG_64BIT (1 << 0)
+#define MAIN_FLAG_POSIX (1 << 1)
+
+void
+vms_start_function (const char *fnname)
+{
+#if VMS_DEBUGGING_INFO
+ if (vms_debug_main
+ && debug_info_level > DINFO_LEVEL_NONE
+ && strncmp (vms_debug_main, fnname, strlen (vms_debug_main)) == 0)
+ {
+ targetm.asm_out.globalize_label (asm_out_file, VMS_DEBUG_MAIN_POINTER);
+ ASM_OUTPUT_DEF (asm_out_file, VMS_DEBUG_MAIN_POINTER, fnname);
+ dwarf2out_vms_debug_main_pointer ();
+ vms_debug_main = 0;
+ }
+#endif
+
+ /* Registers flags used for function main. This is necessary for
+ crt0 code. */
+ if (strcmp (fnname, "main") == 0)
+ {
+ unsigned int flags = 0;
+
+ if (flag_vms_pointer_size == VMS_POINTER_SIZE_64)
+ flags |= MAIN_FLAG_64BIT;
+ if (!flag_vms_return_codes)
+ flags |= MAIN_FLAG_POSIX;
+
+ targetm.asm_out.globalize_label (asm_out_file, VMS_MAIN_FLAGS_SYMBOL);
+ assemble_name (asm_out_file, VMS_MAIN_FLAGS_SYMBOL);
+ fprintf (asm_out_file, " = %u\n", flags);
+ }
+}
+
#include "gt-vms.h"
diff --git a/gcc/config/vms/vms.h b/gcc/config/vms/vms.h
index 47028c8..8eb5606 100644
--- a/gcc/config/vms/vms.h
+++ b/gcc/config/vms/vms.h
@@ -75,10 +75,15 @@ extern void vms_c_register_includes (const char *, const char *, int);
#define C_COMMON_OVERRIDE_OPTIONS vms_c_common_override_options ()
/* VMS doesn't support other sections than .text for code. */
-
#define TARGET_ASM_FUNCTION_SECTION vms_function_section
/* Always use 8 bytes addresses in dwarf2 debug info. The default value doesn't
work as it may be 4 bytes, which won't match gas default (8 bytes for ia64),
and will thus produce incorrect values. */
#define DWARF2_ADDR_SIZE 8
+
+/* No libm on VMS. */
+#define MATH_LIBRARY ""
+
+/* Special VMS debugger symbol to record the entry point. */
+#define VMS_DEBUG_MAIN_POINTER "TRANSFER$BREAK$GO"