summaryrefslogtreecommitdiff
path: root/gcc/config/alpha
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/alpha')
-rw-r--r--gcc/config/alpha/alpha-protos.h2
-rw-r--r--gcc/config/alpha/alpha.c85
-rw-r--r--gcc/config/alpha/elf.h35
-rw-r--r--gcc/config/alpha/unicosmk.h45
-rw-r--r--gcc/config/alpha/vms.h32
5 files changed, 58 insertions, 141 deletions
diff --git a/gcc/config/alpha/alpha-protos.h b/gcc/config/alpha/alpha-protos.h
index f6b237a1c0f..00fc52530b0 100644
--- a/gcc/config/alpha/alpha-protos.h
+++ b/gcc/config/alpha/alpha-protos.h
@@ -127,8 +127,6 @@ extern rtx unicosmk_add_call_info_word (rtx);
extern void unicosmk_defer_case_vector (rtx, rtx);
extern void unicosmk_add_extern (const char *);
extern void unicosmk_output_align (FILE *, int);
-extern char * unicosmk_text_section (void);
-extern char * unicosmk_data_section (void);
extern void unicosmk_output_common (FILE *, const char *, int, int);
extern int unicosmk_initial_elimination_offset (int, int);
#endif
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 6824d077570..244aa271204 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -7959,14 +7959,14 @@ alpha_start_function (FILE *file, const char *fnname,
#if TARGET_ABI_OPEN_VMS
/* Ifdef'ed cause link_section are only available then. */
- readonly_data_section ();
+ switch_to_section (readonly_data_section);
fprintf (file, "\t.align 3\n");
assemble_name (file, fnname); fputs ("..na:\n", file);
fputs ("\t.ascii \"", file);
assemble_name (file, fnname);
fputs ("\\0\"\n", file);
alpha_need_linkage (fnname, 1);
- text_section ();
+ switch_to_section (text_section);
#endif
}
@@ -9355,18 +9355,18 @@ alpha_file_start (void)
#ifdef OBJECT_FORMAT_ELF
-/* Switch to the section to which we should output X. The only thing
- special we do here is to honor small data. */
+/* Return a section for X. The only special thing we do here is to
+ honor small data. */
-static void
+static section *
alpha_elf_select_rtx_section (enum machine_mode mode, rtx x,
unsigned HOST_WIDE_INT align)
{
if (TARGET_SMALL_DATA && GET_MODE_SIZE (mode) <= g_switch_value)
/* ??? Consider using mergeable sdata sections. */
- sdata_section ();
+ return sdata_section;
else
- default_elf_select_rtx_section (mode, x, align);
+ return default_elf_select_rtx_section (mode, x, align);
}
#endif /* OBJECT_FORMAT_ELF */
@@ -9636,8 +9636,10 @@ alpha_write_linkage (FILE *stream, const char *funname, tree fundecl)
splay_tree_node node;
struct alpha_funcs *func;
- link_section ();
+ fprintf (stream, "\t.link\n");
fprintf (stream, "\t.align 3\n");
+ in_section = NULL;
+
node = splay_tree_lookup (alpha_funcs_tree, (splay_tree_key) fundecl);
func = (struct alpha_funcs *) node->value;
@@ -9717,7 +9719,7 @@ vms_asm_named_section (const char *name, unsigned int flags,
static void
vms_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
- ctors_section ();
+ switch_to_section (ctors_section);
assemble_align (BITS_PER_WORD);
assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
}
@@ -9725,7 +9727,7 @@ vms_asm_out_constructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
static void
vms_asm_out_destructor (rtx symbol, int priority ATTRIBUTE_UNUSED)
{
- dtors_section ();
+ switch_to_section (dtors_section);
assemble_align (BITS_PER_WORD);
assemble_integer (symbol, UNITS_PER_WORD, BITS_PER_WORD, 1);
}
@@ -9826,7 +9828,7 @@ unicosmk_output_common (FILE *file, const char *name, int size, int align)
tree name_tree;
printf ("T3E__: common %s\n", name);
- common_section ();
+ in_section = NULL;
fputs("\t.endp\n\n\t.psect ", file);
assemble_name(file, name);
fprintf(file, ",%d,common\n", floor_log2 (align / BITS_PER_UNIT));
@@ -9841,6 +9843,43 @@ unicosmk_output_common (FILE *file, const char *name, int size, int align)
#define SECTION_MAIN (SECTION_PUBLIC << 1)
static int current_section_align;
+/* A get_unnamed_section callback for switching to the text section. */
+
+static void
+unicosmk_output_text_section_asm_op (const void *data ATTRIBUTE_UNUSED)
+{
+ static int count = 0;
+ fprintf (asm_out_file, "\t.endp\n\n\t.psect\tgcc@text___%d,code\n", count++);
+}
+
+/* A get_unnamed_section callback for switching to the data section. */
+
+static void
+unicosmk_output_data_section_asm_op (const void *data ATTRIBUTE_UNUSED)
+{
+ static int count = 1;
+ fprintf (asm_out_file, "\t.endp\n\n\t.psect\tgcc@data___%d,data\n", count++);
+}
+
+/* Implement TARGET_ASM_INIT_SECTIONS.
+
+ The Cray assembler is really weird with respect to sections. It has only
+ named sections and you can't reopen a section once it has been closed.
+ This means that we have to generate unique names whenever we want to
+ reenter the text or the data section. */
+
+static void
+unicosmk_init_sections (void)
+{
+ text_section = get_unnamed_section (SECTION_CODE,
+ unicosmk_output_text_section_asm_op,
+ NULL);
+ data_section = get_unnamed_section (SECTION_WRITE,
+ unicosmk_output_data_section_asm_op,
+ NULL);
+ readonly_data_section = data_section;
+}
+
static unsigned int
unicosmk_section_type_flags (tree decl, const char *name,
int reloc ATTRIBUTE_UNUSED)
@@ -10004,7 +10043,7 @@ unicosmk_output_deferred_case_vectors (FILE *file)
if (machine->addr_list == NULL_RTX)
return;
- data_section ();
+ switch_to_section (data_section);
for (t = machine->addr_list; t; t = XEXP (t, 1))
unicosmk_output_addr_vec (file, XEXP (t, 0));
}
@@ -10123,7 +10162,7 @@ unicosmk_output_ssib (FILE *file, const char *fnname)
rtx ciw;
struct machine_function *machine = cfun->machine;
- ssib_section ();
+ in_section = NULL;
fprintf (file, "\t.endp\n\n\t.psect\t%s%s,data\n", user_label_prefix,
unicosmk_ssib_name ());
@@ -10195,26 +10234,6 @@ unicosmk_add_call_info_word (rtx x)
+ strlen (current_function_name ())/8 + 5);
}
-static char unicosmk_section_buf[100];
-
-char *
-unicosmk_text_section (void)
-{
- static int count = 0;
- sprintf (unicosmk_section_buf, "\t.endp\n\n\t.psect\tgcc@text___%d,code",
- count++);
- return unicosmk_section_buf;
-}
-
-char *
-unicosmk_data_section (void)
-{
- static int count = 1;
- sprintf (unicosmk_section_buf, "\t.endp\n\n\t.psect\tgcc@data___%d,data",
- count++);
- return unicosmk_section_buf;
-}
-
/* The Cray assembler doesn't accept extern declarations for symbols which
are defined in the same file. We have to keep track of all global
symbols which are referenced and/or defined in a source file and output
diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h
index 43449f5adcc..043a5244c08 100644
--- a/gcc/config/alpha/elf.h
+++ b/gcc/config/alpha/elf.h
@@ -123,9 +123,9 @@ do { \
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
do { \
if ((SIZE) <= g_switch_value) \
- sbss_section(); \
+ switch_to_section (sbss_section); \
else \
- bss_section(); \
+ switch_to_section (bss_section); \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
if (!flag_inhibit_size_directive) \
ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \
@@ -193,37 +193,6 @@ do { \
#endif
-/* A default list of other sections which we might be "in" at any given
- time. For targets that use additional sections (e.g. .tdesc) you
- should override this definition in the target-specific file which
- includes this file. */
-
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_sbss, in_sdata
-
-/* A default list of extra section function definitions. For targets
- that use additional sections (e.g. .tdesc) you should override this
- definition in the target-specific file which includes this file. */
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
- SECTION_FUNCTION_TEMPLATE(sbss_section, in_sbss, SBSS_SECTION_ASM_OP) \
- SECTION_FUNCTION_TEMPLATE(sdata_section, in_sdata, SDATA_SECTION_ASM_OP)
-
-extern void sbss_section (void);
-extern void sdata_section (void);
-
-#undef SECTION_FUNCTION_TEMPLATE
-#define SECTION_FUNCTION_TEMPLATE(FN, ENUM, OP) \
-void FN (void) \
-{ \
- if (in_section != ENUM) \
- { \
- fprintf (asm_out_file, "%s\n", OP); \
- in_section = ENUM; \
- } \
-}
-
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION default_elf_asm_named_section
#define TARGET_ASM_SELECT_SECTION default_elf_select_section
diff --git a/gcc/config/alpha/unicosmk.h b/gcc/config/alpha/unicosmk.h
index da7d375f3b4..a05b33396c0 100644
--- a/gcc/config/alpha/unicosmk.h
+++ b/gcc/config/alpha/unicosmk.h
@@ -244,51 +244,9 @@ do { fprintf (FILE, "\tbr $1,0\n"); \
/* Define this as 1 if `char' should by default be signed; else as 0. */
/* #define DEFAULT_SIGNED_CHAR 1 */
-/* The Cray assembler is really weird with respect to sections. It has only
- named sections and you can't reopen a section once it has been closed.
- This means that we have to generate unique names whenever we want to
- reenter the text or the data section. The following is a rather bad hack
- as TEXT_SECTION_ASM_OP and DATA_SECTION_ASM_OP are supposed to be
- constants. */
-
-#undef TEXT_SECTION_ASM_OP
-#define TEXT_SECTION_ASM_OP unicosmk_text_section ()
-
-#undef DATA_SECTION_ASM_OP
-#define DATA_SECTION_ASM_OP unicosmk_data_section ()
-
/* There are no read-only sections on Unicos/Mk. */
#undef READONLY_DATA_SECTION_ASM_OP
-#define READONLY_DATA_SECTION data_section
-
-/* Define extra sections for common data and SSIBs (static subroutine
- information blocks). The actual section header is output by the callers
- of these functions. */
-
-#undef EXTRA_SECTIONS
-#undef EXTRA_SECTION_FUNCTIONS
-
-#define EXTRA_SECTIONS in_common, in_ssib
-#define EXTRA_SECTION_FUNCTIONS \
-COMMON_SECTION \
-SSIB_SECTION
-
-extern void common_section (void);
-#define COMMON_SECTION \
-void \
-common_section (void) \
-{ \
- in_section = in_common; \
-}
-
-extern void ssib_section (void);
-#define SSIB_SECTION \
-void \
-ssib_section (void) \
-{ \
- in_section = in_ssib; \
-}
/* We take care of this in unicosmk_file_start. */
@@ -413,7 +371,7 @@ ssib_section (void) \
#undef ASM_OUTPUT_LOCAL
#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN) \
- do { data_section (); \
+ do { switch_to_section (data_section); \
fprintf (FILE, "\t.align\t%d\n", floor_log2 ((ALIGN) / BITS_PER_UNIT));\
ASM_OUTPUT_LABEL ((FILE), (NAME)); \
fprintf (FILE, "\t.byte 0:"HOST_WIDE_INT_PRINT_UNSIGNED"\n",(SIZE));\
@@ -449,6 +407,7 @@ ssib_section (void) \
/* Switch into a generic section. */
#define TARGET_ASM_NAMED_SECTION unicosmk_asm_named_section
+#define TARGET_ASM_INIT_SECTIONS unicosmk_init_sections
#undef ASM_OUTPUT_MAX_SKIP_ALIGN
#define ASM_OUTPUT_MAX_SKIP_ALIGN(STREAM,POWER,MAXSKIP)
diff --git a/gcc/config/alpha/vms.h b/gcc/config/alpha/vms.h
index c1f4a43e4b1..83545877190 100644
--- a/gcc/config/alpha/vms.h
+++ b/gcc/config/alpha/vms.h
@@ -198,39 +198,10 @@ typedef struct {int num_args; enum avms_arg_type atypes[6];} avms_arg_info;
#undef STACK_CHECK_BUILTIN
#define STACK_CHECK_BUILTIN 0
-#define LINK_SECTION_ASM_OP "\t.link"
#define READONLY_DATA_SECTION_ASM_OP "\t.rdata"
-#define LITERALS_SECTION_ASM_OP "\t.literals"
#define CTORS_SECTION_ASM_OP "\t.ctors"
#define DTORS_SECTION_ASM_OP "\t.dtors"
-#undef EXTRA_SECTIONS
-#define EXTRA_SECTIONS in_link, in_literals
-
-#undef EXTRA_SECTION_FUNCTIONS
-#define EXTRA_SECTION_FUNCTIONS \
-void \
-link_section (void) \
-{ \
- if (in_section != in_link) \
- { \
- fprintf (asm_out_file, "%s\n", LINK_SECTION_ASM_OP); \
- in_section = in_link; \
- } \
-} \
-void \
-literals_section (void) \
-{ \
- if (in_section != in_literals) \
- { \
- fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); \
- in_section = in_literals; \
- } \
-}
-
-extern void link_section (void);
-extern void literals_section (void);
-
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) gcc_unreachable ()
@@ -327,7 +298,8 @@ do { \
#define TARGET_ASM_NAMED_SECTION vms_asm_named_section
#define ASM_OUTPUT_DEF(FILE,LABEL1,LABEL2) \
- do { literals_section(); \
+ do { fprintf ((FILE), "\t.literals\n"); \
+ in_section = NULL; \
fprintf ((FILE), "\t"); \
assemble_name (FILE, LABEL1); \
fprintf (FILE, " = "); \