Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/gnu/dist/toolchain/gcc/config/i386 Update i386 support; nati...



details:   https://anonhg.NetBSD.org/src/rev/31606802e43f
branches:  trunk
changeset: 510476:31606802e43f
user:      tv <tv%NetBSD.org@localhost>
date:      Wed May 30 09:05:09 2001 +0000

description:
Update i386 support; native and cross now works properly with an i386 target.

diffstat:

 gnu/dist/toolchain/gcc/config/i386/netbsd-elf.h |  518 +++++++++++++++++++++++-
 gnu/dist/toolchain/gcc/config/i386/xm-netbsd.h  |   23 -
 2 files changed, 510 insertions(+), 31 deletions(-)

diffs (truncated from 605 to 300 lines):

diff -r 98eefab406d3 -r 31606802e43f gnu/dist/toolchain/gcc/config/i386/netbsd-elf.h
--- a/gnu/dist/toolchain/gcc/config/i386/netbsd-elf.h   Wed May 30 09:04:13 2001 +0000
+++ b/gnu/dist/toolchain/gcc/config/i386/netbsd-elf.h   Wed May 30 09:05:09 2001 +0000
@@ -24,29 +24,109 @@
 
 /* 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>
 
-/* Start with generic ELF definitions. */
-#include "elfos.h"
-
 /* Get generic NetBSD ELF definitions.  We will override these if necessary. */
 
 #define NETBSD_ELF
 #include <netbsd.h>
 
