1
0
mirror of https://github.com/cahirwpz/amigaos-cross-toolchain synced 2025-11-24 04:31:31 +00:00

GCC 2.95.3 patches cleanup.

- Remove AmigaOS host specific patches.
 - Remove support for ixemul dynamic libraries.
This commit is contained in:
Krystian Bacławski
2014-01-03 18:16:07 +01:00
parent 246d04615d
commit dce8c7070a
16 changed files with 2 additions and 1200 deletions

View File

@ -31,19 +31,6 @@
# Set this to `collect2' to enable use of collect2.
USE_COLLECT2 = @will_use_collect2@
# If we might be using collect2, then this variable will be set to
@@ -403,6 +418,12 @@
# so don't override it here.
USE_COLLECT2 = collect2$(exeext)
+### begin-GG-local: dynamic libraries
+# List of extra object files that should be compiled and linked with
+# collect2.
+EXTRA_COLLECT2_OBJS =
+### end-GG-local
+
# List of extra C and assembler files to add to libgcc1.a.
# Assembler files should have names ending in `.asm'.
LIB1FUNCS_EXTRA =
@@ -516,6 +537,11 @@
# "t" or nothing, for building multilibbed versions of, say, crtbegin.o.
T =

View File

@ -1,346 +0,0 @@
/* GG-local whole file: dynamic libraries */
/* Supplimentary functions that get compiled and linked to collect2 for
AmigaOS target.
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. */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
/* From collect2.c: */
void maybe_unlink (char *);
char *xmalloc (unsigned);
void fatal_perror (char *, ...);
void fork_execute (char *, char **);
void fatal (char *, ...);
extern char *c_file_name;
extern int debug;
/* Names of temporary files we create. */
#define XLIBS_C_NAME "xlibs.c"
#define XLIBS_O_NAME "xlibs.o"
#define SHARED_X_NAME "shared.x"
/* Suffix which is prepended to "-l" options for dynamic libraries. */
#define DYNAMIC_LIB_SUFFIX "_ixlibrary"
/* Structure that holds library names. */
struct liblist
{
struct liblist *next;
char *name;
char *cname;
};
/* Not zero if "-static" was specified on GCC command line or if all the
libraries are static. */
static int flag_static = 0;
/* Not zero if linking a base relative executable. This is recognized by
presence of "-m amiga_bss" on the linker's commandline. */
static int flag_baserel = 0;
/* Not zero if some of the specified libraries are dynamic. */
static int found_dynamic_libs = 0;
/* List of linker libraries. */
struct liblist *head = NULL;
/* Return 1 if collect2 should do something more apart from tlink. We want it
to call "postlink" and "strip" if linking with dynamic libraries. */
int
amigaos_do_collecting (void)
{
return !flag_static;
}
/* Check for presence of "-static" on the GCC command line. We should not do
collecting if this flag was specified. */
void
amigaos_gccopts_hook (char *arg)
{
if (strncmp (arg, "-static", strlen ("-static")) == 0)
flag_static = 1;
}
/* Replace unprintable characters with underscores. Used by "add_lib()". */
static void
safename (char *p)
{
if (!isalpha (*p))
*p = '_';
p++;
while (*p)
{
if (!isalnum (*p))
*p = '_';
p++;
}
}
/* Add a library to the list of dynamic libraries. First make sure that the
library is actually dynamic. Used by "amigaos_libname_hook()". */
static void
add_lib (char *name)
{
struct liblist *lib;
static char buf[256];
for (lib = head; lib; lib = lib->next)
if (!strcmp (lib->name, name))
return;
/* A2IXDIR_PREFIX is passed by "make". */
sprintf (buf, A2IXDIR_PREFIX "/ldscripts/%s.x", name);
if (access (buf, R_OK))
return;
lib = (struct liblist *) xmalloc (sizeof (struct liblist));
lib->name = strdup (name);
lib->cname = strdup (name);
safename (lib->cname);
lib->next = head;
head = lib;
if (debug)
fprintf (stderr, "found dynamic library, name: %s, cname: %s\n",
lib->name, lib->cname);
found_dynamic_libs = 1;
}
/* Check if the argument is a linker library. Call "add_lib()" if yes. */
void
amigaos_libname_hook (char *arg)
{
int len = strlen (arg);
if (flag_static)
return;
if (len > 2 && !memcmp (arg, "-l", 2))
add_lib (arg + 2);
else if (len > 2 && !strcmp (arg + len - 2, ".a"))
{
char *lib;
arg[len - 2] = '\0';
lib = strrchr (arg, '/');
if (lib == NULL)
lib = strrchr (arg, ':');
if (lib == NULL)
lib = arg - 1;
if (!strncmp (lib + 1, "lib", 3))
add_lib (lib + 4);
arg[len - 2] = '.';
}
}
/* Delete temporary files. */
void
amigaos_collect2_cleanup (void)
{
if (flag_static)
return;
maybe_unlink (XLIBS_C_NAME);
maybe_unlink (XLIBS_O_NAME);
maybe_unlink (SHARED_X_NAME);
}
/* Copy file named by FNAME to X. */
static void
cat (char *fname, FILE * x)
{
#define BUFSIZE 16384
FILE *in;
static char buf[BUFSIZE];
int bytes;
in = fopen (fname, "r");
if (in == NULL)
fatal_perror ("%s", fname);
while (!feof (in) && (bytes = fread (buf, 1, BUFSIZE, in)))
fwrite (buf, 1, bytes, x);
fclose (in);
}
/* If no dynamic libraries were found, perform like "-static". Otherwise,
create "xlibs.c", "shared.x" and invoke "gcc" to create "xlibs.o". We also
have to adjust the linker commandline. */
void
amigaos_prelink_hook (char **ld1_argv, int *strip_flag)
{
if (flag_static)
return;
if (!found_dynamic_libs)
{
flag_static = 1;
/* If the user has not requested "-static", but has requested "-s",
collect2 removes "-s" from the "ld1_argv", and calls "strip" after
linking. However, this would not be efficient if we linked the
executable without any dynamic library. In this case, we put "-s"
back. */
if (*strip_flag)
{
/* Add "-s" as the last argument on the command line. */
while (*ld1_argv)
ld1_argv++;
*ld1_argv++ = "-s";
*ld1_argv = 0;
*strip_flag = 0;
}
}
else
{
FILE *x, *out;
struct liblist *lib;
static char *argv[] = { 0, "-c", XLIBS_C_NAME, 0 };
char **ld1_end, **ld1;
/* Prepend suffixes to dynamic lib names. In addition, check if we are
linking a base relative executable. */
for (ld1 = ld1_argv; *ld1; ld1++)
{
int len = strlen (*ld1);
if (strncmp (*ld1, "-l", strlen ("-l")) == 0)
{
for (lib = head; lib; lib = lib->next)
if (strcmp (*ld1 + strlen ("-l"), lib->name) == 0)
{
char *newname =
xmalloc (strlen (*ld1) + strlen (DYNAMIC_LIB_SUFFIX) +
1);
strcpy (newname, *ld1);
strcat (newname, DYNAMIC_LIB_SUFFIX);
*ld1 = newname;
break;
}
}
else if (len > 2 && !strcmp (*ld1 + len - 2, ".a"))
{
char *libname;
int substituted = 0;
(*ld1)[len - 2] = '\0';
libname = strrchr (*ld1, '/');
if (libname == NULL)
libname = strrchr (*ld1, ':');
if (libname == NULL)
libname = *ld1 - 1;
if (!strncmp (libname + 1, "lib", 3))
for (lib = head; lib; lib = lib->next)
if (strcmp (libname + 4, lib->name) == 0)
{
char *newname = xmalloc (strlen (*ld1) +
strlen (DYNAMIC_LIB_SUFFIX) +
3);
strcpy (newname, *ld1);
strcat (newname, DYNAMIC_LIB_SUFFIX);
strcat (newname, ".a");
*ld1 = newname;
substituted = 1;
break;
}
if (!substituted)
(*ld1)[len - 2] = '.';
}
else if (strcmp (ld1[0], "-m") == 0 && ld1[1]
&& strcmp (ld1[1], "amiga_bss") == 0)
{
flag_baserel = 1;
break;
}
}
out = fopen (XLIBS_C_NAME, "w");
if (out == NULL)
fatal_perror ("%s", XLIBS_C_NAME);
x = fopen (SHARED_X_NAME, "w");
if (x == NULL)
fatal_perror ("%s", SHARED_X_NAME);
cat ((flag_baserel ? A2IXDIR_PREFIX "/amiga_exe_baserel_script.x"
: A2IXDIR_PREFIX "/amiga_exe_script.x"), x);
for (lib = head; lib; lib = lib->next)
{
static char buf[256];
sprintf (buf, A2IXDIR_PREFIX "/ldscripts/%s.x", lib->name);
fprintf (out, "extern long %sBase; long *__p%sBase = &%sBase;\n",
lib->cname, lib->cname, lib->cname);
cat (buf, x);
} /* {{ */
fprintf (x, "}}\n");
fclose (out);
fclose (x);
argv[0] = c_file_name;
fork_execute ("gcc", argv);
/* Unfortunately, unlike "-s", "-T" cannot be specified as the last
argument. We put it after "-L" args. */
ld1_end = ld1_argv;
while (*ld1_end)
ld1_end++;
ld1_end++;
/* "ld1_end" now points after the terminating 0 of "ld1_argv". */
ld1 = ld1_end - 2;
while (ld1 > ld1_argv && strncmp (*ld1, "-L", strlen ("-L")))
ld1--;
if (ld1 == ld1_argv)
fatal ("no -L arguments");
ld1++;
/* "ld1" now points after "-L". */
/* Shift all the arguments after "-L" one position right. */
memmove (ld1 + 1, ld1, (ld1_end - ld1) * sizeof (*ld1));
/* Put -Tshared.x in the now empty space. */
*ld1 = "-T" SHARED_X_NAME;
}
}
/* Be lazy and just call "postlink". */
void
amigaos_postlink_hook (char *output_file)
{
static char *argv[] = { "postlink", 0, 0, 0 };
if (flag_static)
return;
if (flag_baserel)
{
argv[1] = "-baserel";
argv[2] = output_file;
}
else
argv[1] = output_file;
fork_execute ("postlink", argv);
}

