1/* Definitions of target machine for gcc for Hitachi Super-H using ELF.
2   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
3   Contributed by Ian Lance Taylor <ian@cygnus.com>.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING.  If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA.  */
21
22/* Mostly like the regular SH configuration.  */
23#include "sh/sh.h"
24
25/* No SDB debugging info.  */
26#undef SDB_DEBUGGING_INFO
27
28/* Undefine some macros defined in both sh.h and svr4.h.  */
29#undef IDENT_ASM_OP
30#undef ASM_FILE_END
31#undef ASM_OUTPUT_SOURCE_LINE
32#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
33#undef CTORS_SECTION_ASM_OP
34#undef DTORS_SECTION_ASM_OP
35#undef ASM_OUTPUT_SECTION_NAME
36#undef ASM_OUTPUT_CONSTRUCTOR
37#undef ASM_OUTPUT_DESTRUCTOR
38#undef ASM_DECLARE_FUNCTION_NAME
39#undef PREFERRED_DEBUGGING_TYPE
40#undef MAX_OFILE_ALIGNMENT
41
42/* Be ELF-like.  */
43#include "svr4.h"
44
45/* The prefix to add to user-visible assembler symbols.
46   Note that svr4.h redefined it from the original value (that we want)
47   in sh.h */
48
49#undef USER_LABEL_PREFIX
50#define USER_LABEL_PREFIX "_"
51
52#undef LOCAL_LABEL_PREFIX
53#define LOCAL_LABEL_PREFIX "."
54
55#undef ASM_FILE_START
56#define ASM_FILE_START(FILE) do {				\
57  output_file_directive ((FILE), main_input_filename);		\
58  if (TARGET_LITTLE_ENDIAN)					\
59    fprintf ((FILE), "\t.little\n");				\
60} while (0)
61
62
63
64/* Let code know that this is ELF.  */
65#define CPP_PREDEFINES "-D__sh__ -D__ELF__ -Acpu(sh) -Amachine(sh)"
66
67/* Pass -ml and -mrelax to the assembler and linker.  */
68#undef ASM_SPEC
69#define ASM_SPEC  "%{ml:-little} %{mrelax:-relax}"
70
71#undef LINK_SPEC
72#define LINK_SPEC "%{ml:-m shlelf} %{mrelax:-relax}"
73
74/* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
75   again.  */
76#define DBX_REGISTER_NUMBER(REGNO)	\
77  (((REGNO) >= 22 && (REGNO) <= 39) ? ((REGNO) + 1) : (REGNO))
78
79/* SH ELF, unlike most ELF implementations, uses underscores before
80   symbol names.  */
81#undef ASM_OUTPUT_LABELREF
82#define ASM_OUTPUT_LABELREF(STREAM,NAME) \
83  asm_fprintf (STREAM, "%U%s", NAME)
84
85#undef ASM_GENERATE_INTERNAL_LABEL
86#define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
87  sprintf ((STRING), "*%s%s%d", LOCAL_LABEL_PREFIX, (PREFIX), (NUM))
88
89#undef ASM_OUTPUT_INTERNAL_LABEL
90#define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \
91  asm_fprintf ((FILE), "%L%s%d:\n", (PREFIX), (NUM))
92
93#undef  ASM_OUTPUT_SOURCE_LINE
94#define ASM_OUTPUT_SOURCE_LINE(file, line)				\
95do									\
96  {									\
97    static int sym_lineno = 1;						\
98    asm_fprintf ((file), ".stabn 68,0,%d,%LLM%d-",			\
99	     (line), sym_lineno);					\
100    assemble_name ((file),						\
101		   XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
102    asm_fprintf ((file), "\n%LLM%d:\n", sym_lineno);			\
103    sym_lineno += 1;							\
104  }									\
105while (0)
106
107#undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
108#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)			\
109do {									\
110  text_section ();							\
111  fprintf ((FILE), "\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO);	\
112} while (0)
113
114/* Arrange to call __main, rather than using crtbegin.o and crtend.o
115   and relying on .init and .fini being executed at appropriate times.  */
116#undef INIT_SECTION_ASM_OP
117#undef FINI_SECTION_ASM_OP
118#undef STARTFILE_SPEC
119#undef ENDFILE_SPEC
120
121/* HANDLE_SYSV_PRAGMA (defined by svr4.h) takes precedence over HANDLE_PRAGMA.
122   We want to use the HANDLE_PRAGMA from sh.h.  */
123#undef HANDLE_SYSV_PRAGMA
124