+#define OBJECT_FORMAT_ELF
+
+/* This goes away when the math-emulator is fixed */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT \
+  (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
+
+/*
+ * DBX stabs definitions. Same as Solaris and other i386 ELF platforms.
+ */
+
+#undef DBX_CONTIN_CHAR
+#define DBX_CONTIN_CHAR '?'
+
+/* When generating stabs debugging, use N_BINCL entries.  */
+
+#define DBX_USE_BINCL
+
+/* Make LBRAC and RBRAC addresses relative to the start of the
+   function.  The native Solaris stabs debugging format works this
+   way, gdb expects it, and it reduces the number of relocation
+   entries.  */
+
+#define DBX_BLOCKS_FUNCTION_RELATIVE 1
+
+/* When using stabs, gcc2_compiled must be a stabs entry, not an
+   ordinary symbol, or gdb won't see it.  Furthermore, since gdb reads
+   the input piecemeal, starting with each N_SO, it's a lot easier if
+   the gcc2 flag symbol is *after* the N_SO rather than before it.  So
+   we emit an N_OPT stab there.  */
+
+#define ASM_IDENTIFY_GCC(FILE)                                         \
+do                                                                     \
+  {                                                                    \
+    if (write_symbols != DBX_DEBUG)                                    \
+      fputs ("gcc2_compiled.:\n", FILE);                               \
+  }                                                                    \
+while (0)
+
+#define ASM_IDENTIFY_GCC_AFTER_SOURCE(FILE)                            \
+do                                                                     \
+  {                                                                    \
+    if (write_symbols == DBX_DEBUG)                                    \
+      fputs ("\t.stabs\t\"gcc2_compiled.\", 0x3c, 0, 0, 0\n", FILE);   \
+  }                                                                    \
+while (0)
+
+/* Like block addresses, stabs line numbers are relative to the
+   current function.  */
+
+#define ASM_OUTPUT_SOURCE_LINE(file, line)                             \
+do                                                                     \
+  {                                                                    \
+    static int sym_lineno = 1;                                         \
+    fprintf (file, ".stabn 68,0,%d,.LM%d-",                            \
+            line, sym_lineno);                                         \
+    assemble_name (file,                                               \
+                  XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\
+    fprintf (file, "\n.LM%d:\n", sym_lineno);                          \
+    sym_lineno += 1;                                                   \
+  }                                                                    \
+while (0)
+
+/* In order for relative line numbers to work, we must output the
+   stabs entry for the function name first.  */
+
+#define DBX_FUNCTION_FIRST
+
+/* Generate a blank trailing N_SO to mark the end of the .o file, since
+   we can't depend upon the linker to mark .o file boundaries with
+   embedded stabs.  (XXX do we need this?) */
+
+#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME)                        \
+do                                                                     \
+  {                                                                    \
+    text_section ();                                                   \
+    fprintf (FILE,                                                     \
+           "\t.stabs \"\",%d,0,0,.Letext\n.Letext:\n", N_SO);          \
+  }                                                                    \
+while (0)
+
+
 #undef ASM_FINAL_SPEC
 
-/* Names to predefine in the preprocessor for this target machine. */
+/* Names to predefine in the preprocessor for this target machine.
+   XXX NetBSD, by convention, shouldn't do __alpha, but lots of applications
+   expect it because that's what OSF/1 does. */
+
+/* NetBSD Extension to GNU C: __KPRINTF_ATTRIBUTE__ */
 
 #undef CPP_PREDEFINES
 #define CPP_PREDEFINES "\
--Dunix -Di386 -D__NetBSD__ -D__ELF__ \
+-Di386 -D__NetBSD__ -D__ELF__ -D__KPRINTF_ATTRIBUTE__ \
 -Asystem(unix) -Asystem(NetBSD) -Acpu(i386) -Amachine(i386)"
 
 /* Make gcc agree with <machine/ansi.h> */
@@ -79,6 +159,13 @@
 #define bsd4_4
 #undef HAS_INIT_SECTION
 
+#undef ASM_FILE_START
+#define ASM_FILE_START(FILE)                                   \
+{                                                              \
+  output_file_directive (FILE, main_input_filename);           \
+  fprintf (FILE, "\t.version\t\"01.01\"\n");                   \
+}
+
 /* 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. */
@@ -99,10 +186,377 @@
 #undef DEFAULT_VTABLE_THUNKS
 #define DEFAULT_VTABLE_THUNKS 1
 
+/* Attach a special .ident directive to the end of the file to identify
+   the version of GCC which compiled this code.  The format of the
+   .ident string is patterned after the ones produced by native svr4
+   C compilers.  */
+
+/* Output #ident as a .ident.  */
+
+/* This is how to allocate empty space in some section.  The .zero
+   pseudo-op is used for this on most svr4 assemblers.  */
+#undef SKIP_ASM_OP
+#define SKIP_ASM_OP    "\t.zero"
+
+#undef ASM_OUTPUT_SKIP
+#define ASM_OUTPUT_SKIP(FILE,SIZE) \
+  fprintf (FILE, "\t%s\t%u\n", SKIP_ASM_OP, (SIZE))
+
+/* Output the label which precedes a jumptable.  Note that for all svr4
+   systems where we actually generate jumptables (which is to say every
+   svr4 target except i386, where we use casesi instead) we put the jump-
+   tables into the .rodata section and since other stuff could have been
+   put into the .rodata section prior to any given jumptable, we have to
+   make sure that the location counter for the .rodata section gets pro-
+   perly re-aligned prior to the actual beginning of the jump table.  */
+
+#define ALIGN_ASM_OP ".align"
+
+#ifndef ASM_OUTPUT_BEFORE_CASE_LABEL
+#define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE,PREFIX,NUM,TABLE) \
+  ASM_OUTPUT_ALIGN ((FILE), 2);
+#endif
+
+#undef ASM_OUTPUT_CASE_LABEL
+#define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE)               \
+  do {                                                                 \
+    ASM_OUTPUT_BEFORE_CASE_LABEL (FILE, PREFIX, NUM, JUMPTABLE)                \
+    ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM);                     \
+  } while (0)
+
+/* The standard SVR4 assembler seems to require that certain builtin
+   library routines (e.g. .udiv) be explicitly declared as .globl
+   in each assembly file where they are referenced.  */
+
+#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, FUN)                         \
+  ASM_GLOBALIZE_LABEL (FILE, XSTR (FUN, 0))
+
+/* This says how to output assembler code to declare an
+   uninitialized external linkage data object.  Under SVR4,
+   the linker seems to want the alignment of data objects
+   to depend on their types.  We do exactly that here.  */
+
+#define COMMON_ASM_OP  ".comm"
+
 #undef ASM_OUTPUT_ALIGN
 #define ASM_OUTPUT_ALIGN(FILE,LOG) \
   if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", 1 << (LOG))
 
+#undef ASM_OUTPUT_ALIGNED_COMMON
+#define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN)             \
+do {                                                                   \
+  fprintf ((FILE), "\t%s\t", COMMON_ASM_OP);                           \
+  assemble_name ((FILE), (NAME));                                      \
+  fprintf ((FILE), ",%u,%u\n", (SIZE), (ALIGN) / BITS_PER_UNIT);       \
+} while (0)
+
+/* This says how to output assembler code to declare an
+   uninitialized internal linkage data object.  Under SVR4,
+   the linker seems to want the alignment of data objects
+   to depend on their types.  We do exactly that here.  */
+
+#define LOCAL_ASM_OP   ".local"
+
+#undef ASM_OUTPUT_ALIGNED_LOCAL
+#define ASM_OUTPUT_ALIGNED_LOCAL(FILE, NAME, SIZE, ALIGN)              \
+do {                                                                   \
+  fprintf ((FILE), "\t%s\t", LOCAL_ASM_OP);                            \
+  assemble_name ((FILE), (NAME));                                      \
+  fprintf ((FILE), "\n");                                              \
+  ASM_OUTPUT_ALIGNED_COMMON (FILE, NAME, SIZE, ALIGN);                 \
+} while (0)
+
+/* This is the pseudo-op used to generate a 32-bit word of data with a
+   specific value in some section.  */
+
+#define INT_ASM_OP             ".long"
+
+/* This is the pseudo-op used to generate a contiguous sequence of byte
+   values from a double-quoted string WITHOUT HAVING A TERMINATING NUL
+   AUTOMATICALLY APPENDED.  This is the same for most svr4 assemblers.  */
+
+#undef ASCII_DATA_ASM_OP
+#define ASCII_DATA_ASM_OP      ".ascii"
+
+/* Support const sections and the ctors and dtors sections for g++.
+   Note that there appears to be two different ways to support const
+   sections at the moment.  You can either #define the symbol
+   READONLY_DATA_SECTION (giving it some code which switches to the
+   readonly data section) or else you can #define the symbols
+   EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS, SELECT_SECTION, and
+   SELECT_RTX_SECTION.  We do both here just to be on the safe side.  */
+
+#define USE_CONST_SECTION      1
+
+#define CONST_SECTION_ASM_OP   ".section\t.rodata"
+
+/* Define the pseudo-ops used to switch to the .ctors and .dtors sections.
+
+   Note that we want to give these sections the SHF_WRITE attribute
+   because these sections will actually contain data (i.e. tables of
+   addresses of functions in the current root executable or shared library
+   file) and, in the case of a shared library, the relocatable addresses
+   will have to be properly resolved/relocated (and then written into) by
+   the dynamic linker when it actually attaches the given shared library
+   to the executing process.  (Note that on SVR4, you may wish to use the
+   `-z text' option to the ELF linker, when building a shared library, as
+   an additional check that you are doing everything right.  But if you do
+   use the `-z text' option when building a shared library, you will get
+   errors unless the .ctors and .dtors sections are marked as writable
+   via the SHF_WRITE attribute.)  */
+
+#define CTORS_SECTION_ASM_OP   ".section\t.ctors,\"aw\""
+#define DTORS_SECTION_ASM_OP   ".section\t.dtors,\"aw\""
+
+/* On svr4, we *do* have support for the .init and .fini sections, and we
+   can put stuff in there to be executed before and after `main'.  We let
+   crtstuff.c and other files know this by defining the following symbols.
+   The definitions say how to change sections to the .init and .fini
+   sections.  This is the same for all known svr4 assemblers.  */
+
+#define INIT_SECTION_ASM_OP    ".section\t.init"
+#define FINI_SECTION_ASM_OP    ".section\t.fini"
+
+/* A default list of other sections which we might be "in" at any given
+   time.  For targets that use additional sections (e.g. .tdesc) you
+   should override this definition in the target-specific file which
+   includes this file.  */
+
+#undef EXTRA_SECTIONS
+#define EXTRA_SECTIONS in_const, in_ctors, in_dtors
+
+/* A default list of extra section function definitions.  For targets
+   that use additional sections (e.g. .tdesc) you should override this
+   definition in the target-specific file which includes this file.  */
+
+#undef EXTRA_SECTION_FUNCTIONS
+#define EXTRA_SECTION_FUNCTIONS                                                \
+  CONST_SECTION_FUNCTION                                               \
+  CTORS_SECTION_FUNCTION                                               \
+  DTORS_SECTION_FUNCTION
+
+#undef READONLY_DATA_SECTION
+#define READONLY_DATA_SECTION() const_section ()
+
+extern void text_section ();
+
+#define CONST_SECTION_FUNCTION                                         \
+void                                                                   \
+const_section ()                                                       \
+{                                                                      \
+  if (!USE_CONST_SECTION)                                              \
+    text_section();                                                    \
+  else if (in_section != in_const)                                     \



Home | Main Index | Thread Index | Old Index