View File

@ -1,99 +0,0 @@
--- gcc-2.95.3/gcc/cccp.c 2001-01-25 15:03:00.000000000 +0100
+++ gcc-2.95.3/gcc/cccp.c 2012-08-04 11:53:28.000000000 +0200
@@ -83,9 +83,9 @@
#define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */
#endif /* VMS */
-/* Windows does not natively support inodes, and neither does MSDOS. */
+/* Windows does not natively support inodes, and neither does MSDOS or AmigaOS. */
#if (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN)) \
- || defined (__MSDOS__)
+ || defined (__MSDOS__) || defined (__amigaos__)
#define INO_T_EQ(a, b) 0
#endif
@@ -103,6 +103,11 @@
/* External declarations. */
+#ifndef OPEN_CASE_SENSITIVE
+/* Default is standard open() */
+#define OPEN_CASE_SENSITIVE open
+#endif
+
extern char *version_string;
HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT));
HOST_WIDEST_INT parse_c_expression PROTO((char *, int));
@@ -403,6 +408,7 @@
/* This is another place that the target system's headers might be. */
{ TOOL_INCLUDE_DIR, "BINUTILS", 0, 0, 0 },
#endif
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 0 },
#else /* not CROSS_COMPILE */
#ifdef LOCAL_INCLUDE_DIR
/* This should be /usr/local/include and should come before
@@ -1918,7 +1924,12 @@
notice ("#include <...> search starts here:\n");
if (!p->fname[0])
fprintf (stderr, " .\n");
- else if (!strcmp (p->fname, "/") || !strcmp (p->fname, "//"))
+ else if (!strcmp (p->fname, "/") || !strcmp (p->fname, "//")
+#ifdef VOL_SEPARATOR
+ /* Don't omit the last character if it's not a '/'. */
+ || p->fname[strlen (p->fname) - 1] != '/'
+#endif
+ )
fprintf (stderr, " %s\n", p->fname);
else
/* Omit trailing '/'. */
@@ -4785,6 +4796,9 @@
#ifdef DIR_SEPARATOR
if ((p = rindex (s, DIR_SEPARATOR))) s = p + 1;
#endif
+#ifdef VOL_SEPARATOR
+ if ((p = rindex (s, VOL_SEPARATOR))) s = p + 1;
+#endif
return s;
}
@@ -4794,6 +4808,7 @@
absolute_filename (filename)
char *filename;
{
+#ifndef FILE_NAME_ABSOLUTE_P
#if defined (__MSDOS__) \
|| (defined (_WIN32) && !defined (__CYGWIN__) && !defined (_UWIN))
if (ISALPHA (filename[0]) && filename[1] == ':') filename += 2;
@@ -4810,6 +4825,9 @@
if (filename[0] == DIR_SEPARATOR) return 1;
#endif
return 0;
+#else /* FILE_NAME_ABSOLUTE_P */
+ return FILE_NAME_ABSOLUTE_P (filename);
+#endif /* FILE_NAME_ABSOLUTE_P */
}
/* Returns whether or not a given character is a directory separator.
@@ -5072,7 +5090,7 @@
|| ! inc->control_macro
|| (inc->control_macro[0] && ! lookup (inc->control_macro, -1, -1))) {
- fd = open (fname, O_RDONLY, 0);
+ fd = OPEN_CASE_SENSITIVE (fname, O_RDONLY, 0);
if (fd < 0)
{
@@ -10406,7 +10424,12 @@
len = simplify_filename (dir->fname);
/* Convert directory name to a prefix. */
- if (len && dir->fname[len - 1] != DIR_SEPARATOR) {
+ if (len && dir->fname[len - 1] != DIR_SEPARATOR
+#ifdef VOL_SEPARATOR
+ && dir->fname[len - 1] != VOL_SEPARATOR
+#endif
+ )
+ {
if (len == 1 && dir->fname[len - 1] == '.')
len = 0;
else

View File

@ -1,216 +0,0 @@
--- gcc-2.95.3/gcc/collect2.c 2001-01-25 15:03:01.000000000 +0100
+++ gcc-2.95.3/gcc/collect2.c 2012-08-04 11:53:28.000000000 +0200
@@ -157,6 +157,12 @@
#else
int do_collecting = 0;
#endif
+
+/* begin-GG-local: dynamic libraries */
+#ifndef DO_COLLECTING
+#define DO_COLLECTING do_collecting
+#endif
+/* end-GG-local */
/* Linked lists of constructor and destructor names. */
@@ -278,8 +284,10 @@
static void prefix_from_env PROTO((char *, struct path_prefix *));
static void prefix_from_string PROTO((char *, struct path_prefix *));
static void do_wait PROTO((char *));
-static void fork_execute PROTO((char *, char **));
-static void maybe_unlink PROTO((char *));
+/* begin-GG-local: dynamic libraries */
+void fork_execute PROTO((char *, char **));
+void maybe_unlink PROTO((char *));
+/* end-GG-local */
static void add_to_list PROTO((struct head *, char *));
static int extract_init_priority PROTO((char *));
static void sort_ids PROTO((struct head *));
@@ -399,6 +407,12 @@
if (status != 0 && output_file != 0 && output_file[0])
maybe_unlink (output_file);
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_EXTRA_CLEANUP
+ COLLECT2_EXTRA_CLEANUP();
+#endif
+/* end-GG-local */
+
exit (status);
}
@@ -523,6 +537,12 @@
maybe_unlink (import_file);
#endif
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_EXTRA_CLEANUP
+ COLLECT2_EXTRA_CLEANUP();
+#endif
+/* end-GG-local */
+
signal (signo, SIG_DFL);
kill (getpid (), signo);
}
@@ -823,11 +843,15 @@
/* Determine the filename to execute (special case for absolute paths). */
+#ifndef FILE_NAME_ABSOLUTE_P
if (*name == '/'
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
|| (*name && name[1] == ':')
#endif
)
+#else
+ if (FILE_NAME_ABSOLUTE_P (name))
+#endif
{
if (access (name, X_OK) == 0)
{
@@ -1063,6 +1087,11 @@
char *q = extract_string (&p);
if (*q == '-' && (q[1] == 'm' || q[1] == 'f'))
num_c_args++;
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_GCC_OPTIONS_HOOK
+ COLLECT2_GCC_OPTIONS_HOOK(q);
+#endif
+/* end-GG-local */
}
obstack_free (&temporary_obstack, temporary_firstobj);
++num_c_args;
@@ -1340,6 +1369,11 @@
add_to_list (&libs, s);
}
#endif
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_LIBNAME_HOOK
+ COLLECT2_LIBNAME_HOOK(arg);
+#endif
+/* end-GG-local */
break;
#ifdef COLLECT_EXPORT_LIST
@@ -1362,7 +1396,9 @@
break;
case 's':
- if (arg[2] == '\0' && do_collecting)
+/* begin-GG-local: dynamic libraries */
+ if (arg[2] == '\0' && DO_COLLECTING)
+/* end-GG-local */
{
/* We must strip after the nm run, otherwise C++ linking
will not work. Thus we strip in the second ld run, or
@@ -1413,6 +1449,11 @@
add_to_list (&libs, arg);
}
#endif
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_LIBNAME_HOOK
+ COLLECT2_LIBNAME_HOOK(arg);
+#endif
+/* end-GG-local */
}
}
@@ -1511,6 +1552,12 @@
fprintf (stderr, "\n");
}
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_PRELINK_HOOK
+ COLLECT2_PRELINK_HOOK(ld1_argv, &strip_flag);
+#endif
+/* end-GG-local */
+
/* Load the program, searching all libraries and attempting to provide
undefined symbols from repository information. */
@@ -1523,7 +1570,9 @@
constructor or destructor list, just return now. */
if (rflag
#ifndef COLLECT_EXPORT_LIST
- || ! do_collecting
+/* begin-GG-local: dynamic libraries */
+ || ! DO_COLLECTING
+/* end-GG-local */
#endif
)
{
@@ -1542,6 +1591,8 @@
return 0;
}
+/* begin-GG-local: dynamic libraries */
+#ifndef COLLECT2_POSTLINK_HOOK
/* Examine the namelist with nm and search it for static constructors
and destructors to call.
Write the constructor and destructor tables to a .s file and reload. */
@@ -1561,6 +1612,10 @@
notice ("%d destructor(s) found\n", destructors.number);
notice ("%d frame table(s) found\n", frame_tables.number);
}
+#else /* COLLECT2_POSTLINK_HOOK */
+ COLLECT2_POSTLINK_HOOK(output_file);
+#endif
+/* end-GG-local */
if (constructors.number == 0 && destructors.number == 0
&& frame_tables.number == 0
@@ -1592,6 +1647,11 @@
#endif
maybe_unlink (c_file);
maybe_unlink (o_file);
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_EXTRA_CLEANUP
+ COLLECT2_EXTRA_CLEANUP();
+#endif
+/* end-GG-local */
return 0;
}
@@ -1671,6 +1731,11 @@
maybe_unlink (import_file);
#endif
+/* begin-GG-local: dynamic libraries */
+#ifdef COLLECT2_EXTRA_CLEANUP
+ COLLECT2_EXTRA_CLEANUP();
+#endif
+/* end-GG-local */
return 0;
}
@@ -1759,7 +1824,7 @@
if (redir)
{
/* Open response file. */
- redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);
+ redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT, 0666);
/* Duplicate the stdout and stderr file handles
so they can be restored later. */
@@ -1793,7 +1858,9 @@
fatal_perror (errmsg_fmt, errmsg_arg);
}
-static void
+/* begin-GG-local: dynamic libraries */
+void
+/* end-GG-local */
fork_execute (prog, argv)
char *prog;
char **argv;
@@ -1804,7 +1871,9 @@
/* Unlink a file unless we are debugging. */
-static void
+/* begin-GG-local: dynamic libraries */
+void
+/* end-GG-local */
maybe_unlink (file)
char *file;
{

View File

@ -1,40 +0,0 @@
--- gcc-2.95.3/gcc/config.in 2001-03-16 15:09:04.000000000 +0100
+++ gcc-2.95.3/gcc/config.in 2012-08-04 11:53:28.000000000 +0200
@@ -194,6 +194,9 @@
/* Define vfork as fork if vfork does not work. */
#undef vfork
+/* Define if vfork() works */
+#undef HAVE_VFORK
+
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT
@@ -338,6 +341,9 @@
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
+/* Define if you have the <syms.h> header file. */
+#undef HAVE_SYMS_H
+
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
@@ -356,11 +362,17 @@
/* Define if you have the <sys/times.h> header file. */
#undef HAVE_SYS_TIMES_H
+/* Define if you have the <sys/varargs.h> header file. */
+#undef HAVE_SYS_VARARGS_H
+
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Define if you have the <varargs.h> header file. */
+#undef HAVE_VARARGS_H
+
/* Define if you have the i library (-li). */
#undef HAVE_LIBI

View File

@ -613,37 +613,3 @@ do \
DONE; \
} \
while (0)
/* begin-GG-local: dynamic libraries */
/* This macro is used to check if all collect2 facilities should be used.
We need a few special ones, like stripping after linking. */
#define DO_COLLECTING (do_collecting || amigaos_do_collecting())
/* This macro is called in collect2 for every GCC argument name.
ARG is a part of commandline (without '\0' at the end). */
#define COLLECT2_GCC_OPTIONS_HOOK(ARG) amigaos_gccopts_hook(ARG)
/* This macro is called in collect2 for every ld's "-l" or "*.o" or "*.a"
argument. ARG is a complete argument, with '\0' at the end. */
#define COLLECT2_LIBNAME_HOOK(ARG) amigaos_libname_hook(ARG)
/* This macro is called at collect2 exit, to clean everything up. */
#define COLLECT2_EXTRA_CLEANUP amigaos_collect2_cleanup
/* This macro is called just before the first linker invocation.
LD1_ARGV is "char** argv", which will be passed to "ld". STRIP is an
*address* of "strip_flag" variable. */
#define COLLECT2_PRELINK_HOOK(LD1_ARGV, STRIP) \
amigaos_prelink_hook((LD1_ARGV), (STRIP))
/* This macro is called just after the first linker invocation, in place of
"nm" and "ldd". OUTPUT_FILE is the executable's filename. */
#define COLLECT2_POSTLINK_HOOK(OUTPUT_FILE) amigaos_postlink_hook(OUTPUT_FILE)
/* end-GG-local */

