diff options
author | Marc Espie <espie@cvs.openbsd.org> | 1999-02-17 12:52:37 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 1999-02-17 12:52:37 +0000 |
commit | c997f8119e4603c12b1877991acbec2dc90b6fd2 (patch) | |
tree | 1071e66034777d00e481b5ecceaf8c01d0dc5206 /gnu | |
parent | 876a4cb8e57736b22cc8e3170d593e01911a5a7a (diff) |
General clean-up, closer match to egcs.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/gcc/config/openbsd.h | 243 |
1 files changed, 145 insertions, 98 deletions
diff --git a/gnu/usr.bin/gcc/config/openbsd.h b/gnu/usr.bin/gcc/config/openbsd.h index 9179106c368..2f8e9c1d9ed 100644 --- a/gnu/usr.bin/gcc/config/openbsd.h +++ b/gnu/usr.bin/gcc/config/openbsd.h @@ -1,21 +1,43 @@ -/* $OpenBSD: openbsd.h,v 1.14 1999/01/17 17:41:13 espie Exp $ */ +/* $OpenBSD: openbsd.h,v 1.15 1999/02/17 12:52:36 espie Exp $ */ + +/* common OpenBSD configuration. + All OpenBSD architectures include this file, which is intended as + a repository for common defines. + + Some defines are common to all architectures, a few of them are + triggered by OBSD_* guards, so that we won't override architecture + defaults by mistakes. + + OBSD_HAS_CORRECT_SPECS: + another mechanism provides correct specs already. + OBSD_NO_DYNAMIC_LIBRARIES: + no implementation of dynamic libraries. + OBSD_OLD_GAS: + older flavor of gas which needs help for PIC. + OBSD_HAS_DECLARE_FUNCTION_NAME, OBSD_HAS_DECLARE_FUNCTION_SIZE, + OBSD_HAS_DECLARE_OBJECT: + PIC support, FUNCTION_NAME/FUNCTION_SIZE are independent, whereas + the corresponding logic for OBJECTS is necessarily coupled. + + There are also a few `default' defines such as ASM_WEAKEN_LABEL, + intended as common ground for arch that don't provide anything suitable. + */ -/* OPENBSD_NATIVE is defined when gcc is integrated into the OpenBSD - source tree so it can be configured appropriately when using the - 'wrapper' makefile with the GNU configure/build mechanism. The - 'wrapper' method and use of OPENBSD_NATIVE is NOT recommended - while building cross-compilers. */ +/* OPENBSD_NATIVE is defined only when gcc is configured as part of + the OpenBSD source tree, specifically through Makefile.bsd-wrapper. + In such a case the include path can be trimmed as there is no + distinction between system includes and gcc includes + */ +/* This configuration method, namely Makefile.bsd-wrapper and + OPENBSD_NATIVE is NOT recommended for building cross-compilers + */ #ifdef OPENBSD_NATIVE -#undef GPLUSPLUS_INCLUDE_DIR -#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" - #undef GCC_INCLUDE_DIR #define GCC_INCLUDE_DIR "/usr/include" -/* Look for the include files in the system-defined places. */ - +/* The compiler is configured with ONLY the gcc/g++ standard headers */ #undef INCLUDE_DEFAULTS #define INCLUDE_DEFAULTS \ { \ @@ -26,21 +48,29 @@ /* Under OpenBSD, the normal location of the various *crt*.o files is the /usr/lib directory. */ - -#undef STANDARD_STARTFILE_PREFIX #define STANDARD_STARTFILE_PREFIX "/usr/lib/" #endif - + /* Controlling the compilation driver * ---------------------------------- */ +#ifndef OBSD_HAS_CORRECT_SPECS -/* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread */ +#ifndef OBSD_NO_DYNAMIC_LIBRARIES +#undef SWITCH_TAKES_ARG +#define SWITCH_TAKES_ARG(CHAR) \ + (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ + || (CHAR) == 'R') +#endif + +/* CPP_SPEC appropriate for OpenBSD. We deal with -posix and -pthread. + XXX the way threads are handling currently is not very satisfying, + since all code must be compiled with -pthread to work. + */ #undef CPP_SPEC #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" - #ifdef OBSD_OLD_GAS /* ASM_SPEC appropriate for OpenBSD. For some architectures, OpenBSD still uses a special flavor of gas that needs to be told when generating @@ -55,127 +85,137 @@ #endif #endif -/* LIB_SPEC appropriate for OpenBSD. Select the appropriate libc, - depending on profiling and threads. - Basically, -lc(_r)?(_p)?, select _r for threads, and _p for p or pg - */ -#undef LIB_SPEC -#define LIB_SPEC "-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}" - /* LINK_SPEC appropriate for OpenBSD. Support for GCC options -static, -assert, and -nostdlib. */ #undef LINK_SPEC +#ifdef OBSD_NO_DYNAMIC_LIBRARIES +#define LINK_SPEC \ + "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{assert*}" +#else #define LINK_SPEC \ "%{!nostdlib:%{!r*:%{!e*:-e start}}} -dc -dp %{R*} %{static:-Bstatic} %{assert*}" +#endif -/* Add the -R arg switch, needed for dynamic library support. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R') +/* LIB_SPEC appropriate for OpenBSD. Select the appropriate libc, + depending on profiling and threads. + Basically, -lc(_r)?(_p)?, select _r for threads, and _p for p or pg. */ +#undef LIB_SPEC +#define LIB_SPEC "-lc%{pthread:_r}%{p:_p}%{!p:%{pg:_p}}" +#endif + /* Runtime target specification * ---------------------------- */ - /* You must redefine CPP_PREDEFINES in any arch specific file. */ #undef CPP_PREDEFINES -/* we want gcc.c to call mkstemps for each file it generates - (fix taken from egcs-current). */ -#define MKTEMP_EACH_FILE - /* Implicit calls to library routines * ---------------------------------- */ -/* Use memcpy and memset instead of bcopy and bzero for implicit library - calls. */ +/* Use memcpy and memset instead of bcopy and bzero. */ #define TARGET_MEM_FUNCTIONS /* Miscellaneous parameters * ------------------------ */ -/* tell libgcc2.c that OpenBSD targets support atexit */ +/* tell libgcc2.c that OpenBSD targets support atexit. */ #define HAVE_ATEXIT - -/* - * Some imports from svr4.h in support of shared libraries. - * Currently, we need the DECLARE_OBJECT_SIZE stuff. - */ +/* Controlling debugging info: dbx options + * --------------------------------------- */ +/* Don't use the `xsTAG;' construct in DBX output; OpenBSD systems that + * use DBX don't support it. */ +#define DBX_NO_XREFS -/* Define the strings used for the .type, .size, and .set directives. - These strings generally do not vary from one system running openbsd + +/* Support of shared libraries, mostly imported from svr4.h through netbsd. */ +/* Two differences from svr4.h: + - we use . - _func instead of a local label, + - we put extra spaces in expressions such as + .type _func , @function + This is more readable for a human being and confuses c++filt less. */ + +/* Assembler format: output and generation of labels + * ------------------------------------------------- */ +/* Define the strings used for the .type and .size directives. + These strings generally do not vary from one system running OpenBSD to another, but if a given system needs to use different pseudo-op - names for these, they may be overridden in the file which includes - this one. */ + names for these, they may be overridden in the arch specific file. */ + +/* OpenBSD assembler is hacked to have .type & .size support even in a.out + format object files. Functions size are supported but not activated + yet (look for GRACE_PERIOD_EXPIRED in gas/config/obj-aout.c). */ #undef TYPE_ASM_OP #undef SIZE_ASM_OP -#undef SET_ASM_OP + #define TYPE_ASM_OP ".type" #define SIZE_ASM_OP ".size" -#define SET_ASM_OP ".set" - -/* This is how we tell the assembler that a symbol is weak. */ - -#undef ASM_WEAKEN_LABEL -#define ASM_WEAKEN_LABEL(FILE,NAME) \ - do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ - fputc ('\n', FILE); } while (0) /* The following macro defines the format used to output the second - operand of the .type assembler directive. Different svr4 assemblers - expect various different forms for this operand. The one given here - is just a default. You may need to override it in your machine- - specific tm.h file (depending upon the particulars of your assembler). */ - + operand of the .type assembler directive. */ #undef TYPE_OPERAND_FMT #define TYPE_OPERAND_FMT "@%s" -/* Write the extra assembler code needed to declare a function's result. - Most svr4 assemblers don't require any special declaration of the - result value, but there are exceptions. */ - +/* Provision if extra assembler code is needed to declare a function's result + (taken from svr4, not needed yet actually). */ #ifndef ASM_DECLARE_RESULT #define ASM_DECLARE_RESULT(FILE, RESULT) #endif /* These macros generate the special .type and .size directives which are used to set the corresponding fields of the linker symbol table - entries in an ELF object file under SVR4. These macros also output - the starting labels for the relevant functions/objects. */ - -/* Write the extra assembler code needed to declare a function properly. - Some svr4 assemblers need to also have something extra said about the - function's return value. We allow for that here. */ + entries under OpenBSD. These macros also have to output the starting + labels for the relevant functions/objects. */ +#ifndef OBSD_HAS_DECLARE_FUNCTION_NAME +/* Extra assembler code needed to declare a function properly. + Some assemblers may also need to also have something extra said + about the function's return value. We allow for that here. */ #undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ do { \ - fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ + fprintf (FILE, "\t%s\t", TYPE_ASM_OP); \ assemble_name (FILE, NAME); \ - putc (',', FILE); \ + fputs (" , ", FILE); \ fprintf (FILE, TYPE_OPERAND_FMT, "function"); \ putc ('\n', FILE); \ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ ASM_OUTPUT_LABEL(FILE, NAME); \ } while (0) +#endif -/* Write the extra assembler code needed to declare an object properly. */ +#ifndef OBSD_HAS_DECLARE_FUNCTION_SIZE +/* Declare the size of a function. */ +#undef ASM_DECLARE_FUNCTION_SIZE +#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ + do { \ + if (!flag_inhibit_size_directive) \ + { \ + fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ + assemble_name (FILE, (FNAME)); \ + fputs(" , . - ", FILE); \ + assemble_name (FILE, (FNAME)); \ + putc ('\n', FILE); \ + } \ + } while (0) +#endif +#ifndef OBSD_HAS_DECLARE_OBJECT +/* Extra assembler code needed to declare an object properly. */ #undef ASM_DECLARE_OBJECT_NAME #define ASM_DECLARE_OBJECT_NAME(FILE, NAME, DECL) \ do { \ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ assemble_name (FILE, NAME); \ - putc (',', FILE); \ + fputs (" , ", FILE); \ fprintf (FILE, TYPE_OPERAND_FMT, "object"); \ putc ('\n', FILE); \ size_directive_output = 0; \ if (!flag_inhibit_size_directive && DECL_SIZE (DECL)) \ { \ size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ } \ ASM_OUTPUT_LABEL(FILE, NAME); \ } while (0) @@ -185,7 +225,6 @@ Once we find the error_mark_node, we know that the value of size_directive_output was set by ASM_DECLARE_OBJECT_NAME when it was run for the same decl. */ - #undef ASM_FINISH_DECLARE_OBJECT #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP_LEVEL, AT_END) \ do { \ @@ -196,30 +235,38 @@ do { \ && !size_directive_output) \ { \ size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ + fprintf (FILE, "\t%s\t", SIZE_ASM_OP); \ assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ + fprintf (FILE, " , %d\n", int_size_in_bytes (TREE_TYPE (DECL)));\ } \ } while (0) +#endif -/* This is how to declare the size of a function. */ + +/* Those are `generic' ways to weaken/globalize a label. We shouldn't need + to override a processor specific definition. Hence, #ifndef ASM_* + In case overriding turns out to be needed, one can always #undef ASM_* + before including this file. */ + +/* Tell the assembler that a symbol is weak. */ +/* Note: netbsd arm32 assembler needs a .globl here. An override may + be needed when/if we go for arm32 support. */ +#ifndef ASM_WEAKEN_LABEL +#define ASM_WEAKEN_LABEL(FILE,NAME) \ + do { fputs ("\t.weak\t", FILE); assemble_name (FILE, NAME); \ + fputc ('\n', FILE); } while (0) +#endif -#undef ASM_DECLARE_FUNCTION_SIZE -#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ - do { \ - if (!flag_inhibit_size_directive) \ - { \ - char label[256]; \ - static int labelno; \ - labelno++; \ - ASM_GENERATE_INTERNAL_LABEL (label, "Lfe", labelno); \ - ASM_OUTPUT_INTERNAL_LABEL (FILE, "Lfe", labelno); \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, (FNAME)); \ - fprintf (FILE, ","); \ - assemble_name (FILE, label); \ - fprintf (FILE, "-"); \ - assemble_name (FILE, (FNAME)); \ - putc ('\n', FILE); \ - } \ - } while (0) +/* Tell the assembler that a symbol is global. */ +#ifndef ASM_GLOBALIZE_LABEL +#define ASM_GLOBALIZE_LABEL(FILE,NAME) \ + do { fputs ("\t.globl\t", FILE); assemble_name (FILE, NAME); \ + fputc ('\n', FILE); } while(0) +#endif + + +/* Storage layout + * -------------- */ +/* Use VTABLE_THUNKS always: we don't have to worry about binary + compatibility with older C++ code. */ +#define DEFAULT_VTABLE_THUNKS 1 |