]>
Commit | Line | Data |
---|---|---|
2038dc12 RK |
1 | /* Definitions for Intel 386 running FreeBSD with ELF format |
2 | Copyright (C) 1996 Free Software Foundation, Inc. | |
3 | Contributed by Eric Youngdale. | |
4 | Modified for stabs-in-ELF by H.J. Lu. | |
33f7f353 | 5 | Adapted from GNU/Linux version by John Polstra. |
2038dc12 RK |
6 | |
7 | This file is part of GNU CC. | |
8 | ||
9 | GNU CC is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 2, or (at your option) | |
12 | any later version. | |
13 | ||
14 | GNU CC is distributed in the hope that it will be useful, | |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | GNU General Public License for more details. | |
18 | ||
19 | You should have received a copy of the GNU General Public License | |
20 | along with GNU CC; see the file COPYING. If not, write to | |
21 | the Free Software Foundation, 59 Temple Place - Suite 330, | |
22 | Boston, MA 02111-1307, USA. */ | |
23 | ||
24 | #undef TARGET_VERSION | |
25 | #define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); | |
26 | ||
27 | /* The svr4 ABI for the i386 says that records and unions are returned | |
28 | in memory. */ | |
29 | #undef DEFAULT_PCC_STRUCT_RETURN | |
30 | #define DEFAULT_PCC_STRUCT_RETURN 1 | |
31 | ||
32 | /* This is how to output an element of a case-vector that is relative. | |
33 | This is only used for PIC code. See comments by the `casesi' insn in | |
34 | i386.md for an explanation of the expression this outputs. */ | |
35 | #undef ASM_OUTPUT_ADDR_DIFF_ELT | |
33f7f353 | 36 | #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \ |
2038dc12 RK |
37 | fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE) |
38 | ||
39 | /* Indicate that jump tables go in the text section. This is | |
40 | necessary when compiling PIC code. */ | |
2b005260 | 41 | #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) |
2038dc12 RK |
42 | |
43 | /* Copy this from the svr4 specifications... */ | |
44 | /* Define the register numbers to be used in Dwarf debugging information. | |
45 | The SVR4 reference port C compiler uses the following register numbers | |
46 | in its Dwarf output code: | |
47 | 0 for %eax (gnu regno = 0) | |
48 | 1 for %ecx (gnu regno = 2) | |
49 | 2 for %edx (gnu regno = 1) | |
50 | 3 for %ebx (gnu regno = 3) | |
51 | 4 for %esp (gnu regno = 7) | |
52 | 5 for %ebp (gnu regno = 6) | |
53 | 6 for %esi (gnu regno = 4) | |
54 | 7 for %edi (gnu regno = 5) | |
55 | The following three DWARF register numbers are never generated by | |
56 | the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4 | |
57 | believes these numbers have these meanings. | |
58 | 8 for %eip (no gnu equivalent) | |
59 | 9 for %eflags (no gnu equivalent) | |
60 | 10 for %trapno (no gnu equivalent) | |
61 | It is not at all clear how we should number the FP stack registers | |
62 | for the x86 architecture. If the version of SDB on x86/svr4 were | |
63 | a bit less brain dead with respect to floating-point then we would | |
64 | have a precedent to follow with respect to DWARF register numbers | |
65 | for x86 FP registers, but the SDB on x86/svr4 is so completely | |
66 | broken with respect to FP registers that it is hardly worth thinking | |
67 | of it as something to strive for compatibility with. | |
68 | The version of x86/svr4 SDB I have at the moment does (partially) | |
69 | seem to believe that DWARF register number 11 is associated with | |
70 | the x86 register %st(0), but that's about all. Higher DWARF | |
71 | register numbers don't seem to be associated with anything in | |
72 | particular, and even for DWARF regno 11, SDB only seems to under- | |
73 | stand that it should say that a variable lives in %st(0) (when | |
74 | asked via an `=' command) if we said it was in DWARF regno 11, | |
75 | but SDB still prints garbage when asked for the value of the | |
76 | variable in question (via a `/' command). | |
77 | (Also note that the labels SDB prints for various FP stack regs | |
78 | when doing an `x' command are all wrong.) | |
79 | Note that these problems generally don't affect the native SVR4 | |
80 | C compiler because it doesn't allow the use of -O with -g and | |
81 | because when it is *not* optimizing, it allocates a memory | |
82 | location for each floating-point variable, and the memory | |
83 | location is what gets described in the DWARF AT_location | |
84 | attribute for the variable in question. | |
85 | Regardless of the severe mental illness of the x86/svr4 SDB, we | |
86 | do something sensible here and we use the following DWARF | |
87 | register numbers. Note that these are all stack-top-relative | |
88 | numbers. | |
89 | 11 for %st(0) (gnu regno = 8) | |
90 | 12 for %st(1) (gnu regno = 9) | |
91 | 13 for %st(2) (gnu regno = 10) | |
92 | 14 for %st(3) (gnu regno = 11) | |
93 | 15 for %st(4) (gnu regno = 12) | |
94 | 16 for %st(5) (gnu regno = 13) | |
95 | 17 for %st(6) (gnu regno = 14) | |
96 | 18 for %st(7) (gnu regno = 15) | |
97 | */ | |
98 | #undef DBX_REGISTER_NUMBER | |
99 | #define DBX_REGISTER_NUMBER(n) \ | |
100 | ((n) == 0 ? 0 \ | |
101 | : (n) == 1 ? 2 \ | |
102 | : (n) == 2 ? 1 \ | |
103 | : (n) == 3 ? 3 \ | |
104 | : (n) == 4 ? 6 \ | |
105 | : (n) == 5 ? 7 \ | |
106 | : (n) == 6 ? 5 \ | |
107 | : (n) == 7 ? 4 \ | |
108 | : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \ | |
109 | : (-1)) | |
110 | ||
111 | /* Output assembler code to FILE to increment profiler label # LABELNO | |
112 | for profiling a function entry. */ | |
113 | ||
114 | #undef FUNCTION_PROFILER | |
115 | #define FUNCTION_PROFILER(FILE, LABELNO) \ | |
116 | { \ | |
117 | if (flag_pic) \ | |
118 | { \ | |
119 | fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ | |
120 | LPREFIX, (LABELNO)); \ | |
121 | fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n"); \ | |
122 | } \ | |
123 | else \ | |
124 | { \ | |
125 | fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO)); \ | |
126 | fprintf (FILE, "\tcall mcount\n"); \ | |
127 | } \ | |
128 | } | |
129 | ||
130 | #undef SIZE_TYPE | |
131 | #define SIZE_TYPE "unsigned int" | |
132 | ||
133 | #undef PTRDIFF_TYPE | |
134 | #define PTRDIFF_TYPE "int" | |
135 | ||
136 | #undef WCHAR_TYPE | |
137 | #define WCHAR_TYPE "int" | |
138 | ||
139 | #undef WCHAR_TYPE_SIZE | |
140 | #define WCHAR_TYPE_SIZE BITS_PER_WORD | |
141 | ||
142 | #undef CPP_PREDEFINES | |
2a8034f8 | 143 | #define CPP_PREDEFINES "-Di386 -Dunix -D__ELF__ -D__FreeBSD__ -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386) -Amachine(i386)" |
2038dc12 RK |
144 | |
145 | #undef CPP_SPEC | |
1228a9bd | 146 | #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}" |
2038dc12 RK |
147 | |
148 | #undef LIB_SPEC | |
149 | #if 1 | |
150 | /* We no longer link with libc_p.a or libg.a by default. If you | |
151 | * want to profile or debug the C library, please add | |
152 | * -lc_p or -ggdb to LDFLAGS at the link time, respectively. | |
153 | */ | |
154 | #define LIB_SPEC \ | |
155 | "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \ | |
156 | %{!ggdb:-lc} %{ggdb:-lg}}" | |
157 | #else | |
158 | #define LIB_SPEC \ | |
159 | "%{!shared: \ | |
160 | %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \ | |
161 | %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}" | |
162 | #endif | |
163 | ||
164 | /* Provide a LINK_SPEC appropriate for FreeBSD. Here we provide support | |
165 | for the special GCC options -static and -shared, which allow us to | |
166 | link things in one of these three modes by applying the appropriate | |
167 | combinations of options at link-time. We like to support here for | |
168 | as many of the other GNU linker options as possible. But I don't | |
169 | have the time to search for those flags. I am sure how to add | |
170 | support for -soname shared_object_name. H.J. | |
171 | ||
172 | I took out %{v:%{!V:-V}}. It is too much :-(. They can use | |
173 | -Wl,-V. | |
174 | ||
175 | When the -shared link option is used a final link is not being | |
176 | done. */ | |
177 | ||
178 | #undef LINK_SPEC | |
179 | #define LINK_SPEC "-m elf_i386 %{shared:-shared} \ | |
180 | %{!shared: \ | |
181 | %{!ibcs: \ | |
182 | %{!static: \ | |
183 | %{rdynamic:-export-dynamic} \ | |
184 | %{!dynamic-linker:-dynamic-linker /usr/libexec/ld-elf.so.1}} \ | |
185 | %{static:-static}}}" | |
186 | ||
187 | /* Get perform_* macros to build libgcc.a. */ | |
dd014274 JL |
188 | |
189 | /* A C statement to output to the stdio stream FILE an assembler | |
190 | command to advance the location counter to a multiple of 1<<LOG | |
191 | bytes if it is within MAX_SKIP bytes. | |
192 | ||
193 | This is used to align code labels according to Intel recommendations. */ | |
194 | ||
80de1662 | 195 | #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN |
dd014274 JL |
196 | #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ |
197 | if ((LOG)!=0) \ | |
198 | if ((MAX_SKIP)==0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ | |
199 | else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)) | |
80de1662 | 200 | #endif |