]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/sh/elf.h
elf.h: Do not include sh/sh.h.
[thirdparty/gcc.git] / gcc / config / sh / elf.h
1 /* Definitions of target machine for gcc for Hitachi Super-H using ELF.
2 Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
3 Contributed by Ian Lance Taylor <ian@cygnus.com>.
4
5 This file is part of GNU CC.
6
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.
11
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.
16
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. */
21
22 /* No SDB debugging info. */
23 #undef SDB_DEBUGGING_INFO
24
25 /* Generate DWARF2 debugging information and make it the default */
26 #define DWARF2_DEBUGGING_INFO
27
28 #undef PREFERRED_DEBUGGING_TYPE
29 #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
30
31 /* use a more compact format for line information */
32 #define DWARF2_ASM_LINE_DEBUG_INFO 1
33
34 /* Undefine some macros defined in both sh.h and svr4.h. */
35 #undef IDENT_ASM_OP
36 #undef ASM_FILE_END
37 #undef ASM_OUTPUT_SOURCE_LINE
38 #undef DBX_OUTPUT_MAIN_SOURCE_FILE_END
39 #undef CTORS_SECTION_ASM_OP
40 #undef DTORS_SECTION_ASM_OP
41 #undef ASM_OUTPUT_SECTION_NAME
42 #undef ASM_OUTPUT_CONSTRUCTOR
43 #undef ASM_OUTPUT_DESTRUCTOR
44 #undef ASM_DECLARE_FUNCTION_NAME
45 #undef MAX_OFILE_ALIGNMENT
46
47 /* Be ELF-like. */
48 #include "svr4.h"
49
50 /* The prefix to add to user-visible assembler symbols.
51 Note that svr4.h redefined it from the original value (that we want)
52 in sh.h */
53
54 #undef USER_LABEL_PREFIX
55 #define USER_LABEL_PREFIX "_"
56
57 #undef LOCAL_LABEL_PREFIX
58 #define LOCAL_LABEL_PREFIX "."
59
60 #undef ASM_FILE_START
61 #define ASM_FILE_START(FILE) do { \
62 output_file_directive ((FILE), main_input_filename); \
63 if (TARGET_LITTLE_ENDIAN) \
64 fprintf ((FILE), "\t.little\n"); \
65 } while (0)
66
67
68
69 /* Let code know that this is ELF. */
70 #define CPP_PREDEFINES "-D__sh__ -D__ELF__ -Acpu(sh) -Amachine(sh)"
71
72 /* Pass -ml and -mrelax to the assembler and linker. */
73 #undef ASM_SPEC
74 #define ASM_SPEC "%{ml:-little} %{mrelax:-relax}"
75
76 #undef LINK_SPEC
77 #define LINK_SPEC "%{ml:-m shlelf} %{mrelax:-relax}"
78
79 /* svr4.h undefined DBX_REGISTER_NUMBER, so we need to define it
80 again. */
81 #define DBX_REGISTER_NUMBER(REGNO) \
82 (((REGNO) >= 22 && (REGNO) <= 39) ? ((REGNO) + 1) : (REGNO))
83
84 #undef ASM_GENERATE_INTERNAL_LABEL
85 #define ASM_GENERATE_INTERNAL_LABEL(STRING, PREFIX, NUM) \
86 sprintf ((STRING), "*%s%s%ld", LOCAL_LABEL_PREFIX, (PREFIX), (long)(NUM))
87
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))
91
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; \
103 } \
104 while (0)
105
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)
112
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
119
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