View File

@ -77,14 +77,3 @@ install-libgcc-multi: stmp-libgcc-multi installdirs
else true; fi; \
chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
done
### begin-GG-local: dynamic libraries
# Extra objects that get compiled and linked to collect2
EXTRA_COLLECT2_OBJS = amigacollect2.o
# Build supplimentary AmigaOS target support file for collect2
amigacollect2.o: amigacollect2.c
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
-DA2IXDIR_PREFIX=\"$(prefix)/share/a2ixlibrary\" $(srcdir)/amigacollect2.c
### end-GG-local

View File

@ -1,102 +0,0 @@
/* Configuration for GNU C-compiler for m68k Amiga, running AmigaOS.
Copyright (C) 1992, 93-96, 1997 Free Software Foundation, Inc.
Contributed by Markus M. Wild (wild@amiga.physik.unizh.ch).
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. */
/* First include the generic header, then modify some parts. */
#include "m68k/xm-m68k.h"
#ifndef _FCNTL_H_
#include <fcntl.h>
#endif
/* Define various things that the AmigaOS host has. */
#define HAVE_ATEXIT
#define HAVE_RENAME
/* AmigaOS specific headers, such as from the Native Developer Update kits,
go in SYSTEM_INCLUDE_DIR. STANDARD_INCLUDE_DIR is the equivalent of
Unix "/usr/include". All other include paths are set in Makefile. */
#define SYSTEM_INCLUDE_DIR "/gg/os-include"
#define STANDARD_INCLUDE_DIR "/gg/include"
#define STANDARD_EXEC_PREFIX_1 "/gg/lib/gcc/"
#define STANDARD_STARTFILE_PREFIX_1 "/gg/lib/"
#define STANDARD_STARTFILE_PREFIX_2 "/gg/lib/"
/* The AmigaOS stores file names with regard to upper/lower case, but actions
on existing files are case independent on the standard filesystems.
A good example of where this causes problems is the conflict between the C
include file <string.h> and the C++ include file <String.h>, where the C++
include file dir is searched first and thus causes includes of <string.h>
to include <String.h> instead.
In order to solve this problem we define the macro OPEN_CASE_SENSITIVE as
the name of the function that takes the same args as open() and does case
dependent opens. */
#define OPEN_CASE_SENSITIVE(NAME, FLAGS, MODE) open ((NAME), (FLAGS) | O_CASE, (MODE))
/* On the AmigaOS, there are two pathname separators, '/' (DIR_SEPARATOR)
and ':' (VOL_SEPARATOR). DIR_SEPARATOR defaults to the correct
character, so we don't have to explicitly set it. */
#define DIR_SEPARATOR '/'
#define VOL_SEPARATOR ':'
/* Do *not* use this define, otherwise Amiga-devicenames ('DEV:') won't
work: */
// #define DIR_SEPARATOR_2 VOL_SEPARATOR
/* Determine whether a '\0'-terminated file name is absolute or not.
This checks for both, '/' as the first character, since we're running under
ixemul.library which provides for this unix'ism, and for the usual
logical-terminator, ':', somewhere in the filename. */
#define FILE_NAME_ABSOLUTE_P(NAME) ((NAME)[0] == '/' || index ((NAME), ':'))
/* Like the above, but the file name is not '\0'-terminated. */
#define FILE_NAME_ABSOLUTE_N_P(NAME, LEN) amigaos_file_name_absolute_n ((NAME), (LEN))
/* Return the file name part of the path name. */
#define FILE_NAME_NONDIRECTORY(NAME) \
(rindex ((NAME), '/') ? rindex ((NAME), '/') + 1 \
: (rindex ((NAME), ':') ? rindex ((NAME), ':') + 1 \
: (NAME)))
/* Generate the name of the cross reference file. */
#define XREF_FILE_NAME(BUFF, NAME) \
do \
{ \
char *filesrc, *filedst; \
strcpy ((BUFF), (NAME)); \
filesrc = FILE_NAME_NONDIRECTORY (NAME); \
filedst = (BUFF) + (filesrc - (NAME)); \
sprintf (filedst, ".%s.gxref", filesrc); \
} \
while (0)

