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