OSDN Git Service

config:
[pf3gnuchains/gcc-fork.git] / gcc / config / i386 / linux.h
1 /* Definitions for Intel 386 running Linux-based GNU systems with ELF format.
2    Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
3    Contributed by Eric Youngdale.
4    Modified for stabs-in-ELF by H.J. Lu.
5
6 This file is part of GNU CC.
7
8 GNU CC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 GNU CC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU CC; see the file COPYING.  If not, write to
20 the Free Software Foundation, 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.  */
22
23 #define LINUX_DEFAULT_ELF
24
25 /* A lie, I guess, but the general idea behind linux/ELF is that we are
26    supposed to be outputting something that will assemble under SVr4.
27    This gets us pretty close.  */
28 #include <i386/i386.h>  /* Base i386 target machine definitions */
29 #include <i386/att.h>   /* Use the i386 AT&T assembler syntax */
30 #include <linux.h>      /* some common stuff */
31
32 /* Output at beginning of assembler file.  */
33 /* The .file command should always begin the output.  */
34 #undef ASM_FILE_START
35 #define ASM_FILE_START(FILE)                                            \
36   do {                                                                  \
37         output_file_directive (FILE, main_input_filename);              \
38         if (target_flags & MASK_INTEL_SYNTAX)                           \
39           fputs ("\t.intel_syntax\n", FILE);                            \
40         fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
41   } while (0)
42
43 #undef TARGET_VERSION
44 #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
45
46 /* The svr4 ABI for the i386 says that records and unions are returned
47    in memory.  */
48 #undef DEFAULT_PCC_STRUCT_RETURN
49 #define DEFAULT_PCC_STRUCT_RETURN 1
50
51 #undef ASM_COMMENT_START
52 #define ASM_COMMENT_START "#"
53
54 /* This is how to output an element of a case-vector that is relative.
55    This is only used for PIC code.  See comments by the `casesi' insn in
56    i386.md for an explanation of the expression this outputs. */
57 #undef ASM_OUTPUT_ADDR_DIFF_ELT
58 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
59   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
60
61 /* Indicate that jump tables go in the text section.  This is
62    necessary when compiling PIC code.  */
63 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
64
65 #undef DBX_REGISTER_NUMBER
66 #define DBX_REGISTER_NUMBER(n)  svr4_dbx_register_map[n]
67
68 /* Output assembler code to FILE to call the profiler.
69    To the best of my knowledge, no Linux libc has required the label
70    argument to mcount.  */
71
72 #define NO_PROFILE_COUNTERS
73
74 #undef FUNCTION_PROFILER
75 #define FUNCTION_PROFILER(FILE, LABELNO)  \
76 {                                                                       \
77   if (flag_pic)                                                         \
78     fprintf (FILE, "\tcall\t*mcount@GOT(%%ebx)\n");                     \
79   else                                                                  \
80     fprintf (FILE, "\tcall\tmcount\n");                                 \
81 }
82
83 #undef SIZE_TYPE
84 #define SIZE_TYPE "unsigned int"
85  
86 #undef PTRDIFF_TYPE
87 #define PTRDIFF_TYPE "int"
88   
89 #undef WCHAR_TYPE
90 #define WCHAR_TYPE "long int"
91    
92 #undef WCHAR_TYPE_SIZE
93 #define WCHAR_TYPE_SIZE BITS_PER_WORD
94     
95 #undef CPP_PREDEFINES
96 #define CPP_PREDEFINES "-D__ELF__ -Dunix -Dlinux -Asystem=posix"
97
98 #undef CPP_SPEC
99 #ifdef USE_GNULIBC_1
100 #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
101 #else
102 #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
103 #endif
104
105 #undef CC1_SPEC
106 #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
107
108 /* Provide a LINK_SPEC appropriate for Linux.  Here we provide support
109    for the special GCC options -static and -shared, which allow us to
110    link things in one of these three modes by applying the appropriate
111    combinations of options at link-time. We like to support here for
112    as many of the other GNU linker options as possible. But I don't
113    have the time to search for those flags. I am sure how to add
114    support for -soname shared_object_name. H.J.
115
116    I took out %{v:%{!V:-V}}. It is too much :-(. They can use
117    -Wl,-V.
118
119    When the -shared link option is used a final link is not being
120    done.  */
121
122 /* If ELF is the default format, we should not use /lib/elf. */
123
124 #undef  LINK_SPEC
125 #ifdef USE_GNULIBC_1
126 #ifndef LINUX_DEFAULT_ELF
127 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
128   %{!shared: \
129     %{!ibcs: \
130       %{!static: \
131         %{rdynamic:-export-dynamic} \
132         %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
133         %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
134 #else
135 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
136   %{!shared: \
137     %{!ibcs: \
138       %{!static: \
139         %{rdynamic:-export-dynamic} \
140         %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
141         %{static:-static}}}"
142 #endif
143 #else
144 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
145   %{!shared: \
146     %{!ibcs: \
147       %{!static: \
148         %{rdynamic:-export-dynamic} \
149         %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
150         %{static:-static}}}"
151 #endif
152
153 /* Get perform_* macros to build libgcc.a.  */
154 #include "i386/perform.h"
155
156 /* A C statement (sans semicolon) to output to the stdio stream
157    FILE the assembler definition of uninitialized global DECL named
158    NAME whose size is SIZE bytes and alignment is ALIGN bytes.
159    Try to use asm_output_aligned_bss to implement this macro.  */
160
161 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
162   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
163
164 /* A C statement to output to the stdio stream FILE an assembler
165    command to advance the location counter to a multiple of 1<<LOG
166    bytes if it is within MAX_SKIP bytes.
167
168    This is used to align code labels according to Intel recommendations.  */
169
170 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
171 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP)                    \
172   do {                                                                  \
173     if ((LOG) != 0) {                                                   \
174       if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));  \
175       else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));  \
176     }                                                                   \
177   } while (0)
178 #endif