make this work for i386-netbsdelf. most of this work is based on patches

from thorpej that includes a rewrite of the config/i386/netbsd-elf.h file.
This commit is contained in:
mrg 2000-09-14 03:56:04 +00:00
parent c1682ac85d
commit 4da440af9a
7 changed files with 450 additions and 218 deletions

View File

@ -48,6 +48,7 @@ do { \
/* Output #ident as a .ident. */
#undef ASM_OUTPUT_IDENT
#define ASM_OUTPUT_IDENT(FILE, NAME) \
fprintf (FILE, "\t%s\t\"%s\"\n", IDENT_ASM_OP, NAME);
@ -92,6 +93,10 @@ do { \
#undef SET_ASM_OP
#define SET_ASM_OP ".set"
/* We want local labels to start with period if made with asm_fprintf. */
#undef LOCAL_LABEL_PREFIX
#define LOCAL_LABEL_PREFIX "."
/* This is how to begin an assembly language file. Most svr4 assemblers want
at least a .file directive to come first, and some want to see a .version
directive come right after that. Here we just establish a default
@ -130,7 +135,7 @@ do { \
#undef ASM_OUTPUT_INTERNAL_LABEL
#define ASM_OUTPUT_INTERNAL_LABEL(FILE, PREFIX, NUM) \
do { \
fprintf (FILE, ".%s%d:\n", PREFIX, NUM); \
fprintf (FILE, "%s%s%d:\n", LOCAL_LABEL_PREFIX, PREFIX, NUM); \
} while (0)
/* This is how to store into the string LABEL
@ -144,7 +149,7 @@ do { \
#undef ASM_GENERATE_INTERNAL_LABEL
#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
do { \
sprintf (LABEL, "*.%s%d", PREFIX, NUM); \
sprintf (LABEL, "*%s%s%d", LOCAL_LABEL_PREFIX, PREFIX, NUM); \
} while (0)
/* Output the label which precedes a jumptable. Note that for all svr4
@ -461,6 +466,7 @@ do { \
/* 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)

View File

@ -0,0 +1,161 @@
/* Definitions of target machine for GNU compiler,
for i386 NetBSD systems.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
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.
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, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* This is used on i386 platforms that use the ELF format.
This was taken from the NetBSD/alpha configuration, and modified
for NetBSD/i386 by Christos Zoulas <christos@netbsd.org> */
/* Get generic i386 definitions. */
/* This goes away when the math-emulator is fixed */
#define TARGET_CPU_DEFAULT 0400 /* TARGET_NO_FANCY_MATH_387 */
#include <i386/gstabs.h>
/* Get perform_* macros to build libgcc.a. */
#include <i386/perform.h>
/* Get generic NetBSD ELF definitions. We will override these if necessary. */
#define NETBSD_ELF
#include <netbsd.h>
#undef ASM_FINAL_SPEC
/* Names to predefine in the preprocessor for this target machine. */
#undef CPP_PREDEFINES
#define CPP_PREDEFINES "\
-Dunix -Di386 -D__NetBSD__ -D__ELF__ \
-Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)"
/* Make gcc agree with <machine/ansi.h> */
#undef SIZE_TYPE
#define SIZE_TYPE "unsigned int"
#undef PTRDIFF_TYPE
#define PTRDIFF_TYPE "int"
#undef WCHAR_TYPE
#define WCHAR_TYPE "int"
#undef WCHAR_UNSIGNED
#define WCHAR_UNSIGNED 0
#undef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE 32
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. Under NetBSD/i386, the assembler does
nothing special with -pg. */
#undef ASM_APP_ON
#define ASM_APP_ON "#APP\n"
#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"
#define bsd4_4
#undef HAS_INIT_SECTION
/* Provide a LINK_SPEC appropriate for a NetBSD/alpha ELF target. Only
the linker emulation is i386-specific. The rest are
common to all ELF targets, except for the name of the start function. */
#undef LINK_SPEC
#define LINK_SPEC \
"-m elf_i386 \
%{assert*} %{R*} \
%{shared:-shared} \
%{!shared: \
-dc -dp \
%{!nostdlib:%{!r*:%{!e*:-e __start}}} \
%{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}} \
%{static:-static}}"
#undef DEFAULT_VTABLE_THUNKS
#define DEFAULT_VTABLE_THUNKS 1
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1 << (LOG))
/* This is how we tell the assembler that two symbols have the same value. */
#define ASM_OUTPUT_DEF(FILE,NAME1,NAME2) \
do { assemble_name(FILE, NAME1); \
fputs(" = ", FILE); \
assemble_name(FILE, NAME2); \
fputc('\n', FILE); } while (0)
/*
* We always use gas here, so we don't worry about ECOFF assembler problems.
*/
#undef TARGET_GAS
#define TARGET_GAS (1)
/* The following macros are stolen from i386v4.h */
/* These have to be defined to get PIC code correct */
/* This is how to output an element of a case-vector that is relative.
This is only used for PIC code. See comments by the `casesi' insn in
i386.md for an explanation of the expression this outputs. */
#undef ASM_OUTPUT_ADDR_DIFF_ELT
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
fprintf (FILE, "\t.long _GLOBAL_OFFSET_TABLE_+[.-%s%d]\n", LPREFIX, VALUE)
/* Indicate that jump tables go in the text section. This is
necessary when compiling PIC code. */
#define JUMP_TABLES_IN_TEXT_SECTION 1
/* Default to pcc-struct-return, because this is the ELF abi and
we don't care about compatibility with older gcc versions. */
#define DEFAULT_PCC_STRUCT_RETURN 1
/* Profiling routines, partially copied from i386/osfrose.h. */
/* Redefine this to use %eax instead of %edx. */
#undef FUNCTION_PROFILER
#define FUNCTION_PROFILER(FILE, LABELNO) \
{ \
if (flag_pic) \
{ \
fprintf (FILE, "\tcall __mcount@PLT\n"); \
} \
else \
{ \
fprintf (FILE, "\tcall __mcount\n"); \
} \
}
/* Put relocations in the constant pool in the writable data section. */
#undef SELECT_RTX_SECTION
#define SELECT_RTX_SECTION(MODE,RTX) \
{ \
if (flag_pic && symbolic_operand (RTX)) \
data_section (); \
else \
readonly_data_section (); \
}