View File

@ -1,36 +1,10 @@
--- gcc-2.95.3/gcc/configure 2001-03-16 15:09:04.000000000 +0100
+++ gcc-2.95.3/gcc/configure 2012-08-04 11:53:28.000000000 +0200
@@ -2558,6 +2558,12 @@
sparc_address_test ();
+#ifdef __amigaos__
+ /* Force this test to succeed for AmigaOS, which has a fairly good
+ vfork() emulation, but doesn't support fork() at all. -fnf */
+ exit (0);
+#endif
+
child = vfork ();
if (child == 0) {
@@ -2628,6 +2634,11 @@
#define vfork fork
EOF
+else
+ cat >> confdefs.h <<\EOF
+#define HAVE_VFORK 1
+EOF
+
fi
@@ -4341,6 +4352,14 @@
@@ -4341,6 +4352,13 @@
thread_file='vxworks'
float_format=m68k
;;
+ m68k-*-amigaos*)
+ xm_file=m68k/xm-amigaos.h
+ tm_file=m68k/amigaos.h
+ tmake_file=m68k/t-amigaos
+ xmake_file=m68k/x-amigaos
@ -40,22 +14,3 @@
m68k-*-aout*)
tmake_file=m68k/t-m68kbare
tm_file="m68k/m68k-aout.h libgloss.h"
@@ -4446,7 +4465,6 @@
extra_headers=math-68881.h
float_format=m68k
;;
-
m88k-dg-dgux*)
case $machine in
m88k-dg-dguxbcs*)
@@ -8692,7 +8710,9 @@
: ${CONFIG_STATUS=./config.status}
echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
+# Some systems, like AmigaOS, won't allow you to remove a script that is
+# being executed, so just move it out of the way instead.
+if test -f $CONFIG_STATUS; then mv $CONFIG_STATUS $CONFIG_STATUS.old; else true; fi
cat > $CONFIG_STATUS <<EOF
#! /bin/sh
# Generated automatically by configure.

