Patchkit to build GCC-2.5.7 on SCO Xenix 2.3.x Modified from the gcc 2.4.5 Patchkit for Xenix 2.3.x (by Kai Ruottu, Tornio, Finland) that was first modified from : the gcc 2.3.3 Patchkit for Xenix 2.3.4 (by Steve Bleazard@RoboBar.Co.Uk) The original 2.3.3 patchkit seems to work with only minor cosmetic changes (the new config-subdirectories and new names for the necessary include-files) The following message contains the necessary modifications and configuration files to build gcc-2.5.7 for SCO Xenix 2.3.x with Xenix GAS-1.38 and GDB-3.5 What you need: SCO XENIX 386 Operating System SCO XENIX 386 Development System Robobar's Port of GCC-1.40, GAS-1.38 and GDB-3.5 (patchkits from volume 23 of comp.sources.unix, or the binary distribution available from unix.secs.oakland.edu) (I compiled this with gcc 2.4.5 for Xenix, but the gcc 1.40 should work too.../ KR) Larry Wall's "patch" program, version 2, patchlevel 12. (from volume 7 of comp.sources.unix, or the GNU enhanced one from prep.ai.mit.edu) The standard GNU distributions of the compiler gcc-2.5.7.tar.gz This patchkit xenpatch.257 A lot of free disc space. 50 Mb is comfortable. What to do: 1. Install Xenix GCC-1.40, GAS-1.38 and GDB-3.5 if they aren't already I assume you have either applied Ronald's fix.h.xenix or have hacked the headers yourself (or use gcc 2.4.5 if you have that...) 2. Unpack the gcc distribution with 'gtar xzf gcc-2.5.7.tar.gz' or 'gzip -d'ing first and 'tar xf'ing then... 3. cd gcc-2.5.7 4. patch -p < xenpatch.257 [ie part of this article] 5. configure with: sh ./configure --target=i386-sco-xenix 6. make a link from /usr/local/lib/gcc-as to /usr/local/lib/gcc-lib/i386-sco-xenix/as creating directories as required. 7. Now follow the instructions in INSTALL. Note that this patchkit has only been tested with LANGUAGES="c c++". For stage1 I used LANGUAGES=c WARNING: You may want to make a separate copy of /usr/local/bin/gcc as this is overwritten by the installation of gcc-2.5.7 --- xenpatch.257 --starts---------- Cut Here -----------starts--xenpatch.257--- *** /dev/null Fri Jan 22 14:41:00 1993 --- README.XENIX Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,19 ---- + This port of GCC-2.5.7 works in conjuction with the Xenix version of gas-1.38 + and gdb-3.5. The patchkits for these, as well as gcc-1.40, are available from + you nearest comp.sources.misc archive in volume 23. A complete binary + distribution of GCC-1.40, gas-1.38 and GDB-3.5 is also available via anon ftp + from unix.secs.oakland.edu. + + Building GCC-2.5.7 under Xenix with the standard Microsoft C compiler has not + been tested, nor is likely to work. To build this version of GCC requires + Xenix gcc-1.40 or later. + + On SCO Xenix 2.3.x it is necessary to install a linker helper-program + (provided by Christoph Badura ), in addition to + collect2 which is used to handle contructors / destructors. This is + installed as real-ld in the gcc bin directory and calls /bin/ld to do the + work. + + To allow for those without a dev sys an assembler version of _fixdfsi + has been provided. This means that OLDCC can be set to gcc without + recursion problems. *** /dev/null Fri Jan 22 10:51:04 1993 --- __main.c Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,96 ---- + /* Copyright (C) 1989, 1992 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. */ + + /* As a special exception, if you link this library with files + compiled with GCC to produce an executable, this does not cause + the resulting executable to be covered by the GNU General Public License. + This exception does not however invalidate any other reasons why + the executable file might be covered by the GNU General Public License. */ + + /* Xenix main and ctor / dtor handling + This is very similar to the standard versions except __CTOR_LIST__ and + __DTOR_LIST__ are defined as common in this code as the xenix ld does + not appear to resolve data externals correctly. */ + + + #include "tconfig.h" + #include "machmode.h" + + #include "gbl-ctors.h" + + /* Run all the global destructors on exit from the program. */ + + func_ptr __CTOR_LIST__[2]; + func_ptr __DTOR_LIST__[2]; + + static void + __do_global_xtors (func_ptr *xtors) + { + unsigned nptrs = (unsigned HOST_WIDE_INT) xtors[0]; + unsigned i; + + /* Some systems place the number of pointers + in the first word of the table. + On other systems, that word is -1. + In all cases, the table is null-terminated. */ + + /* If the length is not recorded, count up to the null. */ + if (nptrs == -1) + for (nptrs = 0; xtors[nptrs + 1] != 0; nptrs++); + + /* GNU LD format. */ + for (i = nptrs; i >= 1; i--) + xtors[i] (); + } + + void + __do_global_dtors () + { + __do_global_xtors(__DTOR_LIST__); + } + + #ifndef ON_EXIT + #define ON_EXIT(a, b) + #endif /* ON_EXIT */ + + void + __do_global_ctors () + { + __do_global_xtors(__CTOR_LIST__); + ON_EXIT (__do_global_dtors, 0); + } + + /* Subroutine called automatically by `main'. + Compiling a global function named `main' + produces an automatic call to this function at the beginning. + + For many systems, this routine calls __do_global_ctors. + For systems which support a .init section we use the .init section + to run __do_global_ctors, so we need not do anything here. */ + + void + __main () + { + /* Support recursive calls to `main': run initializers just once. */ + static int initialized = 0; + if (! initialized) + { + initialized = 1; + __do_global_ctors (); + } + } *** /dev/null Fri Jan 22 10:51:04 1993 --- _fixdfsi.asm Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,19 ---- + .file "__fixdfsi.s" + .text + .align 2 + .globl ___fixdfsi + ___fixdfsi: + pushl %ebp + movl %esp,%ebp + subl $12,%esp + fstcw -4(%ebp) + movw -4(%ebp),%ax + orw $0x0c00,%ax + movw %ax,-2(%ebp) + fldcw -2(%ebp) + fldl 8(%ebp) + fistpl -12(%ebp) + fldcw -4(%ebp) + movl -12(%ebp),%eax + leave + ret *** /dev/null Fri Jan 22 10:51:04 1993 --- config/i386/xenix.h Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,261 ---- + /* Definitions for Intel 386 running SCO Xenix Release 2.3.x. with GAS-1.38 + Written by Steve Bleazard, new include name (gcc 2.5.7) by Kai Ruottu + Copyright (C) 1992 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. */ + + + /* Mostly it's like AT&T Unix System V. */ + + #include "i386/sysv3.h" + + /* By default, target has a 80387, uses IEEE compatible arithmetic, + and returns float values in the 387, ie, + (TARGET_80387 | TARGET_FLOAT_RETURNS_IN_80387) + + SCO's software emulation of a 387 fails to handle the `fucomp' + opcode. fucomp is only used when generating IEEE compliant code. + So don't make TARGET_IEEE_FP default for SCO. */ + + #undef TARGET_DEFAULT + #define TARGET_DEFAULT 0241 + + /* no #sccs in preprocessor. */ + + #undef SCCS_DIRECTIVE + + /* no #ident */ + + #undef ASM_OUTPUT_IDENT + + /* We dont want to output SDB debugging information. */ + + #undef SDB_DEBUGGING_INFO + + /* We want to output DBX debugging information, for use with GDB only */ + + #define DBX_DEBUGGING_INFO + + /* Implicit library calls should use memcpy, not bcopy, etc. */ + + #define TARGET_MEM_FUNCTIONS + + /* use dollars in g++ special names */ + + #undef NO_DOLLAR_IN_LABEL + + /* Generate an external symbol request for __fltused if 80387 selected */ + + #undef ASM_FILE_START + #define ASM_FILE_START(FILE) \ + { output_file_directive((FILE), main_input_filename); \ + if (TARGET_80387) \ + fprintf (FILE, "\t.stabs\t\"__fltused\",0,0,0,0\n"); } + + #undef ASM_OUTPUT_LOCAL + #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ + ( fputs (".lcomm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%u\n", (SIZE))) + + #undef EXTRA_SECTIONS + #define EXTRA_SECTIONS in_cdata + + /* Define the additional functions to select our additional sections. */ + + #define CDATA_SECTION_ASM_OP ".data 1" + + #undef EXTRA_SECTION_FUNCTIONS + #define EXTRA_SECTION_FUNCTIONS \ + void \ + const_section () \ + { \ + if (in_section != in_cdata) \ + { \ + fprintf (asm_out_file, "%s\n", CDATA_SECTION_ASM_OP); \ + in_section = in_cdata; \ + } \ + } + + /* This is how to output an assembler line + that says to advance the location counter + by a multiple of 2**LOG bytes. */ + + #undef ASM_OUTPUT_ALIGN + #define ASM_OUTPUT_ALIGN(FILE,LOG) \ + if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG)) + + /* Align labels, etc. at 4-byte boundaries. + For the 486, align to 16-byte boundary for sake of cache. */ + + #undef ASM_OUTPUT_ALIGN_CODE + #define ASM_OUTPUT_ALIGN_CODE(FILE) \ + fprintf ((FILE), "\t.align %d,0x90\n", \ + TARGET_486 ? 4 : 2); /* Use log of 16 or log of 4 as arg. */ + + /* Align start of loop at 4-byte boundary. */ + + #undef ASM_OUTPUT_LOOP_ALIGN + #define ASM_OUTPUT_LOOP_ALIGN(FILE) \ + fprintf ((FILE), "\t.align 2,0x90\n"); /* Use log of 4 as arg. */ + + /* This is how to store into the string BUF + the symbol_ref name of an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. + This is suitable for output with `assemble_name'. */ + + #undef ASM_GENERATE_INTERNAL_LABEL + #define ASM_GENERATE_INTERNAL_LABEL(BUF,PREFIX,NUMBER) \ + sprintf ((BUF), "*.%s%d", (PREFIX), (NUMBER)) + + /* This is how to output an internal numbered label where + PREFIX is the class of label and NUM is the number within the class. */ + + #undef ASM_OUTPUT_INTERNAL_LABEL + #define ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM) \ + fprintf (FILE, ".%s%d:\n", PREFIX, NUM) + + /* This is how to output a reference to a user-level label named NAME. */ + + #undef ASM_OUTPUT_LABELREF + #define ASM_OUTPUT_LABELREF(FILE,NAME) \ + fprintf (FILE, "_%s", NAME) + + #undef ASM_GLOBALIZE_LABEL + #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ + (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) + + #undef INIT_SECTION_ASM_OP + #undef ASM_OUTPUT_CONSTRUCTOR + #undef ASM_OUTPUT_DESTRUCTOR + + /* A C statement or statements which output an assembler instruction + opcode to the stdio stream STREAM. The macro-operand PTR is a + variable of type `char *' which points to the opcode name in its + "internal" form--the form that is written in the machine description. + + GAS version 1.38.1 doesn't understand the `repz' opcode mnemonic. + So use `repe' instead. */ + + #define ASM_OUTPUT_OPCODE(STREAM, PTR) \ + { \ + if ((PTR)[0] == 'r' \ + && (PTR)[1] == 'e' \ + && (PTR)[2] == 'p') \ + { \ + if ((PTR)[3] == 'z') \ + { \ + fprintf (STREAM, "repe"); \ + (PTR) += 4; \ + } \ + else if ((PTR)[3] == 'n' && (PTR)[4] == 'z') \ + { \ + fprintf (STREAM, "repne"); \ + (PTR) += 5; \ + } \ + } \ + } + + /* Define macro used to output shift-double opcodes when the shift + count is in %cl. Some assemblers require %cl as an argument; + some don't. + + GAS requires the %cl argument, so override unx386.h. */ + + #undef AS3_SHIFT_DOUBLE + #define AS3_SHIFT_DOUBLE(a,b,c,d) AS3 (a,b,c,d) + + /* Print opcodes the way that GAS expects them. */ + #define GAS_MNEMONICS 1 + + /* File specs */ + + #undef MD_STARTFILE_PREFIX + #define MD_STARTFILE_PREFIX "/lib/386/" + + #undef STARTFILE_SPEC + #define STARTFILE_SPEC \ + "Sseg.o%s %{pg:Sgcrt0.o%s}%{!pg:%{p:Smcrt0.o%s}%{!p:Scrt0.o%s}}" + + #undef LIB_SPEC + #define LIB_SPEC "Slibcfp.a%s Slibc.a%s" + + /* -v is appropriate for use with GAS */ + + #define ASM_SPEC "%{v} %{g}" + + #define LINK_SPEC "-i %{g}" + + /* Specify predefined symbols in preprocessor. */ + + #undef CPP_PREDEFINES + #define CPP_PREDEFINES "-Dunix \ + -DM_I86 -DM_I86SM -DM_SDATA -DM_STEXT -DM_I386 -DM_XENIX -DM_BITFIELDS \ + -Di386 -DM_XOUT -DM_SYS5 -DM_SYSV -DM_SYS3 -DM_SYSIII \ + -DM_WORDSWAP" + + /* This spec is used for telling cpp whether char is signed or not. */ + + #undef SIGNED_CHAR_SPEC + #if DEFAULT_SIGNED_CHAR + #define SIGNED_CHAR_SPEC \ + "%{funsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" + #else + #define SIGNED_CHAR_SPEC \ + "%{!fsigned-char:-D__CHAR_UNSIGNED__ -D_CHAR_UNSIGNED}" + #endif + + #undef LOCAL_INCLUDE_DIR + #define LOCAL_INCLUDE_DIR "/usr/local/lib/gcc-include" + + /* caller has to pop the extra argument passed to functions that return + structures. */ + + #undef RETURN_POPS_ARGS + #define RETURN_POPS_ARGS(FUNTYPE,SIZE) \ + (TREE_CODE (FUNTYPE) == IDENTIFIER_NODE ? 0 \ + : (TARGET_RTD \ + && (TYPE_ARG_TYPES (FUNTYPE) == 0 \ + || (TREE_VALUE (tree_last (TYPE_ARG_TYPES (FUNTYPE))) \ + == void_type_node))) ? (SIZE) \ + : 0) + /* On other 386 systems, the last line looks like this: + : (aggregate_value_p (FUNTYPE)) ? GET_MODE_SIZE (Pmode) : 0) */ + + + /* Specify the size_t type. */ + #define SIZE_TYPE "unsigned int" + + #undef DO_GLOBAL_CTORS_BODY + #define DO_GLOBAL_CTORS_BODY + /* + #define DO_GLOBAL_CTORS_BODY {int nptrs = *(int *)__CTOR_LIST__; int i; \ + if (nptrs == -1 || (__CTOR_LIST__[0] == 0 && __CTOR_LIST__[1] != 0)) \ + for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++); \ + for (i = nptrs; i >= 1; i--) \ + __CTOR_LIST__[i] (); } + */ + + #undef DO_GLOBAL_DTORS_BODY + #define DO_GLOBAL_DTORS_BODY + /* + #define DO_GLOBAL_DTORS_BODY {int nptrs = *(int *)__DTOR_LIST__; int i; \ + if (nptrs == -1 || (__DTOR_LIST__[0] == 0 && __DTOR_LIST__[1] != 0)) \ + for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++); \ + for (i = nptrs; i >= 1; i--) \ + __DTOR_LIST__[i] (); } + */ *** /dev/null Fri Jan 22 10:51:04 1993 --- config/i386/t-xenix Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,8 ---- + # a new version of __main + + LIB1FUNCS_EXTRA= _fixdfsi.asm + LIB2FUNCS_EXTRA= __main.c + EXTRA_PROGRAMS= real-ld + + real-ld: xenixld.c + $(CC) -o real-ld $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< *** /dev/null Fri Jan 22 10:51:04 1993 --- xenixld.c Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,264 ---- + static char rcsid[] = "@(#) $Id: xenixld.c,v 1.2 1991/08/22 20:17:03 ronald Exp $\n"; + /* + * This is the version distributed by RoboBar limited, currently maintained + * by Ronald Khoo + * + * $Log: xenixld.c,v $ + * Revision 1.2 1991/08/22 20:17:03 ronald + * Baseline for release with GCC 1.40 + * Various mods by Steve, and a hack to prevent loading of COFF files. + * + */ + /* Linker driver program for Xenix that can handle gcc command lines + Copyright (C) 1990 Christoph Badura + + Comments and buggestions are welcome. Write to bad@flatlin.sub.org. + + This file is not part of GNU CC. + + This program 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 1, or (at your option) + any later version. + + This program 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 + + #include "config.h" + + #ifdef USG + #define R_OK 4 + #define W_OK 2 + #define X_OK 1 + #define vfork fork + #endif /* USG */ + + extern void free (); + + /* Default prefixes to attach to command names. */ + + #ifndef STANDARD_STARTFILE_PREFIX + #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/" + #endif /* !defined STANDARD_STARTFILE_PREFIX */ + + char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; + char *standard_startfile_prefix_1 = "/lib/386/"; + char *standard_startfile_prefix_2 = "/usr/lib/"; + + char * progname; /* who am i */ + + fatal (char *msg) + { + fprintf (stderr, "%s:%s\n", progname, msg); + exit (1); + } + + xmalloc (size) + int size; + { + register int value = malloc (size); + if (!value) + fatal ("Virtual memory full."); + return value; + } + + xrealloc (void *ptr, int size) + { + register int value = realloc (ptr, size); + if (!value) + fatal ("Virtual memory full."); + return value; + } + + struct lib_path { + struct lib_path *next; + int length; /* length of following string */ + char *path; + }; + + struct lib_path *lib_path; /* the library search path */ + + struct lib_path * + add_path (char *name, struct lib_path *prev) + { + int size; + struct lib_path *lp; + + #ifdef DEBUG + fprintf (stderr, "%s: adding %s to library path\n", progname, name); + #endif + lp = (struct lib_path *) xmalloc (sizeof (struct lib_path)); + lp->next = prev; + lp->length = strlen (name); + lp->path = name; + return lp; + } + + /* + * Added by Ronald.Khoo@ibmpcug.co.uk: + * SCO systems have two kinds of libraries, OMF and COFF. XENIX GCC/G++ + * only works with OMF, this hack prevents the program accidentally finding + * COFF libraries earlier in the search path from the corresponding OMF one. + */ + int + islib(char *name) + { + int i; + FILE *fp = fopen(name, "r"); + if (fp == 0) + return 0; + i = getw(fp); + fclose(fp); + return (i & 0xff) == 0x80 /* OMF */ || (i & 0xffff) == 0xff65 /* ar */; + } + + char * + find_library_1 (char *name) + { + struct lib_path *lp; + int name_size, size = 0; + char *temp_name = 0; + int win = 0; + + name_size = strlen (name) + 1; + for (lp=lib_path; lp && !win; lp=lp->next) { + if ((lp->length + name_size + 1) > size) { + size = lp->length + name_size + 1; + if (temp_name) + free (temp_name); + temp_name = 0; + } + if (!temp_name) + temp_name = (char *)xmalloc (size); + strcpy (temp_name, lp->path); + if (temp_name[lp->length - 1] != '/') + strcat (temp_name, "/"); + strcat (temp_name, name); + win = islib(temp_name); + #ifdef DEBUG + fprintf (stderr, "%s: searching %s -> %d\n", progname, temp_name, win); + #endif + } + if (win) + return temp_name; + else { + free (temp_name); + return name; + } + } + + char * + find_library (char *name) + { + char *temp_name; + char *lib_name; + + temp_name = (char *)xmalloc (strlen (name) + 7); /* 6 chars for "Slib" and ".a" */ + strcpy (temp_name, "lib"); + strcat (temp_name, name); + strcat (temp_name, ".a"); + if ((lib_name = find_library_1 (temp_name)) == temp_name) { + strcpy (temp_name, "Slib"); /* system libraries start with "Slib" */ + strcat (temp_name, name); + strcat (temp_name, ".a"); + lib_name = find_library_1 (temp_name); + } + free (temp_name); + #ifdef DEBUG + fprintf (stderr, "%s: library name is %s\n", progname, lib_name); + fprintf (stderr, "%s: returning %s\n", progname, + (lib_name == temp_name) ? name : lib_name); + #endif + return (lib_name == temp_name) ? name : lib_name; + } + + + char **argbuf; /* this holds the argument vector for ld */ + int argbuf_index, argbuf_length; + + /* Add one argument to the vector at the end. */ + + void + store_arg (char *arg) + { + if (argbuf_index + 1 == argbuf_length) + { + argbuf = (char **) xrealloc (argbuf, (argbuf_length*=2)*sizeof (char *)); + } + + argbuf[argbuf_index++] = arg; + argbuf[argbuf_index] = 0; + } + + /* + * The standard Xenix ld is seriously braindamaged. It does not understand + * -llib options. So we expand them here and furthermore we process -Lpath + * options as used by the GNU tools. + */ + + int + main (int argc, char **argv) + { + int size; + char *lib_name; + #ifdef DEBUG + char **argp; + #endif + + progname = *argv; + + argbuf_length = 10; + argbuf_index = 0; + argbuf = (char **) xmalloc (argbuf_length * sizeof (char *)); + + /* push default library search paths on lib_stack */ + lib_path = add_path (standard_startfile_prefix_2, (struct lib_path *)0); + lib_path = add_path (standard_startfile_prefix_1, lib_path); + lib_path = add_path (standard_startfile_prefix, lib_path); + + /* + * Copy argv to argbuf processing -L switches and + * resolving library names. Preserve the order of the arguments. + */ + store_arg ("ld"); /* provide argv[0] for ld */ + for (++argv; --argc > 0; ++argv) { + if ((*argv)[0] == '-') + switch ((*argv)[1]) { + case 'L': + lib_path = add_path ((*argv)+2, lib_path); + break; + case 'l': + lib_name = find_library ((*argv)+2); + #ifdef DEBUG + fprintf (stderr, "%s: found library %s\n", progname, lib_name); + #endif + store_arg (lib_name); + break; + default: + store_arg (*argv); + } + else + /* just an input file */ + store_arg (*argv); + } + #ifdef DEBUG + fprintf (stderr, "%s: linker call: \"", progname); + for (argp=argbuf; *argp; argp++) + fprintf (stderr, "%s ", *argp); + putc ('\n', stderr); + #endif + execv ("/bin/ld", argbuf); + /* maybe ld is not ld */ + fprintf (stderr, "%s: unable to run /bin/ld", progname); + exit (1); + } *** /dev/null Fri Jan 22 10:51:04 1993 --- config/i386/xm-xenix.h Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,22 ---- + /* Configuration for GCC for Intel i386 running SCO Xenix. */ + + #include "i386/xm-sysv3.h" + + /* On SCO 3.2.1, ldexp rejects values outside [0.5, 1). */ + + #define BROKEN_LDEXP + + /* Big buffers improve performance. */ + + #define IO_BUFFER_SIZE (0x8000 - 1024) + + #ifndef __GNUC__ + /* The SCO compiler gets it wrong, and treats enumerated bitfields + as signed quantities, making it impossible to use an 8-bit enum + for compiling GNU C++. */ + #define ONLY_INT_FIELDS 1 + #define CODE_FIELD_BUG 1 + #endif + + #define OBJECT_FORMAT_XOUT + #define NO_SYS_SIGLIST *** getpwd.c.old Tue Sep 21 21:35:41 1993 --- getpwd.c Wed Dec 29 14:00:00 1993 *************** *** 4,9 **** --- 4,10 ---- #include #include + #include #include #ifndef errno *** configure.old Fri Nov 19 21:44:34 1993 --- configure Wed Dec 29 14:00:00 1993 *************** *** 428,435 **** --- 428,444 ---- tm_file=i386/sco.h tmake_file=i386/t-sco fi truncate_target=yes ;; + i[34]86-*-xenix*) # 80386 running SCO Xenix + cpu_type=i386 + xm_file=i386/xm-xenix.h + tm_file=i386/xenix.h + xmake_file=i386/x-xenix + tmake_file=i386/t-xenix + broken_install=yes + use_collect2=yes + ;; i[34]86-*-isc*) # 80386 running ISC system cpu_type=i386 xm_file=i386/xm-isc.h *** collect2.c.old Wed Oct 20 23:12:32 1993 --- collect2.c Wed Dec 29 14:00:00 1993 *************** *** 107,112 **** In a cross-compiler, this means you need a cross nm, but that isn't quite as unpleasant as special headers. */ ! #if !defined (OBJECT_FORMAT_COFF) && !defined (OBJECT_FORMAT_ROSE) #define OBJECT_FORMAT_NONE #endif --- 107,112 ---- In a cross-compiler, this means you need a cross nm, but that isn't quite as unpleasant as special headers. */ ! #if !defined (OBJECT_FORMAT_COFF) && !defined (OBJECT_FORMAT_ROSE) && !defined(OBJECT_FORMAT_XOUT) #define OBJECT_FORMAT_NONE #endif *** collect2.c.old Wed Oct 20 23:12:32 1993 --- collect2.c Wed Dec 29 14:00:00 1993 *************** *** 2360,2362 **** --- 2360,2467 ---- } #endif /* OBJECT_FORMAT_ROSE */ + + #ifdef OBJECT_FORMAT_XOUT + + #include + #include + + #define IGNORE_ATTR (-1) + + struct xseg *seg_table; + long num_seg_table_entries; + + static void process_symbol_table(fp, segsize, name) + FILE *fp; + int segsize; + char *name; + { + char *symdata, *p; + long i; + struct sym symb; + + /* grab the symbol table */ + + symdata = alloca(segsize + 1); + if (fread(symdata, segsize, 1, fp) != 1) + fatal_perror("fread %s", name); + + p = symdata; + while (p < symdata + segsize) + { + int len; + + symb = *((struct sym *)p); + p += sizeof(struct sym); + + if ((symb.s_type & S_TYPE) == S_TEXT) + { + switch (is_ctor_dtor (p)) + { + case 1: + add_to_list (&constructors, p); + break; + + case 2: + add_to_list (&destructors, p); + break; + } + } + p += strlen(p) + 1; + } + } + + static read_seg_table(fp, pos, size, name) + FILE *fp; + long pos, size; + { + seg_table = (struct xseg *) xmalloc(size); + fseek(fp, pos, 0); + if (fread((char *)seg_table, size, 1, fp) != 1) + fatal_perror("collect cannot read seg table"); + num_seg_table_entries = size / sizeof (struct xseg); + } + + struct xseg *find_segment(type, attr) + int type, attr; + { + struct xseg *cseg; + + for (cseg = seg_table; cseg < seg_table + num_seg_table_entries; ++cseg) + if (cseg->xs_type == type && + (attr == IGNORE_ATTR || attr == cseg->xs_attr)) + return cseg; + return NULL; + } + + static void + scan_prog_file (prog_name, which_pass) + char *prog_name; + enum pass which_pass; + { + struct xexec exec_aouthdr; + struct xext *xext; + struct xseg *cseg; + FILE *fp; + + if (which_pass != PASS_FIRST) return; + + if ((fp = fopen(prog_name, "r")) == NULL) + fatal_perror("fopen %s", prog_name); + + if (fread((char *)&exec_aouthdr, sizeof(struct xexec), 1, fp) != 1) + fatal_perror("fread %s", prog_name); + + xext = (struct xext *) alloca(exec_aouthdr.x_ext); + if (fread((char *)xext, exec_aouthdr.x_ext, 1, fp) != 1) + fatal_perror("fread %s", prog_name); + + read_seg_table(fp, xext->xe_segpos, xext->xe_segsize, prog_name); + + if (cseg = find_segment(XS_TSYMS, 1)) + { + fseek(fp, cseg->xs_filpos, 0); + process_symbol_table(fp, cseg->xs_psize, prog_name); + } + } + #endif /* OBJECT_FORMAT_XOUT */ *** /dev/null Tue Jul 28 04:02:25 1992 --- config/i386/x-xenix Wed Dec 29 14:00:00 1993 *************** *** 0 **** --- 1,9 ---- + CC = gcc + OLDCC = gcc + CFLAGS = -O + INSTALL = cp + SYMLINK = ln + RANLIB = ranlib + RANLIB_TEST = true + SYSTEM_HEADER_DIR = /usr/local/lib/gcc-include + CLIB = -lx --- xenpatch.257 --ends------------ Cut Here -------------ends--xenpatch.257--- The groundwork (with the gcc 2.3.3 patchkit) done by : ------------------------------------------------------------------ Steve.Bleazard@RoboBar.Co.Uk | Phone: +44 81 991 1142 x153 Snr Software Engineer, Robobar Ltd. | Fax: +44 81 998 8343 (G3) 22 Wadsworth Road, Perivale. | Middx., UB6 7JD ENGLAND. | ...!ibmpcug!robobar!steve Don't sue him, these patches only SEEMS to work with gcc 2.5.7 too! The necessary 2.5.7 cosmetics done by : ------------------------------------------------------------------ Kai Ruottu, MScTech | Phone: +358 698 441265 Xenix/Unix support | Parasniementie 2 B 7 | SF-95450 Tornio, FINLAND |