1b942cba914dc2cfc951961ab946ecdb035d4b89
[platform/upstream/gcc.git] / gcc / config / i386 / i386elf.h
1 /* Target definitions for GCC for Intel 80386 using ELF
2    Copyright (C) 1988, 1991, 1995, 2000, 2001, 2002, 2007, 2008, 2010, 2011
3    Free Software Foundation, Inc.
4
5    Derived from sysv4.h written by Ron Guilmette (rfg@netcom.com).
6
7 This file is part of GCC.
8
9 GCC 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 3, or (at your option)
12 any later version.
13
14 GCC 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 GCC; see the file COPYING3.  If not see
21 <http://www.gnu.org/licenses/>.  */
22
23 /* Use stabs instead of DWARF debug format.  */
24 #undef  PREFERRED_DEBUGGING_TYPE
25 #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG
26
27 /* The ELF ABI for the i386 says that records and unions are returned
28    in memory.  */
29
30 #define SUBTARGET_RETURN_IN_MEMORY(TYPE, FNTYPE) \
31         (TYPE_MODE (TYPE) == BLKmode \
32          || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
33
34 #undef CPP_SPEC
35 #define CPP_SPEC ""
36
37 #define ENDFILE_SPEC "crtend.o%s"
38
39 #define STARTFILE_SPEC "%{!shared: \
40                          %{!symbolic: \
41                           %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}}}\
42                         crtbegin.o%s"
43
44 #undef DBX_REGISTER_NUMBER
45 #define DBX_REGISTER_NUMBER(n) \
46   (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
47
48 /* The routine used to output sequences of byte values.  We use a special
49    version of this for most svr4 targets because doing so makes the
50    generated assembly code more compact (and thus faster to assemble)
51    as well as more readable.  Note that if we find subparts of the
52    character sequence which end with NUL (and which are shorter than
53    STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING.  */
54
55 #undef ASM_OUTPUT_ASCII
56 #define ASM_OUTPUT_ASCII(FILE, STR, LENGTH)                             \
57   do                                                                    \
58     {                                                                   \
59       const unsigned char *_ascii_bytes =                               \
60         (const unsigned char *) (STR);                                  \
61       const unsigned char *limit = _ascii_bytes + (LENGTH);             \
62       unsigned bytes_in_chunk = 0;                                      \
63       for (; _ascii_bytes < limit; _ascii_bytes++)                      \
64         {                                                               \
65           const unsigned char *p;                                       \
66           if (bytes_in_chunk >= 64)                                     \
67             {                                                           \
68               fputc ('\n', (FILE));                                     \
69               bytes_in_chunk = 0;                                       \
70             }                                                           \
71           for (p = _ascii_bytes; p < limit && *p != '\0'; p++)          \
72             continue;                                                   \
73           if (p < limit && (p - _ascii_bytes) <= (long) STRING_LIMIT)   \
74             {                                                           \
75               if (bytes_in_chunk > 0)                                   \
76                 {                                                       \
77                   fputc ('\n', (FILE));                                 \
78                   bytes_in_chunk = 0;                                   \
79                 }                                                       \
80               ASM_OUTPUT_LIMITED_STRING ((FILE), _ascii_bytes);         \
81               _ascii_bytes = p;                                         \
82             }                                                           \
83           else                                                          \
84             {                                                           \
85               if (bytes_in_chunk == 0)                                  \
86                 fputs (ASM_BYTE, (FILE));                               \
87               else                                                      \
88                 fputc (',', (FILE));                                    \
89               fprintf ((FILE), "0x%02x", *_ascii_bytes);                        \
90               bytes_in_chunk += 5;                                      \
91             }                                                           \
92         }                                                               \
93       if (bytes_in_chunk > 0)                                           \
94         fputc ('\n', (FILE));                                           \
95     }                                                                   \
96   while (0)
97
98 #define LOCAL_LABEL_PREFIX      "."
99
100 /* Switch into a generic section.  */
101 #define TARGET_ASM_NAMED_SECTION  default_elf_asm_named_section
102
103 #undef BSS_SECTION_ASM_OP
104 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
105
106 #undef ASM_OUTPUT_ALIGNED_BSS
107 #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
108   asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)