View File

@ -24,30 +24,11 @@
# Don't set gcc_gxx_include_dir to gxx_include_dir since that's only
# passed in by the toplevel make and thus we'd get different behavior
@@ -346,7 +348,7 @@
AC_HEADER_TIME
GCC_HEADER_STRING
AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h sys/stat.h direct.h)
+AC_CHECK_HEADERS(limits.h stddef.h string.h strings.h stdlib.h syms.h time.h fcntl.h unistd.h stab.h sys/file.h sys/time.h sys/resource.h sys/param.h sys/times.h sys/stat.h direct.h varargs.h sys/varargs.h)
# Check for thread headers.
AC_CHECK_HEADER(thread.h, [have_thread_h=yes], [have_thread_h=])
@@ -416,6 +418,8 @@
AC_DECL_SYS_SIGLIST
+AC_FUNC_ALLOCA
+
# mkdir takes a single argument on some systems.
GCC_FUNC_MKDIR_TAKES_ONE_ARG
@@ -2013,6 +2017,14 @@
@@ -2013,6 +2017,13 @@
thread_file='vxworks'
float_format=m68k
;;
+ m68k-*-amigaos*)
+ xm_file=m68k/xm-amigaos.h
+ tm_file=m68k/amigaos.h
+ tmake_file=m68k/t-amigaos
+ xmake_file=m68k/x-amigaos
@ -57,11 +38,3 @@
m68k-*-aout*)
tmake_file=m68k/t-m68kbare
tm_file="m68k/m68k-aout.h libgloss.h"
@@ -2118,7 +2130,6 @@
extra_headers=math-68881.h
float_format=m68k
;;
-
m88k-dg-dgux*)
case $machine in
m88k-dg-dguxbcs*)

