Annotation of gcc/config/i386/linux.h, revision 1.1.1.6

1.1.1.4   root        1: /* Definitions for Intel 386 running Linux with ELF format
                      2:    Copyright (C) 1994, 1995 Free Software Foundation, Inc.
                      3:    Contributed by Eric Youngdale.
                      4:    Modified for stabs-in-ELF by H.J. Lu.
1.1.1.3   root        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
1.1.1.4   root       20: the Free Software Foundation, 59 Temple Place - Suite 330,
                     21: Boston, MA 02111-1307, USA.  */
1.1       root       22: 
1.1.1.4   root       23: #define LINUX_DEFAULT_ELF
1.1       root       24: 
1.1.1.4   root       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: #undef TARGET_VERSION
                     33: #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
                     34: 
                     35: /* The svr4 ABI for the i386 says that records and unions are returned
                     36:    in memory.  */
                     37: #undef DEFAULT_PCC_STRUCT_RETURN
                     38: #define DEFAULT_PCC_STRUCT_RETURN 1
                     39: 
                     40: /* This is how to output an element of a case-vector that is relative.
                     41:    This is only used for PIC code.  See comments by the `casesi' insn in
                     42:    i386.md for an explanation of the expression this outputs. */
                     43: #undef ASM_OUTPUT_ADDR_DIFF_ELT
                     44: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
                     45:   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
                     46: 
                     47: /* Indicate that jump tables go in the text section.  This is
                     48:    necessary when compiling PIC code.  */
                     49: #define JUMP_TABLES_IN_TEXT_SECTION
                     50: 
                     51: /* Copy this from the svr4 specifications... */
                     52: /* Define the register numbers to be used in Dwarf debugging information.
                     53:    The SVR4 reference port C compiler uses the following register numbers
                     54:    in its Dwarf output code:
                     55:        0 for %eax (gnu regno = 0)
                     56:        1 for %ecx (gnu regno = 2)
                     57:        2 for %edx (gnu regno = 1)
                     58:        3 for %ebx (gnu regno = 3)
                     59:        4 for %esp (gnu regno = 7)
                     60:        5 for %ebp (gnu regno = 6)
                     61:        6 for %esi (gnu regno = 4)
                     62:        7 for %edi (gnu regno = 5)
                     63:    The following three DWARF register numbers are never generated by
                     64:    the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
                     65:    believes these numbers have these meanings.
                     66:        8  for %eip    (no gnu equivalent)
                     67:        9  for %eflags (no gnu equivalent)
                     68:        10 for %trapno (no gnu equivalent)
                     69:    It is not at all clear how we should number the FP stack registers
                     70:    for the x86 architecture.  If the version of SDB on x86/svr4 were
                     71:    a bit less brain dead with respect to floating-point then we would
                     72:    have a precedent to follow with respect to DWARF register numbers
                     73:    for x86 FP registers, but the SDB on x86/svr4 is so completely
                     74:    broken with respect to FP registers that it is hardly worth thinking
                     75:    of it as something to strive for compatibility with.
                     76:    The version of x86/svr4 SDB I have at the moment does (partially)
                     77:    seem to believe that DWARF register number 11 is associated with
                     78:    the x86 register %st(0), but that's about all.  Higher DWARF
                     79:    register numbers don't seem to be associated with anything in
                     80:    particular, and even for DWARF regno 11, SDB only seems to under-
                     81:    stand that it should say that a variable lives in %st(0) (when
                     82:    asked via an `=' command) if we said it was in DWARF regno 11,
                     83:    but SDB still prints garbage when asked for the value of the
                     84:    variable in question (via a `/' command).
                     85:    (Also note that the labels SDB prints for various FP stack regs
                     86:    when doing an `x' command are all wrong.)
                     87:    Note that these problems generally don't affect the native SVR4
                     88:    C compiler because it doesn't allow the use of -O with -g and
                     89:    because when it is *not* optimizing, it allocates a memory
                     90:    location for each floating-point variable, and the memory
                     91:    location is what gets described in the DWARF AT_location
                     92:    attribute for the variable in question.
                     93:    Regardless of the severe mental illness of the x86/svr4 SDB, we
                     94:    do something sensible here and we use the following DWARF
                     95:    register numbers.  Note that these are all stack-top-relative
                     96:    numbers.
                     97:        11 for %st(0) (gnu regno = 8)
                     98:        12 for %st(1) (gnu regno = 9)
                     99:        13 for %st(2) (gnu regno = 10)
                    100:        14 for %st(3) (gnu regno = 11)
                    101:        15 for %st(4) (gnu regno = 12)
                    102:        16 for %st(5) (gnu regno = 13)
                    103:        17 for %st(6) (gnu regno = 14)
                    104:        18 for %st(7) (gnu regno = 15)
                    105: */
                    106: #undef DBX_REGISTER_NUMBER
                    107: #define DBX_REGISTER_NUMBER(n) \
                    108: ((n) == 0 ? 0 \
                    109:  : (n) == 1 ? 2 \
                    110:  : (n) == 2 ? 1 \
                    111:  : (n) == 3 ? 3 \
                    112:  : (n) == 4 ? 6 \
                    113:  : (n) == 5 ? 7 \
                    114:  : (n) == 6 ? 5 \
                    115:  : (n) == 7 ? 4 \
                    116:  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
                    117:  : (-1))
                    118: 
                    119: /* Output assembler code to FILE to increment profiler label # LABELNO
                    120:    for profiling a function entry.  */
                    121: 
                    122: #undef FUNCTION_PROFILER
                    123: #define FUNCTION_PROFILER(FILE, LABELNO)  \
                    124: {                                                                      \
                    125:   if (flag_pic)                                                                \
                    126:     {                                                                  \
                    127:       fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n",             \
                    128:               LPREFIX, (LABELNO));                                     \
                    129:       fprintf (FILE, "\tcall *mcount@GOT(%%ebx)\n");                   \
                    130:     }                                                                  \
                    131:   else                                                                 \
                    132:     {                                                                  \
                    133:       fprintf (FILE, "\tmovl $%sP%d,%%edx\n", LPREFIX, (LABELNO));     \
                    134:       fprintf (FILE, "\tcall mcount\n");                               \
                    135:     }                                                                  \
                    136: }
1.1       root      137: 
                    138: #undef SIZE_TYPE
                    139: #define SIZE_TYPE "unsigned int"
1.1.1.4   root      140:  
1.1       root      141: #undef PTRDIFF_TYPE
                    142: #define PTRDIFF_TYPE "int"
1.1.1.4   root      143:   
1.1       root      144: #undef WCHAR_TYPE
                    145: #define WCHAR_TYPE "long int"
1.1.1.4   root      146:    
1.1       root      147: #undef WCHAR_TYPE_SIZE
                    148: #define WCHAR_TYPE_SIZE BITS_PER_WORD
1.1.1.4   root      149:     
                    150: #undef CPP_PREDEFINES
                    151: #define CPP_PREDEFINES "-D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)"
1.1       root      152: 
1.1.1.4   root      153: #undef CPP_SPEC
1.1.1.6 ! root      154: #ifdef USE_GNULIBC_1
1.1.1.4   root      155: #if TARGET_CPU_DEFAULT == 2
                    156: #define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE}"
                    157: #else
                    158: #define CPP_SPEC "%{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{m486:-D__i486__} %{posix:-D_POSIX_SOURCE}"
1.1       root      159: #endif
1.1.1.6 ! root      160: #else /* not USE_GNULIBC_1 */
1.1.1.5   root      161: #define CPP_SPEC "%(cpp_cpu) %[cpp_cpu] %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}"
1.1.1.6 ! root      162: #endif /* not USE_GNULIBC_1 */
        !           163: 
        !           164: #undef LIBGCC_SPEC
        !           165: #define LIBGCC_SPEC "-lgcc"
1.1       root      166: 
1.1.1.4   root      167: #undef LIB_SPEC
1.1.1.6 ! root      168: #ifdef USE_GNULIBC_1
1.1.1.4   root      169: #if 1
                    170: /* We no longer link with libc_p.a or libg.a by default. If you
                    171:  * want to profile or debug the Linux C library, please add
                    172:  * -lc_p or -ggdb to LDFLAGS at the link time, respectively.
                    173:  */
1.1.1.3   root      174: #define LIB_SPEC \
1.1.1.4   root      175:   "%{!shared: %{mieee-fp:-lieee} %{p:-lgmon} %{pg:-lgmon} \
                    176:      %{!ggdb:-lc} %{ggdb:-lg}}"
                    177: #else
                    178: #define LIB_SPEC \
                    179:   "%{!shared: \
                    180:      %{mieee-fp:-lieee} %{p:-lgmon -lc_p} %{pg:-lgmon -lc_p} \
                    181:        %{!p:%{!pg:%{!g*:-lc} %{g*:-lg}}}}"
                    182: #endif
1.1.1.6 ! root      183: #else
        !           184: #define LIB_SPEC \
        !           185:   "%{!shared: %{mieee-fp:-lieee} %{pthread:-lpthread} \
        !           186:        %{profile:-lc_p} %{!profile: -lc}}"
        !           187: #endif /* not USE_GNULIBC_1 */
1.1.1.4   root      188: 
                    189: /* Provide a LINK_SPEC appropriate for Linux.  Here we provide support
                    190:    for the special GCC options -static and -shared, which allow us to
                    191:    link things in one of these three modes by applying the appropriate
                    192:    combinations of options at link-time. We like to support here for
                    193:    as many of the other GNU linker options as possible. But I don't
                    194:    have the time to search for those flags. I am sure how to add
                    195:    support for -soname shared_object_name. H.J.
                    196: 
                    197:    I took out %{v:%{!V:-V}}. It is too much :-(. They can use
                    198:    -Wl,-V.
                    199: 
                    200:    When the -shared link option is used a final link is not being
                    201:    done.  */
                    202: 
                    203: /* If ELF is the default format, we should not use /lib/elf. */
                    204: 
                    205: #undef LINK_SPEC
1.1.1.6 ! root      206: #ifdef USE_GNULIBC_1
1.1.1.4   root      207: #ifndef LINUX_DEFAULT_ELF
                    208: #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
                    209:   %{!shared: \
                    210:     %{!ibcs: \
                    211:       %{!static: \
                    212:        %{rdynamic:-export-dynamic} \
                    213:        %{!dynamic-linker:-dynamic-linker /lib/elf/ld-linux.so.1} \
                    214:        %{!rpath:-rpath /lib/elf/}} %{static:-static}}}"
1.1       root      215: #else
1.1.1.4   root      216: #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
                    217:   %{!shared: \
                    218:     %{!ibcs: \
                    219:       %{!static: \
                    220:        %{rdynamic:-export-dynamic} \
                    221:        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.1}} \
                    222:        %{static:-static}}}"
1.1       root      223: #endif
1.1.1.6 ! root      224: #else /* not USE_GNULIBC_1 */
1.1.1.5   root      225: #define LINK_SPEC "-m elf_i386 %{shared:-shared} \
                    226:   %{!shared: \
                    227:     %{!ibcs: \
                    228:       %{!static: \
                    229:        %{rdynamic:-export-dynamic} \
                    230:        %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}} \
                    231:        %{static:-static}}}"
1.1.1.6 ! root      232: #endif /* not USE_GNULIBC_1 */
1.1.1.3   root      233: 
                    234: /* Get perform_* macros to build libgcc.a.  */
                    235: #include "i386/perform.h"

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.