From 3a2c1cd8d541cf2c44073f845f0ef17190b75eef Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Sat, 3 Feb 1996 01:03:27 +0000 Subject: [PATCH] Add cygwin32; Put eabi .sdata2/.sbss2 into read-only memory From-SVN: r11162 --- gcc/config.sub | 3 +- gcc/config/i386/cygwin32.asm | 32 ++++++ gcc/config/i386/cygwin32.h | 204 ++++++++++++++++++++++++++++++++++ gcc/config/i386/t-cygwin32 | 9 ++ gcc/config/i386/x-cygwin32 | 2 + gcc/config/i386/xm-cygwin32.h | 30 +++++ gcc/config/rs6000/cygwin32.h | 64 +++++++++++ gcc/config/rs6000/eabi-ci.asm | 4 +- gcc/config/rs6000/eabi-cn.asm | 4 +- 9 files changed, 347 insertions(+), 5 deletions(-) create mode 100644 gcc/config/i386/cygwin32.asm create mode 100644 gcc/config/i386/cygwin32.h create mode 100644 gcc/config/i386/t-cygwin32 create mode 100644 gcc/config/i386/x-cygwin32 create mode 100644 gcc/config/i386/xm-cygwin32.h create mode 100644 gcc/config/rs6000/cygwin32.h diff --git a/gcc/config.sub b/gcc/config.sub index a21374bb7bf..1145e2c9ce9 100755 --- a/gcc/config.sub +++ b/gcc/config.sub @@ -653,7 +653,8 @@ case $os in | -hiux* | -386bsd* | -netbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux*) + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin32* | -pe*) # Remember, each alternative MUST END IN *, to match a version number. ;; -sunos5*) diff --git a/gcc/config/i386/cygwin32.asm b/gcc/config/i386/cygwin32.asm new file mode 100644 index 00000000000..4ac4c91a3b1 --- /dev/null +++ b/gcc/config/i386/cygwin32.asm @@ -0,0 +1,32 @@ +/* stuff needed for libgcc1 on win32. */ + +#ifdef L_chkstk + + .global ___chkstk + .global __alloca +___chkstk: +__alloca: + pushl %ecx /* save temp */ + movl %esp,%ecx /* get sp */ + addl $0x8,%ecx /* and point to return addr */ + +probe: cmpl $0x1000,%eax /* > 4k ?*/ + jb done + + subl $0x1000,%ecx /* yes, move pointer down 4k*/ + orl $0x0,(%ecx) /* probe there */ + subl $0x1000,%eax /* decrement count */ + jmp probe /* and do it again */ + +done: subl %eax,%ecx + orl $0x0,(%ecx) /* less that 4k, just peek here */ + + movl %esp,%eax + movl %ecx,%esp /* decrement stack */ + + movl (%eax),%ecx /* recover saved temp */ + movl 4(%eax),%eax /* get return address */ + jmp *%eax + + +#endif diff --git a/gcc/config/i386/cygwin32.h b/gcc/config/i386/cygwin32.h new file mode 100644 index 00000000000..9a5ed33b4db --- /dev/null +++ b/gcc/config/i386/cygwin32.h @@ -0,0 +1,204 @@ +/* Operating system specific defines to be used when targeting GCC for + hosting on Windows NT 3.x, using a unix style C library and tools. + + This is different to the winnt.h file, since that is used + to build GCC for use with a windows style library and tool + set, winnt.h uses the Microsoft tools to do that. + + Copyright (C) 1995 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. */ + + +#define YES_UNDERSCORES + +#include "i386/gas.h" + + +#ifdef CPP_PREDEFINES +#undef CPP_PREDEFINES +#endif + +#define CPP_PREDEFINES "-Di386 -D__WIN32__ \ + -DPOSIX -D__CYGWIN32__ -DWINNT -D_X86_=1 -D__STDC__=1\ + -D__stdcall=__attribute__((__stdcall__)) \ + -D__cdecl=__attribute__((__cdecl__)) \ + -Asystem(winnt) -Acpu(i386) -Amachine(i386)" + +/* We have to dynamic link to get to the system dlls, + and I've put all of libc and libm and the unix stuff into + cygwin.dll, the import library is called 'libcygwin.a' */ + +#undef LIB_SPEC +#define LIB_SPEC "-lcygwin" + +/* No need for libgcc, it's in the shared library. */ +#undef LIBGCC_SPEC +#define LIBGCC_SPEC "" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{!:crt0%O%s}" + +#define SIZE_TYPE "unsigned int" +#define PTRDIFF_TYPE "int" +#define WCHAR_UNSIGNED 1 +#define WCHAR_TYPE_SIZE 16 +#define WCHAR_TYPE "short unsigned int" +#undef LONG_DOUBLE_TYPE_SIZE +#define LONG_DOUBLE_TYPE_SIZE 64 +#define HAVE_ATEXIT 1 + +#undef EXTRA_SECTIONS +#define EXTRA_SECTIONS in_ctor, in_dtor + +#undef EXTRA_SECTION_FUNCTIONS +#define EXTRA_SECTION_FUNCTIONS \ + CTOR_SECTION_FUNCTION \ + DTOR_SECTION_FUNCTION + +#define CTOR_SECTION_FUNCTION \ +void \ +ctor_section () \ +{ \ + if (in_section != in_ctor) \ + { \ + fprintf (asm_out_file, "\t.section .ctor\n"); \ + in_section = in_ctor; \ + } \ +} + +#define DTOR_SECTION_FUNCTION \ +void \ +dtor_section () \ +{ \ + if (in_section != in_dtor) \ + { \ + fprintf (asm_out_file, "\t.section .dtor\n"); \ + in_section = in_dtor; \ + } \ +} + +#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \ + do { \ + ctor_section (); \ + fprintf (FILE, "%s\t", ASM_LONG); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \ + do { \ + dtor_section (); \ + fprintf (FILE, "%s\t", ASM_LONG); \ + assemble_name (FILE, NAME); \ + fprintf (FILE, "\n"); \ + } while (0) + +/* Define this macro if references to a symbol must be treated + differently depending on something about the variable or + function named by the symbol (such as what section it is in). + + On i386, if using PIC, mark a SYMBOL_REF for a non-global symbol + so that we may access it directly in the GOT. + + On i386 running Windows NT, modify the assembler name with a suffix + consisting of an atsign (@) followed by string of digits that represents + the number of bytes of arguments passed to the function, if it has the + attribute STDCALL. */ + +#ifdef ENCODE_SECTION_INFO +#undef ENCODE_SECTION_INFO +#define ENCODE_SECTION_INFO(DECL) \ +do \ + { \ + if (flag_pic) \ + { \ + rtx rtl = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + ? TREE_CST_RTL (DECL) : DECL_RTL (DECL)); \ + SYMBOL_REF_FLAG (XEXP (rtl, 0)) \ + = (TREE_CODE_CLASS (TREE_CODE (DECL)) != 'd' \ + || ! TREE_PUBLIC (DECL)); \ + } \ + if (TREE_CODE (DECL) == FUNCTION_DECL) \ + if (lookup_attribute ("stdcall", \ + TYPE_ATTRIBUTES (TREE_TYPE (DECL)))) \ + XEXP (DECL_RTL (DECL), 0) = \ + gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (DECL)); \ + } \ +while (0) +#endif + +/* Emit code to check the stack when allocating more that 20 + bytes in one go. */ + +#define CHECK_STACK_LIMIT 20 + + + +/* By default, target has a 80387, uses IEEE compatible arithmetic, + and returns float values in the 387 and needs stack probes */ +#undef TARGET_DEFAULT + +#define TARGET_DEFAULT \ + (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_STACK_PROBE) + +#define DBX_DEBUGGING_INFO +#define SDB_DEBUGGING_INFO +#define PREFERRED_DEBUGGING_TYPE DBX_DEBUG + + +/* 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. */ + +#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \ + fprintf (FILE, "\t.section %s\n", NAME) + +#undef ASM_OUTPUT_SOURCE_LINE +#define ASM_OUTPUT_SOURCE_LINE(file, line) \ +do \ + { \ + static int sym_lineno = 1; \ + fprintf (file, "\t.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) + +/* 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. */ + +#define DBX_OUTPUT_MAIN_SOURCE_FILE_END(FILE, FILENAME) \ + fprintf (FILE, \ + "\t.text\n\t.stabs \"\",%d,0,0,Letext\nLetext:\n", N_SO) + +/* 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 + +/* In order for relative line numbers to work, we must output the + stabs entry for the function name first. */ + +#define DBX_FUNCTION_FIRST diff --git a/gcc/config/i386/t-cygwin32 b/gcc/config/i386/t-cygwin32 new file mode 100644 index 00000000000..cc523cb0522 --- /dev/null +++ b/gcc/config/i386/t-cygwin32 @@ -0,0 +1,9 @@ +# CYGNUS LOCAL entire file +LIBGCC1 = libgcc1-asm.a +CROSS_LIBGCC1 = libgcc1-asm.a +LIB1ASMSRC = i386/cygwin32.asm +LIB1ASMFUNCS = _chkstk + +winnt.o: $(srcdir)/config/i386/winnt.c + $(CC) -I. -I$(srcdir) -I$(srcdir)/config -c $(srcdir)/config/i386/winnt.c + diff --git a/gcc/config/i386/x-cygwin32 b/gcc/config/i386/x-cygwin32 new file mode 100644 index 00000000000..b81c1514a08 --- /dev/null +++ b/gcc/config/i386/x-cygwin32 @@ -0,0 +1,2 @@ +USE_COLLECT2 = +LANGUAGES=c c++ objective-c diff --git a/gcc/config/i386/xm-cygwin32.h b/gcc/config/i386/xm-cygwin32.h new file mode 100644 index 00000000000..1ee4c47a3fd --- /dev/null +++ b/gcc/config/i386/xm-cygwin32.h @@ -0,0 +1,30 @@ +/* Configuration for GNU C-compiler for hosting on Windows NT. + using a unix style C library. + Copyright (C) 1995 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. */ + + +#define NO_STAB_H + +#include "i386/xm-i386.h" + +#define HAVE_STRERROR +#define HAVE_RUSAGE +#define HAVE_FILE_H + + diff --git a/gcc/config/rs6000/cygwin32.h b/gcc/config/rs6000/cygwin32.h new file mode 100644 index 00000000000..26e96bb7bdc --- /dev/null +++ b/gcc/config/rs6000/cygwin32.h @@ -0,0 +1,64 @@ +/* Operating system specific defines to be used when targeting GCC for + hosting on Windows NT 3.x, using the Cygnus API + + This is different to the winnt.h file, since that is used + to build GCC for use with a windows style library and tool + set, winnt.h uses the Microsoft tools to do that. + + Copyright (C) 1996 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. */ + + +/* Ugly hack */ +#include "rs6000/win-nt.h" + + +#ifdef CPP_PREDEFINES +#undef CPP_PREDEFINES +#endif + +#define CPP_PREDEFINES "-DWIN32 -D__WIN32__ -D__WINNT__ \ + -D__CYGWIN32__ -DPOSIX \ + -D_POWER -DPPC -Asystem(winnt) -Acpu(powerpc) -Amachine(powerpc)" + +/* We have to dynamic link to get to the system dlls, + and I've put all of libc and libm and the unix stuff into + cygwin.dll, the import library is called 'libcygwin.a' */ + +#undef LIB_SPEC +#define LIB_SPEC "-lcygwin" + + +#undef LINK_SPEC +#define LINK_SPEC "%{V} %{v:%{!V:-V}}" + + +/* No need for libgcc, it's in the shared library. */ +#undef LIBGCC_SPEC +#define LIBGCC_SPEC "" + +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "%{!:crt0%O%s}" + +#define PTRDIFF_TYPE "int" +#define WCHAR_UNSIGNED 1 +#define WCHAR_TYPE_SIZE 16 +#define WCHAR_TYPE "short unsigned int" + +/* XXX set up stack probing */ diff --git a/gcc/config/rs6000/eabi-ci.asm b/gcc/config/rs6000/eabi-ci.asm index 175bff6edff..62008231b60 100644 --- a/gcc/config/rs6000/eabi-ci.asm +++ b/gcc/config/rs6000/eabi-ci.asm @@ -85,7 +85,7 @@ _SDA_BASE_: .type __SBSS_START__,@object __SBSS_START__: - .section ".sdata2","aw" + .section ".sdata2","a" .weak _SDA2_BASE_ .type _SDA2_BASE_,@object .globl __SDATA2_START__ @@ -93,7 +93,7 @@ __SBSS_START__: __SDATA2_START__: _SDA2_BASE_: - .section ".sbss2","aw" + .section ".sbss2","a",@nobits .globl __SBSS2_START__ .type __SBSS2_START__,@object __SBSS2_START__: diff --git a/gcc/config/rs6000/eabi-cn.asm b/gcc/config/rs6000/eabi-cn.asm index 09012dbbc02..fdcfb62ae2d 100644 --- a/gcc/config/rs6000/eabi-cn.asm +++ b/gcc/config/rs6000/eabi-cn.asm @@ -79,12 +79,12 @@ __SDATA_END__: .type __SBSS_END__,@object __SBSS_END__: - .section ".sdata2","aw" + .section ".sdata2","a" .globl __SDATA2_END__ .type __SDATA2_END__,@object __SDATA2_END__: - .section ".sbss2","aw" + .section ".sbss2","a" .globl __SBSS2_END__ .type __SBSS2_END__,@object __SBSS2_END__: -- 2.30.2