Initial revision
From-SVN: r8187
This commit is contained in:
parent
3f6d0a8c2e
commit
9086a9bc1c
66
gcc/config/i386/config-nt.sed
Normal file
66
gcc/config/i386/config-nt.sed
Normal file
@ -0,0 +1,66 @@
|
||||
#/\.o[ ]*:/ s/config.status//
|
||||
/^multilib.h/ s/multilib/not-multilib/
|
||||
/^target=/ c\
|
||||
target=winnt3.1
|
||||
/^xmake_file=/ d
|
||||
/^tmake_file=/ d
|
||||
/^version=/ c\
|
||||
version=2.6.0
|
||||
s/CC = cc/CC = gcc/
|
||||
s/:\$/: \$/g
|
||||
s/<\ *\$(srcdir)\//< $(srcdir)\\/g
|
||||
s/^ \$(srcdir)\/move-if-change/ copy/
|
||||
s/^USE_/# USE_/
|
||||
s/`echo \$(srcdir)\///g
|
||||
s/ | sed 's,\^\\\.\/,,'`//g
|
||||
s/^ cd \$(srcdir)[ ]*;/ /
|
||||
/^# USE_HOST_OBSTACK/ i\
|
||||
USE_HOST_OBSTACK=obstack.o
|
||||
/^stamp-attrtab/,/copy/ {
|
||||
/\\/d
|
||||
/fi/d
|
||||
/copy/ i\
|
||||
genattrtab md > tmp-attrtab.c
|
||||
}
|
||||
/^enquire[ ]*:/ s/\$(GCC_PARTS)//g
|
||||
/^enquire.o[ ]*:/ s/\$(GCC_PASSES)//g
|
||||
/^GCC_FOR_TARGET =/ c\
|
||||
GCC_FOR_TARGET = gcc
|
||||
s/; *@true//
|
||||
/^OBJS.*stamp-objlist/ s?`cat ../stamp-objlist`?@../stamp-objlist?
|
||||
s/^\(SUBDIR_OBSTACK *=\).*$/\1 ..\/obstack.o/
|
||||
s/^\(SUBDIR_USE_ALLOCA *=\).*$/\1/
|
||||
s/^\(SUBDIR_MALLOC *=\).*$/\1/
|
||||
/####target/ r config/winnt/t-winnt
|
||||
/####host/ r config/winnt/x-winnt
|
||||
s/^C c:/# C c:/
|
||||
s/\${OBJS}/\$(OBJS)/g
|
||||
s/\${SYSTEM_HEADER_DIR}/\$(SYSTEM_HEADER_DIR)/g
|
||||
s/\${HOST_CC}/\$(HOST_CC)/g
|
||||
s/ \${srcdir}\// /g
|
||||
s/\${mainversion}/\$(mainversion)/g
|
||||
s/\ $(srcdir)\/move-if-change$//
|
||||
s/\$(srcdir)\/move-if-change/mv/g
|
||||
/^# USE_HOST_OBSTACK/ i\
|
||||
USE_HOST_OBSTACK=obstack.o
|
||||
s/ \.\// /
|
||||
s/^bi-\([a-z]*\) *:/bi-\1.exe :/
|
||||
s/ bi-\([a-z]*\)$/ bi-\1.exe/
|
||||
s/ bi-\([a-z]*\) / bi-\1.exe /g
|
||||
s/^gen\([a-z]*\) *:/gen\1.exe :/
|
||||
s/ gen\([a-z]*\)$/ gen\1.exe/
|
||||
s/ gen\([a-z]*\) / gen\1.exe /g
|
||||
s/genmultilib.exe/genmultilib/g
|
||||
s/^cccp *:/cccp.exe :/
|
||||
s/cccp$/cccp.exe/
|
||||
s/cccp /cccp.exe /
|
||||
s/^cc1 *:/cc1.exe :/
|
||||
s/cc1$/cc1.exe/
|
||||
s/cc1 /cc1.exe /
|
||||
s/^xgcc *:/xgcc.exe :/
|
||||
s/xgcc$/xgcc.exe/
|
||||
s/xgcc /xgcc.exe /
|
||||
s/^ld *:/ld.exe :/
|
||||
s/ld$/ld.exe/
|
||||
s/ld /ld.exe /
|
||||
s/^\//
|
79
gcc/config/i386/win-nt.h
Normal file
79
gcc/config/i386/win-nt.h
Normal file
@ -0,0 +1,79 @@
|
||||
/* Definitions of target machine for GNU compiler
|
||||
for an Intel i386 or later processor running Windows NT 3.x.
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
Contributed by Douglas B. Rupp (drupp@cs.washington.edu)
|
||||
|
||||
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 YES_UNDERSCORES
|
||||
|
||||
#include "i386/gas.h"
|
||||
#include "winnt/winnt.h"
|
||||
|
||||
#undef CPP_PREDEFINES
|
||||
#define CPP_PREDEFINES "-Dunix -Di386 -DWINNT -D_M_IX86 -D_X86_ -D__STDC__=0 \
|
||||
-DALMOST_STDC -Asystem(unix) -Asystem(winnt) -Acpu(i386) -Amachine(i386)"
|
||||
|
||||
#undef EXTRA_SECTIONS
|
||||
#define EXTRA_SECTIONS in_ctor, in_dtor
|
||||
|
||||
#undef EXTRA_SECTION_FUNCTIONS
|
||||
#define EXTRA_SECTION_FUNCTIONS \
|
||||
CTOR_SECTION_FUNCTION \
|
||||
DTOR_SECTION_FUNCTION
|
||||
|
||||
#undef CTOR_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; \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef DTOR_SECTION_FUNCTION
|
||||
#define DTOR_SECTION_FUNCTION \
|
||||
void \
|
||||
dtor_section () \
|
||||
{ \
|
||||
if (in_section != in_dtor) \
|
||||
{ \
|
||||
fprintf (asm_out_file, "\t.section .dtor\n"); \
|
||||
in_section = in_dtor; \
|
||||
} \
|
||||
}
|
||||
|
||||
#undef ASM_OUTPUT_CONSTRUCTOR
|
||||
#define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
ctor_section (); \
|
||||
fprintf (FILE, "%s\t", ASM_LONG); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
||||
|
||||
#undef ASM_OUTPUT_DESTRUCTOR
|
||||
#define ASM_OUTPUT_DESTRUCTOR(FILE,NAME) \
|
||||
do { \
|
||||
dtor_section (); \
|
||||
fprintf (FILE, "%s\t", ASM_LONG); \
|
||||
assemble_name (FILE, NAME); \
|
||||
fprintf (FILE, "\n"); \
|
||||
} while (0)
|
259
gcc/config/winnt/ld.c
Normal file
259
gcc/config/winnt/ld.c
Normal file
@ -0,0 +1,259 @@
|
||||
/* Call Windows NT 3.x linker.
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
|
||||
|
||||
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. */
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <process.h>
|
||||
|
||||
/* These can be set by command line arguments */
|
||||
char *linker_path = 0;
|
||||
int verbose = 0;
|
||||
|
||||
int link_arg_max = -1;
|
||||
char **link_args = (char **) 0;
|
||||
int link_arg_index = -1;
|
||||
|
||||
char *search_dirs = ".";
|
||||
|
||||
static int is_regular_file (char *name);
|
||||
|
||||
static void
|
||||
addarg (str)
|
||||
char *str;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (++link_arg_index >= link_arg_max)
|
||||
{
|
||||
char **new_link_args
|
||||
= (char **) calloc (link_arg_max + 1000, sizeof (char *));
|
||||
|
||||
for (i = 0; i <= link_arg_max; i++)
|
||||
new_link_args [i] = link_args [i];
|
||||
|
||||
if (link_args)
|
||||
free (link_args);
|
||||
|
||||
link_arg_max += 1000;
|
||||
link_args = new_link_args;
|
||||
}
|
||||
|
||||
link_args [link_arg_index] = str;
|
||||
}
|
||||
|
||||
static char *
|
||||
locate_file (file_name, path_val)
|
||||
char *file_name;
|
||||
char *path_val;
|
||||
{
|
||||
char buf [1000];
|
||||
int file_len = strlen (file_name);
|
||||
char *end_path = path_val + strlen (path_val);
|
||||
char *ptr;
|
||||
|
||||
/* Handle absolute pathnames */
|
||||
if (file_name [0] == '/' || file_name [0] == DIR_SEPARATOR
|
||||
|| isalpha (file_name [0]) && file_name [1] == ':')
|
||||
{
|
||||
strncpy (buf, file_name, sizeof buf);
|
||||
buf[sizeof buf - 1] = '\0';
|
||||
if (is_regular_file (buf))
|
||||
return strdup (buf);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! path_val)
|
||||
return 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
for (; *path_val == PATH_SEPARATOR ; path_val++)
|
||||
;
|
||||
if (! *path_val)
|
||||
return 0;
|
||||
|
||||
for (ptr = buf; *path_val && *path_val != PATH_SEPARATOR; )
|
||||
*ptr++ = *path_val++;
|
||||
|
||||
ptr--;
|
||||
if (*ptr != '/' && *ptr != DIR_SEPARATOR)
|
||||
*++ptr = DIR_SEPARATOR;
|
||||
|
||||
strcpy (++ptr, file_name);
|
||||
|
||||
if (is_regular_file (buf))
|
||||
return strdup (buf);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *
|
||||
expand_lib (name)
|
||||
char *name;
|
||||
{
|
||||
char *lib, *lib_path;
|
||||
|
||||
lib = malloc (strlen (name) + 5);
|
||||
strcpy (lib, "lib");
|
||||
strcat (lib, name);
|
||||
strcat (lib, ".a");
|
||||
lib_path = locate_file (lib, search_dirs);
|
||||
if (!lib_path)
|
||||
{
|
||||
fprintf (stderr, "Couldn't locate library: %s\n", lib);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
return lib_path;
|
||||
}
|
||||
|
||||
static int
|
||||
is_regular_file (name)
|
||||
char *name;
|
||||
{
|
||||
int ret;
|
||||
struct stat statbuf;
|
||||
|
||||
ret = stat(name, &statbuf);
|
||||
return !ret && S_ISREG (statbuf.st_mode);
|
||||
}
|
||||
|
||||
static void
|
||||
process_args (p_argc, argv)
|
||||
int *p_argc;
|
||||
char *argv[];
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 1; i < *p_argc; i++)
|
||||
{
|
||||
/* -v turns on verbose option here and is passed on to gcc */
|
||||
if (! strcmp (argv [i], "-v"))
|
||||
verbose = 1;
|
||||
}
|
||||
}
|
||||
|
||||
main (argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int i;
|
||||
int done_an_ali = 0;
|
||||
int file_name_index;
|
||||
char *pathval = getenv ("PATH");
|
||||
char *spawn_args [5];
|
||||
char *tmppathval = malloc (strlen (pathval) + 3);
|
||||
|
||||
strcpy (tmppathval, ".;");
|
||||
pathval = strcat (tmppathval, pathval);
|
||||
|
||||
process_args (&argc , argv);
|
||||
|
||||
linker_path = locate_file ("link32.exe", pathval);
|
||||
if (!linker_path)
|
||||
{
|
||||
linker_path = locate_file ("link.exe", pathval);
|
||||
if (!linker_path)
|
||||
{
|
||||
fprintf (stderr, "Couldn't locate link32 or link\n");
|
||||
exit (1);
|
||||
}
|
||||
}
|
||||
|
||||
addarg (linker_path);
|
||||
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
int arg_len = strlen (argv [i]);
|
||||
|
||||
if (!strcmp (argv [i], "-o"))
|
||||
{
|
||||
char *buff, *ptr;
|
||||
int out_len;
|
||||
|
||||
i++;
|
||||
out_len = strlen (argv[i]) + 9;
|
||||
buff = malloc (out_len);
|
||||
strcpy (buff, "-out:");
|
||||
strcat (buff, argv[i]);
|
||||
ptr = strstr (buff, ".exe");
|
||||
if (ptr == NULL || strlen (ptr) != 4)
|
||||
strcat (buff, ".exe");
|
||||
addarg (buff);
|
||||
}
|
||||
else if (arg_len > 2 && !strncmp (argv [i], "-L", 2))
|
||||
{
|
||||
char *nbuff, *sdbuff;
|
||||
int j, new_len, search_dirs_len;
|
||||
|
||||
new_len = strlen (&argv[i][2]);
|
||||
search_dirs_len = strlen (search_dirs);
|
||||
|
||||
nbuff = malloc (new_len);
|
||||
strcpy (nbuff, &argv[i][2]);
|
||||
|
||||
for (j = 0; j < new_len; j++)
|
||||
if (nbuff[j] == '/') nbuff[j] = DIR_SEPARATOR;
|
||||
|
||||
sdbuff = malloc (search_dirs_len + new_len + 1);
|
||||
strcpy (sdbuff, search_dirs);
|
||||
sdbuff[search_dirs_len] = PATH_SEPARATOR;
|
||||
sdbuff[search_dirs_len+1] = 0;
|
||||
strcat (sdbuff, nbuff);
|
||||
|
||||
if (search_dirs)
|
||||
free (search_dirs);
|
||||
|
||||
search_dirs = sdbuff;
|
||||
}
|
||||
|
||||
else if (arg_len > 2 && !strncmp (argv [i], "-l", 2))
|
||||
addarg (expand_lib (&argv[i][2]));
|
||||
else if (!strcmp (argv [i], "-v"))
|
||||
;
|
||||
else
|
||||
addarg (argv [i]);
|
||||
}
|
||||
|
||||
addarg (NULL);
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < link_arg_index; i++)
|
||||
printf ("%s ", link_args [i]);
|
||||
putchar ('\n');
|
||||
}
|
||||
|
||||
if (spawnvp (P_WAIT, linker_path, (const char * const *)link_args) != 0)
|
||||
{
|
||||
fprintf (stderr, "Error executing %s\n", link_args[0]);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
66
gcc/config/winnt/win-nt.h
Normal file
66
gcc/config/winnt/win-nt.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* winnt.h -- operating system specific defines to be used when
|
||||
targeting GCC for Windows NT 3.x.
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
Contributed by Douglas B. Rupp (drupp@cs.washington.edu).
|
||||
|
||||
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.
|
||||
|
||||
To use this file, put in your tm.h file something like:
|
||||
|
||||
#include "?????.h"
|
||||
#include "svr4.h"
|
||||
|
||||
followed by any really system-specific defines (or overrides of
|
||||
defines) which you find that you need. For example, CPP_PREDEFINES
|
||||
is defined here with only the defined -Dunix and -DSVR4. You should
|
||||
probably override that in your target-specific ?????svr4.h file
|
||||
with a set of defines that includes these, but also contains an
|
||||
appropriate define for the type of hardware that you are targeting. */
|
||||
|
||||
#undef LIB_SPEC
|
||||
#define LIB_SPEC "libc.lib kernel32.lib"
|
||||
|
||||
#undef STARTFILE_SPEC
|
||||
#define STARTFILE_SPEC ""
|
||||
|
||||
#undef LINK_SPEC
|
||||
#define LINK_SPEC "-align:0x1000 -subsystem:console -entry:mainCRTStartup \
|
||||
-stack:1000000,1000000"
|
||||
|
||||
#undef STANDARD_EXEC_PREFIX
|
||||
#define STANDARD_EXEC_PREFIX ""
|
||||
|
||||
#undef STANDARD_STARTFILE_PREFIX
|
||||
#define STANDARD_STARTFILE_PREFIX ""
|
||||
|
||||
#undef TOOLDIR_BASE_PREFIX
|
||||
#define TOOLDIR_BASE_PREFIX ""
|
||||
|
||||
#ifdef STANDARD_INCLUDE_DIR
|
||||
#undef STANDARD_INCLUDE_DIR
|
||||
#endif
|
||||
#define STANDARD_INCLUDE_DIR ""
|
||||
|
||||
#undef LOCAL_INCLUDE_DIR
|
||||
#define LOCAL_INCLUDE_DIR ""
|
||||
|
||||
#undef INCLUDE_DEFAULTS
|
||||
#define INCLUDE_DEFAULTS \
|
||||
{ \
|
||||
{ 0, 0, 0 } \
|
||||
}
|
||||
|
59
gcc/config/winnt/xm-winnt.h
Normal file
59
gcc/config/winnt/xm-winnt.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* Configuration for GNU compiler
|
||||
for processor running Windows NT 3.x.
|
||||
Copyright (C) 1994 Free Software Foundation, Inc.
|
||||
Contributed by Douglas B. Rupp (drupp@cs.washington.edu)
|
||||
|
||||
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. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#define USG
|
||||
#define ONLY_INT_FIELDS
|
||||
#define USE_PROTOTYPES 1
|
||||
#define bcmp(a,b,c) memcmp (a,b,c)
|
||||
#define bcopy(a,b,c) memcpy (b,a,c)
|
||||
#define bzero(a,b) memset (a,0,b)
|
||||
#define index strchr
|
||||
#define rindex strrchr
|
||||
#define kill(a,b) raise(b)
|
||||
|
||||
#define EXECUTABLE_SUFFIX ".exe"
|
||||
#define PATH_SEPARATOR ';'
|
||||
#define DIR_SEPARATOR '\\'
|
||||
#define HAVE_PUTENV 1
|
||||
|
||||
#define S_IRUSR 0000400
|
||||
#define S_IWUSR 0000200
|
||||
#define S_IXUSR 0000100
|
||||
#define S_IRGRP 0000040
|
||||
#define S_IWGRP 0000020
|
||||
#define S_IXGRP 0000010
|
||||
#define S_IROTH 0000004
|
||||
#define S_IWOTH 0000002
|
||||
#define S_IXOTH 0000001
|
||||
#define S_IRWXU S_IRUSR | S_IWUSR | S_IXUSR
|
||||
#define S_ISREG(m) (((m)&S_IFMT) == S_IFREG)
|
||||
#define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
|
||||
|
||||
#define access _access
|
||||
#define close _close
|
||||
#define dup _dup
|
||||
#define mktemp _mktemp
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define write _write
|
||||
#define chmod _chmod
|
||||
#define setjmp _setjmp
|
Loading…
Reference in New Issue
Block a user