Annotation of GNUtools/cc/config/i386/linuxelf.h, revision 1.1

1.1     ! root        1: /* Definitions for Intel 386 running Linux with ELF format
        !             2:    Written by Eric Youngdale.  */
        !             3: 
        !             4: /* A lie, I guess, but the general idea behind linux/ELF is that we are
        !             5:    supposed to be outputting something that will assemble under SVr4.
        !             6:    This gets us pretty close.  */
        !             7: #include "i386/i386.h" /* Base i386 target machine definitions */
        !             8: #include "i386/att.h"  /* Use the i386 AT&T assembler syntax */
        !             9: #include "svr4.h"
        !            10: #undef MD_EXEC_PREFIX
        !            11: #undef MD_STARTFILE_PREFIX
        !            12: #undef TARGET_VERSION
        !            13: #define TARGET_VERSION fprintf (stderr, " (i386 Linux/ELF)");
        !            14: /* Output at beginning of assembler file.  */
        !            15: /* The .file command should always begin the output.  */
        !            16: #undef ASM_FILE_START
        !            17: #define ASM_FILE_START(FILE)                                           \
        !            18:   do {                                                                 \
        !            19:        output_file_directive (FILE, main_input_filename);              \
        !            20:        fprintf (FILE, "\t.version\t\"01.01\"\n");                      \
        !            21:   } while (0)
        !            22: /* The svr4 ABI for the i386 says that records and unions are returned
        !            23:    in memory.  */
        !            24: #undef RETURN_IN_MEMORY
        !            25: #define RETURN_IN_MEMORY(TYPE) \
        !            26:   (TYPE_MODE (TYPE) == BLKmode)
        !            27: /* This is how to output an element of a case-vector that is relative.
        !            28:    This is only used for PIC code.  See comments by the `casesi' insn in
        !            29:    i386.md for an explanation of the expression this outputs. */
        !            30: #undef ASM_OUTPUT_ADDR_DIFF_ELT
        !            31: #define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, VALUE, REL) \
        !            32:   fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
        !            33: /* Indicate that jump tables go in the text section.  This is
        !            34:    necessary when compiling PIC code.  */
        !            35: #define JUMP_TABLES_IN_TEXT_SECTION
        !            36: /* Copy this from the svr4 specifications... */
        !            37: /* Define the register numbers to be used in Dwarf debugging information.
        !            38:    The SVR4 reference port C compiler uses the following register numbers
        !            39:    in its Dwarf output code:
        !            40:        0 for %eax (gnu regno = 0)
        !            41:        1 for %ecx (gnu regno = 2)
        !            42:        2 for %edx (gnu regno = 1)
        !            43:        3 for %ebx (gnu regno = 3)
        !            44:        4 for %esp (gnu regno = 7)
        !            45:        5 for %ebp (gnu regno = 6)
        !            46:        6 for %esi (gnu regno = 4)
        !            47:        7 for %edi (gnu regno = 5)
        !            48:    The following three DWARF register numbers are never generated by
        !            49:    the SVR4 C compiler or by the GNU compilers, but SDB on x86/svr4
        !            50:    believes these numbers have these meanings.
        !            51:        8  for %eip    (no gnu equivalent)
        !            52:        9  for %eflags (no gnu equivalent)
        !            53:        10 for %trapno (no gnu equivalent)
        !            54:    It is not at all clear how we should number the FP stack registers
        !            55:    for the x86 architecture.  If the version of SDB on x86/svr4 were
        !            56:    a bit less brain dead with respect to floating-point then we would
        !            57:    have a precedent to follow with respect to DWARF register numbers
        !            58:    for x86 FP registers, but the SDB on x86/svr4 is so completely
        !            59:    broken with respect to FP registers that it is hardly worth thinking
        !            60:    of it as something to strive for compatibility with.
        !            61:    The verison of x86/svr4 SDB I have at the moment does (partially)
        !            62:    seem to believe that DWARF register number 11 is associated with
        !            63:    the x86 register %st(0), but that's about all.  Higher DWARF
        !            64:    register numbers don't seem to be associated with anything in
        !            65:    particular, and even for DWARF regno 11, SDB only seems to under-
        !            66:    stand that it should say that a variable lives in %st(0) (when
        !            67:    asked via an `=' command) if we said it was in DWARF regno 11,
        !            68:    but SDB still prints garbage when asked for the value of the
        !            69:    variable in question (via a `/' command).
        !            70:    (Also note that the labels SDB prints for various FP stack regs
        !            71:    when doing an `x' command are all wrong.)
        !            72:    Note that these problems generally don't affect the native SVR4
        !            73:    C compiler because it doesn't allow the use of -O with -g and
        !            74:    because when it is *not* optimizing, it allocates a memory
        !            75:    location for each floating-point variable, and the memory
        !            76:    location is what gets described in the DWARF AT_location
        !            77:    attribute for the variable in question.
        !            78:    Regardless of the severe mental illness of the x86/svr4 SDB, we
        !            79:    do something sensible here and we use the following DWARF
        !            80:    register numbers.  Note that these are all stack-top-relative
        !            81:    numbers.
        !            82:        11 for %st(0) (gnu regno = 8)
        !            83:        12 for %st(1) (gnu regno = 9)
        !            84:        13 for %st(2) (gnu regno = 10)
        !            85:        14 for %st(3) (gnu regno = 11)
        !            86:        15 for %st(4) (gnu regno = 12)
        !            87:        16 for %st(5) (gnu regno = 13)
        !            88:        17 for %st(6) (gnu regno = 14)
        !            89:        18 for %st(7) (gnu regno = 15)
        !            90: */
        !            91: #undef DBX_REGISTER_NUMBER
        !            92: #define DBX_REGISTER_NUMBER(n) \
        !            93: ((n) == 0 ? 0 \
        !            94:  : (n) == 1 ? 2 \
        !            95:  : (n) == 2 ? 1 \
        !            96:  : (n) == 3 ? 3 \
        !            97:  : (n) == 4 ? 6 \
        !            98:  : (n) == 5 ? 7 \
        !            99:  : (n) == 6 ? 5 \
        !           100:  : (n) == 7 ? 4 \
        !           101:  : ((n) >= FIRST_STACK_REG && (n) <= LAST_STACK_REG) ? (n)+3 \
        !           102:  : (-1))
        !           103: #define LINUX_ELF
        !           104: #include "i386/linux.h"
        !           105: 
        !           106: #undef YES_UNDERSCORE
        !           107: #undef DBX_DEBUGGING_INFO
        !           108: #define DWARF_DEBUGGING_INFO

unix.superglobalmegacorp.com

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