View File

@ -1,11 +0,0 @@
--- gcc-2.95.3/gcc/cp/config-lang.in 1999-01-06 21:57:30.000000000 +0100
+++ gcc-2.95.3/gcc/cp/config-lang.in 2012-08-04 11:53:28.000000000 +0200
@@ -39,3 +39,8 @@
lib2funcs=cplib2.txt
outputs=cp/Makefile
+
+# GG local hack. Need this so that exception handling stuff gets
+# built, otherwise cannot bootstrap ADA. Since we compile with gcc
+# on every platform we care about, this is no problem.
+boot_language=yes

View File

@ -1,80 +0,0 @@
--- gcc-2.95.3/gcc/cppfiles.c 1999-05-10 17:24:33.000000000 +0200
+++ gcc-2.95.3/gcc/cppfiles.c 2012-08-04 11:53:28.000000000 +0200
@@ -52,12 +52,12 @@
static void hack_vms_include_specification PROTO ((char *));
#endif
-/* Windows does not natively support inodes, and neither does MSDOS.
+/* Windows does not natively support inodes, and neither does MSDOS or AmigaOS.
VMS has non-numeric inodes. */
#ifdef VMS
#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a)))
#elif (defined _WIN32 && !defined CYGWIN && ! defined (_UWIN)) \
- || defined __MSDOS__
+ || defined __MSDOS__ || defined __amigaos__
#define INO_T_EQ(a, b) 0
#else
#define INO_T_EQ(a, b) ((a) == (b))
@@ -318,7 +318,12 @@
ih = include_hash (pfile, fname, 1);
jh = redundant_include_p (pfile, ih,
- fname[0] == '/' ? ABSOLUTE_PATH : search_start);
+#ifdef FILE_NAME_ABSOLUTE_P
+ FILE_NAME_ABSOLUTE_P (fname)
+#else
+ fname[0] == '/'
+#endif
+ ? ABSOLUTE_PATH : search_start);
if (jh != 0)
{
@@ -354,7 +359,11 @@
ih->control_macro = NULL;
/* If the pathname is absolute, just open it. */
+#ifdef FILE_NAME_ABSOLUTE_P
+ if (FILE_NAME_ABSOLUTE_P (fname))
+#else
if (fname[0] == '/')
+#endif
{
ih->foundhere = ABSOLUTE_PATH;
ih->name = ih->nshort;
@@ -369,8 +378,15 @@
for (l = search_start; l; l = l->next)
{
bcopy (l->name, name, l->nlen);
- name[l->nlen] = '/';
- strcpy (&name[l->nlen+1], fname);
+#ifdef VOL_SEPARATOR
+ if (name[l->nlen - 1] == VOL_SEPARATOR)
+ strcpy (&name[l->nlen], fname);
+ else
+#endif
+ {
+ name[l->nlen] = '/';
+ strcpy (&name[l->nlen+1], fname);
+ }
simplify_pathname (name);
if (CPP_OPTIONS (pfile)->remap)
name = remap_filename (pfile, name, l);
@@ -723,6 +739,18 @@
dir = xstrdup (fname);
last_slash = rindex (dir, '/');
+
+#ifdef VOL_SEPARATOR
+ {
+ char *last_sep;
+ last_sep = rindex (dir, VOL_SEPARATOR);
+ if (last_sep)
+ last_sep++; /* Keep VOL_SEPARATOR. */
+ if (last_sep > last_slash)
+ last_slash = last_sep;
+ }
+#endif
+
if (last_slash)
{
if (last_slash == dir)

View File

@ -1,84 +0,0 @@
--- gcc-2.95.3/gcc/gcc.c 2001-01-25 15:03:16.000000000 +0100
+++ gcc-2.95.3/gcc/gcc.c 2012-08-04 11:53:28.000000000 +0200
@@ -1372,9 +1372,12 @@
#ifndef STANDARD_EXEC_PREFIX
#define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
#endif /* !defined STANDARD_EXEC_PREFIX */
+#ifndef STANDARD_EXEC_PREFIX_1
+#define STANDARD_EXEC_PREFIX_1 "/usr/lib/gcc/"
+#endif /* !defined STANDARD_EXEC_PREFIX_1 */
static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
-static const char *standard_exec_prefix_1 = "/usr/lib/gcc/";
+static const char *standard_exec_prefix_1 = STANDARD_EXEC_PREFIX_1;
#ifdef MD_EXEC_PREFIX
static const char *md_exec_prefix = MD_EXEC_PREFIX;
#endif
@@ -1382,6 +1385,12 @@
#ifndef STANDARD_STARTFILE_PREFIX
#define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
#endif /* !defined STANDARD_STARTFILE_PREFIX */
+#ifndef STANDARD_STARTFILE_PREFIX_1
+#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
+#endif /* !defined STANDARD_STARTFILE_PREFIX_1 */
+#ifndef STANDARD_STARTFILE_PREFIX_2
+#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
+#endif /* !defined STANDARD_STARTFILE_PREFIX_2 */
#ifdef MD_STARTFILE_PREFIX
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
@@ -1390,8 +1399,8 @@
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
#endif
static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
-static const char *standard_startfile_prefix_1 = "/lib/";
-static const char *standard_startfile_prefix_2 = "/usr/lib/";
+static const char *standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1;
+static const char *standard_startfile_prefix_2 = STANDARD_STARTFILE_PREFIX_2;
#ifndef TOOLDIR_BASE_PREFIX
#define TOOLDIR_BASE_PREFIX "/usr/local/"
@@ -1997,7 +2006,11 @@
/* Determine the filename to execute (special case for absolute paths). */
+#ifdef FILE_NAME_ABSOLUTE_P
+ if (FILE_NAME_ABSOLUTE_P (name)
+#else
if (IS_DIR_SEPARATOR (*name)
+#endif
#ifdef HAVE_DOS_BASED_FILESYSTEM
/* Check for disk name on MS-DOS-based systems. */
|| (name[0] && name[1] == ':' && IS_DIR_SEPARATOR (name[2]))
@@ -3530,9 +3543,13 @@
/* Relative directories always come from -B,
and it is better not to use them for searching
at run time. In particular, stage1 loses */
+#ifndef FILE_NAME_ABSOLUTE_P
if (!IS_DIR_SEPARATOR (pl->prefix[0]))
continue;
-#endif
+#else
+ if (! FILE_NAME_ABSOLUTE_P (pl->prefix))
+#endif /* FILE_NAME_ABSOLUTE_P */
+#endif /* RELATIVE_PREFIX_NOT_LINKDIR */
/* Try subdirectory if there is one. */
if (multilib_dir != NULL)
{
@@ -4609,12 +4626,11 @@
/* Exclude directories that the linker is known to search. */
if (linker
&& ((cp - path == 6
- && strcmp (path, concat (dir_separator_str, "lib",
- dir_separator_str, ".", NULL_PTR)) == 0)
+ && strcmp (path, concat (STANDARD_STARTFILE_PREFIX_1,
+ ".", NULL_PTR)) == 0)
|| (cp - path == 10
- && strcmp (path, concat (dir_separator_str, "usr",
- dir_separator_str, "lib",
- dir_separator_str, ".", NULL_PTR)) == 0)))
+ && strcmp (path, concat (STANDARD_STARTFILE_PREFIX_2,
+ ".", NULL_PTR)) == 0)))
return 0;
return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));

View File

@ -1,11 +0,0 @@
--- gcc-2.95.3/gcc/sdbout.c 1999-04-18 15:09:29.000000000 +0200
+++ gcc-2.95.3/gcc/sdbout.c 2012-08-04 11:53:28.000000000 +0200
@@ -59,7 +59,7 @@
supply usable syms.h include files. Which syms.h file to use is a
target parameter so don't use the native one if we're cross compiling. */
-#if defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(_WIN32) && !defined(__linux__) && !defined(__INTERIX) && !defined(CROSS_COMPILE)
+#if defined (HAVE_SYMS_H) && defined(USG) && !defined(MIPS) && !defined (hpux) && !defined(_WIN32) && !defined(__linux__) && !defined(__INTERIX) && !defined(CROSS_COMPILE)
#include <syms.h>
/* Use T_INT if we don't have T_VOID. */
#ifndef T_VOID

View File

@ -11,44 +11,3 @@
{"exceptions", &flag_exceptions, 1,
"Enable exception handling" },
{"new-exceptions", &flag_new_exceptions, 1,
@@ -2569,7 +2573,11 @@
/* NA gets INPUT_NAME sans directory names. */
while (na > input_name)
{
- if (na[-1] == '/')
+ if (na[-1] == '/'
+#ifdef VOL_SEPARATOR
+ || na[-1] == VOL_SEPARATOR
+#endif
+ )
break;
#ifdef DIR_SEPARATOR
if (na[-1] == DIR_SEPARATOR)
@@ -4776,6 +4784,9 @@
#ifdef DIR_SEPARATOR
&& p[-1] != DIR_SEPARATOR
#endif
+#ifdef VOL_SEPARATOR
+ && p[-1] != VOL_SEPARATOR
+#endif
)
--p;
progname = p;
@@ -5449,7 +5460,7 @@
compile_file (filename);
-#if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX)
+#if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__)) && !defined(__INTERIX) && !defined (__amigaos__)
if (flag_print_mem)
{
char *lim = (char *) sbrk (0);
@@ -5465,7 +5476,7 @@
#endif /* not USG */
#endif
}
-#endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX */
+#endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) && ! __INTERIX && ! __amigaos__ */
if (errorcount)
exit (FATAL_EXIT_CODE);

View File

@ -1,38 +0,0 @@
--- gcc-2.95.3/libiberty/choose-temp.c 1999-04-25 02:23:06.000000000 +0200
+++ gcc-2.95.3/libiberty/choose-temp.c 2012-08-04 11:53:28.000000000 +0200
@@ -51,6 +51,9 @@
#if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN__) && ! defined (_UWIN))
#define DIR_SEPARATOR '\\'
#endif
+#ifdef __amigaos__
+#define VOL_SEPARATOR ':'
+#endif
#endif
#ifndef DIR_SEPARATOR
@@ -131,7 +134,11 @@
if (len != 0
&& temp_filename[len-1] != '/'
- && temp_filename[len-1] != DIR_SEPARATOR)
+ && temp_filename[len-1] != DIR_SEPARATOR
+#ifdef VOL_SEPARATOR
+ && temp_filename[len-1] != VOL_SEPARATOR
+#endif
+ )
temp_filename[len++] = DIR_SEPARATOR;
strcpy (temp_filename + len, TEMP_FILE);
@@ -184,7 +191,11 @@
if (base_len != 0
&& temp_filename[base_len-1] != '/'
- && temp_filename[base_len-1] != DIR_SEPARATOR)
+ && temp_filename[base_len-1] != DIR_SEPARATOR
+#ifdef VOL_SEPARATOR
+ && temp_filename[base_len-1] != VOL_SEPARATOR
+#endif
+ )
temp_filename[base_len++] = DIR_SEPARATOR;
strcpy (temp_filename + base_len, TEMP_FILE);