View File

@ -0,0 +1,23 @@
/* Configuration file for i386 hosts running NetBSD.
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
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.
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. */
#include <xm-netbsd.h>
#include <i386/xm-i386.h>

View File

@ -23,14 +23,14 @@
/* Under NetBSD, the normal location of the compiler back ends is the
/usr/libexec directory. */
#undef MD_EXEC_PREFIX
#define MD_EXEC_PREFIX "/usr/libexec/"
#undef STANDARD_EXEC_PREFIX
#define STANDARD_EXEC_PREFIX "/usr/libexec/"
/* Under NetBSD, the normal location of the various *crt*.o files is the
/usr/lib directory. */
#undef MD_STARTFILE_PREFIX
#define MD_STARTFILE_PREFIX "/usr/lib/"
#undef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX "/usr/lib/"
#endif
@ -65,8 +65,8 @@
#define STARTFILE_SPEC \
"%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:%{!static:crt0%O%s}%{static:scrt0%O%s}}}} %{shared:c++rt0%O%s}"
/* Provide a LINK_SPEC appropriate for NetBSD a.out. Here we provide
support for the special GCC options -static, -assert, and -nostdlib. */
/* Provide a LINK_SPEC appropriate for NetBSD. Here we provide support
for the special GCC options -static, -assert, and -nostdlib. */
#undef LINK_SPEC
#define LINK_SPEC \
@ -225,12 +225,18 @@ do { \
} \
} while (0)
#endif
#endif /* ! NETBSD_ELF */
/* ELF ports */
/* NetBSD ELF support begins here. */
#ifdef NETBSD_ELF
/* Start with generic ELF definitions. */
#include "elfos.h"
#undef DWARF_DEBUGGING_INFO /* XXX */
#undef DWARF2_DEBUGGING_INFO /* XXX */
/* Provide a STARTFILE_SPEC appropriate for NetBSD ELF targets. Here we
provide support for the special GCC option -static. On ELF targets,
we also add the crtbegin.o file which provides part of the support
@ -246,7 +252,7 @@ do { \
%{!p:crt0%O%s}}} \
%{!shared:crtbegin%O%s} %{shared:crtbeginS%O%s}"
/* Provide an ENDFILE_SPEC approrpiate for NetBSD ELF targets. Here we
/* Provide an ENDFILE_SPEC appropriate for NetBSD ELF targets. Here we
add crtend.o, which provides part of the support for getting C++
file-scope static objects deconstructed after exiting `main'. */

View File

@ -25,3 +25,8 @@ Boston, MA 02111-1307, USA. */
#undef POSIX
#define POSIX
/* Ensure we get gnu C's defaults. */
#ifdef __GNUC__
#define alloca __builtin_alloca
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1155,10 +1155,21 @@ changequote([,])dnl
tm_file=i386/freebsd.h
tmake_file=t-freebsd
;;
changequote(,)dnl
i[34567]86-*-netbsdelf* | \
i[34567]86-*-netbsd1.4[I-Z]* | \
i[34567]86-*-netbsd1.[5-9]* | \
i[34567]86-*-netbsd2*)
changequote([,])dnl
tm_file=i386/netbsd-elf.h
xm_file=i386/xm-netbsd.h
tmake_file=t-netbsd
;;
changequote(,)dnl
i[34567]86-*-netbsd*)
changequote([,])dnl
tm_file=i386/netbsd.h
xm_file=i386/xm-netbsd.h
tmake_file=t-netbsd
use_collect2=yes
;;