diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 1999-01-24 11:03:42 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 1999-01-24 11:03:42 +0000 |
commit | 332f1dd1d0ea080ac43eb29749c6247bd7b3c188 (patch) | |
tree | a32aa777f7245c4384f0d708d313f4da918b1693 /gnu/usr.bin/gcc | |
parent | 6beb3858ac15a26f1e8edbdc8a142a680cb0b375 (diff) |
This is a new version of the config for mipsle which uses the common
openbsd config. It is belived to work correctly (tested on gcc itself,
kernels, and other stuff in the tree). News in this config is support for
section ans weak attributes. Based on discussions with Marc Espie.
Diffstat (limited to 'gnu/usr.bin/gcc')
-rw-r--r-- | gnu/usr.bin/gcc/config/mips/openbsd-le.h | 250 |
1 files changed, 35 insertions, 215 deletions
diff --git a/gnu/usr.bin/gcc/config/mips/openbsd-le.h b/gnu/usr.bin/gcc/config/mips/openbsd-le.h index 25702c05905..23b00a5d363 100644 --- a/gnu/usr.bin/gcc/config/mips/openbsd-le.h +++ b/gnu/usr.bin/gcc/config/mips/openbsd-le.h @@ -1,42 +1,24 @@ -/* Definitions for MIPS systems running BSD as target machine for GNU compiler. - Copyright (C) 1993, 1995 Free Software Foundation, Inc. +/* GCC definition OpenBSD Mips ABI32 */ -This file is part of GNU CC. +#include <openbsd.h> -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the 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 of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +/* Mips targets uses it's own for this */ +#undef ASM_SPEC +#undef ASM_DECLARE_OBJECT_NAME +#undef ASM_DECLARE_FUNCTION_NAME -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +/* Undef SET_ASM_OP because it means something else in mips gas */ +#undef SET_ASM_OP /* We settle for little endian for now */ - #define TARGET_ENDIAN_DEFAULT 0 -#ifndef CROSS_COMPILE -/* Look for the G++ include files in the system-defined place. */ - -#undef GPLUSPLUS_INCLUDE_DIR -#define GPLUSPLUS_INCLUDE_DIR "/usr/include/g++" - -/* 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 +/* Target uses ELF object format */ +#define OBJECT_FORMAT_ELF /* Provide a LINK_SPEC appropriate for OpenBSD. Here we provide support for the special GCC options -static, -assert, and -nostdlib. */ +/* We also need to control dynamic stuff like dynamic loader etc */ #undef LINK_SPEC #define LINK_SPEC \ @@ -48,66 +30,25 @@ Boston, MA 02111-1307, USA. */ %{!nostdlib:%{!r*:%{!e*:-e __start}}} -dc -dp \ %{static:-Bstatic} %{!static:-Bdynamic} %{assert*}" -/* We have atexit(3). */ - -#define HAVE_ATEXIT - -/* Implicit library calls should use memcpy, not bcopy, etc. */ - -#define TARGET_MEM_FUNCTIONS /* Define mips-specific OpenBSD predefines... */ #ifndef CPP_PREDEFINES -#define CPP_PREDEFINES "-D__ANSI_COMPAT \ --DMIPSEL -DR3000 -DSYSTYPE_BSD -D_SYSTYPE_BSD -D__OpenBSD__ -Dmips \ +#define CPP_PREDEFINES "-DMIPSEL -D_MIPSEL -DSYSTYPE_BSD \ -D__NO_LEADING_UNDERSCORES__ -D__GP_SUPPORT__ \ --Dunix -D_R3000 \ +-Dunix -D__OpenBSD__ -Dmips \ -Asystem(unix) -Asystem(OpenBSD) -Amachine(mips)" #endif -#ifndef CC1_SPEC -#define CC1_SPEC "\ -%{gline:%{!g:%{!g0:%{!g1:%{!g2: -g1}}}}} \ -%{mips1:-mfp32 -mgp32}%{mips2:-mfp32 -mgp32}\ -%{mips3:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ -%{mips4:%{!msingle-float:%{!m4650:-mfp64}} -mgp64} \ -%{mfp64:%{msingle-float:%emay not use both -mfp64 and -msingle-float}} \ -%{mfp64:%{m4650:%emay not use both -mfp64 and -m4650}} \ -%{m4650:-mcpu=r4650} \ -%{G*} %{EB:-meb} %{EL:-mel} %{EB:%{EL:%emay not use both -EB and -EL}} \ -%{pic-none: -mno-half-pic} \ -%{pic-lib: -mhalf-pic} \ -%{pic-extern: -mhalf-pic} \ -%{pic-calls: -mhalf-pic} \ -%{save-temps: } \ -%{!mno-abicalls: -mabicalls}" -#endif - +/* GAS needs to know this */ #define SUBTARGET_ASM_SPEC "%{fPIC:-KPIC}" -#ifndef CPP_SPEC -#define CPP_SPEC "\ -%{posix:-D_POSIX_SOURCE} \ -%{mlong64:-D__SIZE_TYPE__=long\\ unsigned\\ int -D__PTRDIFF_TYPE__=long\\ int} \ -%{!mlong64:-D__SIZE_TYPE__=unsigned\\ int -D__PTRDIFF_TYPE__=int} \ -%{mips3:-U__mips -D__mips=3 -D__mips64} \ -%{mgp32:-U__mips64} %{mgp64:-D__mips64}" -#endif - -#define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" +/* ABI style and other controls. Our target uses GAS */ +#define TARGET_DEFAULT MASK_GAS|MASK_ABICALLS -#undef LIB_SPEC -#define LIB_SPEC "%{p:-lprof1} %{pg:-lprof1} -lc crtn.o%s" -#define STARTFILE_SPEC \ - "%{!shared:%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s libprof1.a%s}%{!p:crt1.o%s}}}" - -#ifndef MACHINE_TYPE -#define MACHINE_TYPE "OpenBSD/mips" -#endif - -#define TARGET_DEFAULT MASK_GAS +/* Some comment say that this is needed for ELF */ #define PREFERRED_DEBUGGING_TYPE DBX_DEBUG +/* Some comment say that we need to redefine this for ELF */ #define LOCAL_LABEL_PREFIX "." /* -G is incompatible with -KPIC which is the default, so only allow objects @@ -117,145 +58,24 @@ Boston, MA 02111-1307, USA. */ #include "mips/mips.h" -/* - * Some imports from svr4.h in support of shared libraries. - * Currently, we need the DECLARE_OBJECT_SIZE stuff. - */ - -/* Define the strings used for the special svr4 .type and .size directives. - These strings generally do not vary from one system running svr4 to - another, but if a given system (e.g. m88k running svr) needs to use - different pseudo-op names for these, they may be overridden in the - file which includes this one. */ - -#undef TYPE_ASM_OP -#undef SIZE_ASM_OP -#undef WEAK_ASM_OP -#define TYPE_ASM_OP ".type" -#define SIZE_ASM_OP ".size" -#define WEAK_ASM_OP ".weak" - -/* 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). */ - -#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. */ - -#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. */ - -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ - do { \ - extern FILE *asm_out_text_file; \ - \ - if (TARGET_GP_OPT) \ - { \ - int align; \ - STREAM = asm_out_text_file; \ - /* Output ALIGN again to the new stream. XXX */ \ - align = floor_log2 (FUNCTION_BOUNDARY / BITS_PER_UNIT); \ - if (align > 0) \ - { \ - if (output_bytecode) \ - BC_OUTPUT_ALIGN (STREAM, align); \ - else \ - ASM_OUTPUT_ALIGN (STREAM, align); \ - } \ - } \ - fprintf (STREAM, "\t%s\t ", TYPE_ASM_OP); \ - assemble_name (STREAM, NAME); \ - putc (',', STREAM); \ - fprintf (STREAM, TYPE_OPERAND_FMT, "function"); \ - putc ('\n', STREAM); \ - ASM_DECLARE_RESULT (STREAM, DECL_RESULT (DECL)); \ - HALF_PIC_DECLARE (NAME); \ - } while (0) - -/* Assemble generic sections. */ -/* Write the 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); \ - 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); \ - assemble_name (FILE, NAME); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - ASM_OUTPUT_LABEL(FILE, NAME); \ - } while (0) - -/* Output the size directive for a decl in rest_of_decl_compilation - in the case where we did not do so before the initializer. - 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 { \ - char *name = XSTR (XEXP (DECL_RTL (DECL), 0), 0); \ - if (!flag_inhibit_size_directive && DECL_SIZE (DECL) \ - && ! AT_END && TOP_LEVEL \ - && DECL_INITIAL (DECL) == error_mark_node \ - && !size_directive_output) \ - { \ - size_directive_output = 1; \ - fprintf (FILE, "\t%s\t ", SIZE_ASM_OP); \ - assemble_name (FILE, name); \ - fprintf (FILE, ",%d\n", int_size_in_bytes (TREE_TYPE (DECL))); \ - } \ - } while (0) - -/* This is how to 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) \ - { \ - 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) - /* Since gas and gld are standard on OpenBSD, we don't need these */ + #undef ASM_FINAL_SPEC #undef STARTFILE_SPEC +/* + A C statement to output something to the assembler file to switch to section + NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or + NULL_TREE. Some target formats do not support arbitrary sections. Do not + define this macro in such cases. mips.h doesn't define this, do it here. +*/ +#define ASM_OUTPUT_SECTION_NAME(F, DECL, NAME, RELOC) \ +do { \ + extern FILE *asm_out_text_file; \ + if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL) \ + fprintf (asm_out_text_file, "\t.section %s,\"ax\",@progbits\n", (NAME)); \ + else if ((DECL) && DECL_READONLY_SECTION (DECL, RELOC)) \ + fprintf (F, "\t.section %s,\"a\",@progbits\n", (NAME)); \ + else \ + fprintf (F, "\t.section %s,\"aw\",@progbits\n", (NAME)); \ +} while (0) |