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.
6 This file is part of GNU CC.
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)
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.
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. */
23 #define LINUX_DEFAULT_ELF
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 */
33 #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
35 /* The svr4 ABI for the i386 says that records and unions are returned
37 #undef DEFAULT_PCC_STRUCT_RETURN
38 #define DEFAULT_PCC_STRUCT_RETURN 1
40 #undef ASM_COMMENT_START
41 #define ASM_COMMENT_START "#"
43 /* This is how to output an element of a case-vector that is relative.
44 This is only used for PIC code. See comments by the `casesi' insn in
45 i386.md for an explanation of the expression this outputs. */
46 #undef ASM_OUTPUT_ADDR_DIFF_ELT
47 #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
48 fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
50 /* Indicate that jump tables go in the text section. This is
51 necessary when compiling PIC code. */
52 #define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
54 #undef DBX_REGISTER_NUMBER
55 #define DBX_REGISTER_NUMBER(n) svr4_dbx_register_map[n]
57 /* Output assembler code to FILE to call the profiler.
58 To the best of my knowledge, no Linux libc has required the label
59 argument to mcount. */
61 #define NO_PROFILE_COUNTERS
63 #undef FUNCTION_PROFILER
64 #define FUNCTION_PROFILER(FILE, LABELNO) \
67 fprintf (FILE, "\tcall\t*mcount@GOT(%%ebx)\n"); \
69 fprintf (FILE, "\tcall\tmcount\n"); \
73 #define SIZE_TYPE "unsigned int"
76 #define PTRDIFF_TYPE "int"
79 #define WCHAR_TYPE "long int"
81 #undef WCHAR_TYPE_SIZE
82 #define WCHAR_TYPE_SIZE BITS_PER_WORD
85 #define CPP_PREDEFINES "-D__ELF__ -Dunix -Dlinux -Asystem(posix)"
89 #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE}"
91 #define CPP_SPEC "%(cpp_cpu) %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
95 #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
97 /* Provide a LINK_SPEC appropriate for Linux. Here we provide support
98 for the special GCC options -static and -shared, which allow us to
99 link things in one of these three modes by applying the appropriate
100 combinations of options at link-time. We like to support here for
101 as many of the other GNU linker options as possible. But I don't
102 have the time to search for those flags. I am sure how to add
103 support for -soname shared_object_name. H.J.
105 I took out %{v:%{!V:-V}}. It is too much :-(. They can use
108 When the -shared link option is used a final link is not being
111 /* If ELF is the default format, we should not use /lib/elf. */
115 #ifndef LINUX_DEFAULT_ELF
116 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
120 %{rdynamic:-export-dynamic} \
121 %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
122 %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
124 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
128 %{rdynamic:-export-dynamic} \
129 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
133 #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
137 %{rdynamic:-export-dynamic} \
138 %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
142 /* Get perform_* macros to build libgcc.a. */
143 #include "i386/perform.h"
145 /* A C statement (sans semicolon) to output to the stdio stream
146 FILE the assembler definition of uninitialized global DECL named
147 NAME whose size is SIZE bytes and alignment is ALIGN bytes.
148 Try to use asm_output_aligned_bss to implement this macro. */
150 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
151 asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
153 /* A C statement to output to the stdio stream FILE an assembler
154 command to advance the location counter to a multiple of 1<<LOG
155 bytes if it is within MAX_SKIP bytes.
157 This is used to align code labels according to Intel recommendations. */
159 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
160 #define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \
163 if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
164 else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \