📄 osfrose.h
字号:
/* Definitions of target machine for GNU compiler. Intel 386 (OSF/1 with OSF/rose) version. Copyright (C) 1991, 1992, 1993, 1996, 1999 Free Software Foundation, Inc.This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA. */#include "halfpic.h"#include "i386/gstabs.h"/* Get perform_* macros to build libgcc.a. */#include "i386/perform.h"#define OSF_OS#undef WORD_SWITCH_TAKES_ARG#define WORD_SWITCH_TAKES_ARG(STR) \ (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) || !strcmp (STR, "pic-names"))/* This defines which switch letters take arguments. On svr4, most of the normal cases (defined in gcc.c) apply, and we also have -h* and -z* options (for the linker). */#define SWITCH_TAKES_ARG(CHAR) \ (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ || (CHAR) == 'h' \ || (CHAR) == 'z')#define MASK_HALF_PIC 010000000000 /* Mask for half-pic code */#define MASK_HALF_PIC_DEBUG 004000000000 /* Debug flag */#define MASK_ELF 002000000000 /* ELF not rose */#define MASK_NO_UNDERSCORES 000400000000 /* suppress leading _ */#define MASK_LARGE_ALIGN 000200000000 /* align to >word boundaries */#define MASK_NO_MCOUNT 000100000000 /* profiling uses mcount_ptr */#define TARGET_HALF_PIC (target_flags & MASK_HALF_PIC)#define TARGET_DEBUG (target_flags & MASK_HALF_PIC_DEBUG)#define HALF_PIC_DEBUG TARGET_DEBUG#define TARGET_ELF (target_flags & MASK_ELF)#define TARGET_ROSE ((target_flags & MASK_ELF) == 0)#define TARGET_UNDERSCORES ((target_flags & MASK_NO_UNDERSCORES) == 0)#define TARGET_LARGE_ALIGN (target_flags & MASK_LARGE_ALIGN)#define TARGET_MCOUNT ((target_flags & MASK_NO_MCOUNT) == 0)#undef SUBTARGET_SWITCHES#define SUBTARGET_SWITCHES \ { "half-pic", MASK_HALF_PIC, "Emit half-PIC code" }, \ { "no-half-pic", -MASK_HALF_PIC, "" } \ { "debug-half-pic", MASK_HALF_PIC_DEBUG, 0 /* intentionally undoc */ }, \ { "debugb", MASK_HALF_PIC_DEBUG, 0 /* intentionally undoc */ }, \ { "elf", MASK_ELF, "Emit ELF object code" }, \ { "rose", -MASK_ELF, "Emit ROSE object code" }, \ { "underscores", -MASK_NO_UNDERSCORES, "Symbols have a leading underscore" }, \ { "no-underscores", MASK_NO_UNDERSCORES, "" }, \ { "large-align", MASK_LARGE_ALIGN, "Align to >word boundaries" }, \ { "no-large-align", -MASK_LARGE_ALIGN, "" }, \ { "mcount", -MASK_NO_MCOUNT, "Use mcount for profiling" }, \ { "mcount-ptr", MASK_NO_MCOUNT, "Use mcount_ptr for profiling" }, \ { "no-mcount", MASK_NO_MCOUNT, "" },/* OSF/rose uses stabs, not dwarf. */#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG#ifndef DWARF_DEBUGGING_INFO#define DWARF_DEBUGGING_INFO /* enable dwarf debugging for testing */#endif/* Handle #pragma weak and #pragma pack. */#define HANDLE_SYSV_PRAGMA#define SUPPORTS_WEAK TARGET_ELF/* Change default predefines. */#undef CPP_PREDEFINES#define CPP_PREDEFINES "-DOSF -DOSF1 -Dunix -Asystem(xpg4)"#undef CPP_SPEC#define CPP_SPEC "%(cpp_cpu) \%{!melf: -D__ROSE__ %{!pic-none: -D__SHARED__}} \%{melf: -D__ELF__ %{fpic: -D__SHARED__}} \%{mno-underscores: -D__NO_UNDERSCORES__} \%{melf: %{!munderscores: -D__NO_UNDERSCORES__}} \%{.S: %{!ansi:%{!traditional:%{!traditional-cpp:%{!ftraditional: -traditional}}}}} \%{.S: -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY}} \%{.cc: -D__LANGUAGE_C_PLUS_PLUS} \%{.cxx: -D__LANGUAGE_C_PLUS_PLUS} \%{.C: -D__LANGUAGE_C_PLUS_PLUS} \%{.m: -D__LANGUAGE_OBJECTIVE_C} \%{!.S: -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C}}"/* Turn on -pic-extern by default for OSF/rose, -fpic for ELF. */#undef CC1_SPEC#define CC1_SPEC "\%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \%{!melf: %{!mrose: -mrose }} \%{melf: %{!munderscores: %{!mno-underscores: -mno-underscores }} \ %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount-ptr }}}} \%{!melf: %{!munderscores: %{!mno-underscores: -munderscores }} \ %{!mmcount: %{!mno-mcount: %{!mmcount-ptr: -mmcount }}} \ %{pic-extern: -mhalf-pic } %{pic-lib: -mhalf-pic } \ %{!pic-extern: %{!pic-lib: %{pic-none: -mno-half-pic} %{!pic-none: -mhalf-pic}}} \ %{pic-calls: } %{pic-names*: }}"#undef ASM_SPEC#define ASM_SPEC "%{v*: -v}"#undef LINK_SPEC#define LINK_SPEC "%{v*: -v} \%{!melf: %{!noshrlib: %{pic-none: -noshrlib} %{!pic-none: -warn_nopic}} \ %{nostdlib} %{noshrlib} %{glue}} \%{melf: %{dy} %{dn} %{glue: } \ %{h*} %{z*} \ %{static:-dn -Bstatic} \ %{shared:-G -dy} \ %{symbolic:-Bsymbolic -G -dy} \ %{G:-G} \ %{!dy: %{!dn: %{!static: %{!shared: %{!symbolic: \ %{noshrlib: -dn } %{pic-none: -dn } \ %{!noshrlib: %{!pic-none: -dy}}}}}}}}"#undef LIB_SPEC#define LIB_SPEC "-lc"#undef LIBG_SPEC#define LIBG_SPEC ""#undef STARTFILE_SPEC#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}}"#undef TARGET_VERSION_INTERNAL#undef TARGET_VERSION#define I386_VERSION " 80386, OSF/rose objects"#define TARGET_VERSION_INTERNAL(STREAM) fputs (I386_VERSION, STREAM)#define TARGET_VERSION TARGET_VERSION_INTERNAL (stderr)#undef MD_EXEC_PREFIX#define MD_EXEC_PREFIX "/usr/ccs/gcc/"#undef MD_STARTFILE_PREFIX#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"/* Specify size_t, ptrdiff_t, and wchar_t types. */#undef SIZE_TYPE#undef PTRDIFF_TYPE#undef WCHAR_TYPE#undef WCHAR_TYPE_SIZE#define SIZE_TYPE "long unsigned int"#define PTRDIFF_TYPE "int"#define WCHAR_TYPE "unsigned int"#define WCHAR_TYPE_SIZE BITS_PER_WORD/* Define this macro if the system header files support C++ as well as C. This macro inhibits the usual method of using system header files in C++, which is to pretend that the file's contents are enclosed in `extern "C" {...}'. */#define NO_IMPLICIT_EXTERN_C/* Turn off long double being 96 bits. */#undef LONG_DOUBLE_TYPE_SIZE#define LONG_DOUBLE_TYPE_SIZE 64/* This macro generates the assembly code for function entry. FILE is a stdio stream to output the code to. SIZE is an int: how many units of temporary storage to allocate. Refer to the array `regs_ever_live' to determine which registers to save; `regs_ever_live[I]' is nonzero if register number I is ever used in the function. This macro is responsible for knowing which registers should not be saved even if used. We override it here to allow for the new profiling code to go before the prologue and the old mcount code to go after the prologue (and after %ebx has been set up for ELF shared library support). */#define OSF_PROFILE_BEFORE_PROLOGUE \ (!TARGET_MCOUNT \ && !current_function_needs_context \ && (!flag_pic \ || !frame_pointer_needed \ || (!current_function_uses_pic_offset_table \ && !current_function_uses_const_pool)))#undef FUNCTION_PROLOGUE#define FUNCTION_PROLOGUE(FILE, SIZE) \do \ { \ char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \ char *lprefix = LPREFIX; \ int labelno = profile_label_no; \ \ if (profile_flag && OSF_PROFILE_BEFORE_PROLOGUE) \ { \ if (!flag_pic && !HALF_PIC_P ()) \ { \ fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ fprintf (FILE, "\tcall *%s_mcount_ptr\n", prefix); \ } \ \ else if (HALF_PIC_P ()) \ { \ rtx symref; \ \ HALF_PIC_EXTERNAL ("_mcount_ptr"); \ symref = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, \ "_mcount_ptr")); \ \ fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ fprintf (FILE, "\tmovl %s%s,%%eax\n", prefix, \ XSTR (symref, 0)); \ fprintf (FILE, "\tcall *(%%eax)\n"); \ } \ \ else \ { \ static int call_no = 0; \ \ fprintf (FILE, "\tcall %sPc%d\n", lprefix, call_no); \ fprintf (FILE, "%sPc%d:\tpopl %%eax\n", lprefix, call_no); \ fprintf (FILE, "\taddl $_GLOBAL_OFFSET_TABLE_+[.-%sPc%d],%%eax\n", \ lprefix, call_no++); \ fprintf (FILE, "\tleal %sP%d@GOTOFF(%%eax),%%edx\n", \ lprefix, labelno); \ fprintf (FILE, "\tmovl %s_mcount_ptr@GOT(%%eax),%%eax\n", \ prefix); \ fprintf (FILE, "\tcall *(%%eax)\n"); \ } \ } \ \ function_prologue (FILE, SIZE); \ } \while (0)/* A C statement or compound statement to output to FILE some assembler code to call the profiling subroutine `mcount'. Before calling, the assembler code must load the address of a counter variable into a register where `mcount' expects to find the address. The name of this variable is `LP' followed by the number LABELNO, so you would generate the name using `LP%d' in a `fprintf'. The details of how the address should be passed to `mcount' are determined by your operating system environment, not by GNU CC. To figure them out, compile a small program for profiling using the system's installed C compiler and look at the assembler code that results. */#undef FUNCTION_PROFILER#define FUNCTION_PROFILER(FILE, LABELNO) \do \ { \ if (!OSF_PROFILE_BEFORE_PROLOGUE) \ { \ char *prefix = (TARGET_UNDERSCORES) ? "_" : ""; \ char *lprefix = LPREFIX; \ int labelno = LABELNO; \ \ /* Note that OSF/rose blew it in terms of calling mcount, \ since OSF/rose prepends a leading underscore, but mcount's \ doesn't. At present, we keep this kludge for ELF as well \ to allow old kernels to build profiling. */ \ \ if (flag_pic \ && !current_function_uses_pic_offset_table \ && !current_function_uses_const_pool) \ abort (); \ \ if (TARGET_MCOUNT && flag_pic) \ { \ fprintf (FILE, "\tleal %sP%d@GOTOFF(%%ebx),%%edx\n", \ lprefix, labelno); \ fprintf (FILE, "\tcall *%smcount@GOT(%%ebx)\n", prefix); \ } \ \ else if (TARGET_MCOUNT && HALF_PIC_P ()) \ { \ rtx symdef; \ \ HALF_PIC_EXTERNAL ("mcount"); \ symdef = HALF_PIC_PTR (gen_rtx (SYMBOL_REF, Pmode, "mcount")); \ fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ fprintf (FILE, "\tcall *%s%s\n", prefix, XSTR (symdef, 0)); \ } \ \ else if (TARGET_MCOUNT) \ { \ fprintf (FILE, "\tmovl $%sP%d,%%edx\n", lprefix, labelno); \ fprintf (FILE, "\tcall %smcount\n", prefix); \ } \ \ else if (flag_pic && frame_pointer_needed) \ { \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -