Xref: wupost comp.unix.xenix.sco:4108 alt.sources:3918 Path: wupost!uunet!mcsun!ukc!stl!robobar!ronald From: Steve.Bleazard@robobar.Co.Uk Newsgroups: comp.unix.xenix.sco,alt.sources Subject: Xenix Patch Kit for GAS 1.38.1/GCC 1.40/GDB 3.5 (part 3/4) Message-ID: Date: 27 Aug 91 14:27:13 GMT Sender: ronald@robobar.co.uk (Ronald S H Khoo) Organization: Robobar Ltd., Perivale, Middx., ENGLAND. Lines: 1351 X-Md4-Signature: e1d76c98f31452d65b8c0e7ece839772 Archive-Name: Xenix/gcc-1.40.pch This is part 3 of a 4 part posting. Part 1 (the README) describes this package *** gcc-1.40/Makefile Mon Jul 29 13:15:49 1991 --- Makefile Mon Jul 29 13:45:38 1991 *************** *** 157,162 **** --- 157,167 ---- # HARD_PARAMS_FLAGS= -Anansi # (Says vasta@apollo.com.) + # To compile GCC with Microsoft CC use the following CFLAGS and then + # 'make msc'. Note that the resultant cc1 CANNOT compile with optimization + # switched on, ie stage 2 should not have '-O' in CFLAGS + CFLAGS = -g $(XCFLAGS) + PRAGMA=pragmapack.o # Dependency on obstack, alloca, malloc or whatever library facilities # are not installed in the system libraries. *************** *** 192,198 **** symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \ integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \ regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \ ! insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o # Files to be copied away after each stage in building. STAGE_GCC=gcc --- 197,203 ---- symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \ integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \ regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \ ! insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o $(PRAGMA) # Files to be copied away after each stage in building. STAGE_GCC=gcc *************** *** 239,244 **** --- 244,257 ---- # is include the system varargs.h. all: config.status gnulib gcc cc1 cpp float.h gnulib2 # cc1plus + msc: config.status gnulib cc1 cpp float.h gcc.msc gnulib2 # cc1plus + + gcc.msc: cc1 cpp version.o $(LIBDEPS) + ./cpp -I/usr/include $(CPPFLAGS) $(INCLUDES) gcc.c > tmpgcc.i + -./cc1 -quiet $(CFLAGS) -o tmpgcc.s tmpgcc.i + /usr/local/lib/gcc-as -o gcc.o tmpgcc.s + rm -f tmpgcc.s + $(CC) $(CFLAGS) $(LDFLAGS) -o gcc gcc.o version.o $(LIBS) # Use this instead of `all' if you need to convert the libraries # before you can use the compiler. *************** *** 433,440 **** # from the GNU Emacs distribution. # Note some machines won't allow $(CC) without -S on this source file. alloca.o: alloca.c ! $(CC) $(CFLAGS) -S `echo $(srcdir)/alloca.c | sed 's,^\./,,'` ! as alloca.s -o alloca.o # Now the source files that are generated from the machine description. --- 446,452 ---- # from the GNU Emacs distribution. # Note some machines won't allow $(CC) without -S on this source file. alloca.o: alloca.c ! $(CC) $(CFLAGS) -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'` # Now the source files that are generated from the machine description. *** gcc-1.40/Makefile.msc --- Makefile.msc Wed Jul 10 16:36:39 1991 *************** *** 0 **** --- 1,22 ---- + # Microsoft C 5.1's built in cpp does not grok the large macros. + # Therefore use the AT&T cpp instead for the files that fail. + # Use this command line: + # make -f Makefile -f Makefile.msc msc ALLOCA=alloca.o + + explow.o: explow.c + /lib/cpp -P ${INCLUDES} explow.c >explow.i + mv explow.i x.c + cc ${CFLAGS} -c x.c + mv x.o explow.o + + reload.o: reload.c + /lib/cpp -P ${INCLUDES} reload.c >reload.i + mv reload.i x.c + cc ${CFLAGS} -c x.c + mv x.o reload.o + + recog.o: recog.c + /lib/cpp -P ${INCLUDES} recog.c >recog.i + mv recog.i x.c + cc ${CFLAGS} -c x.c + mv x.o recog.o *** gcc-1.40/c-parse.y Mon Jul 29 13:15:54 1991 --- c-parse.y Wed Jul 10 15:56:21 1991 *************** *** 1803,1808 **** --- 1803,1849 ---- && getc (finput) == 'm' && getc (finput) == 'a' && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n')) + #ifdef PRAGMA_PACK + { + token = yylex(); + if (token != IDENTIFIER) + goto skipline; + + if (strcmp(token_buffer, "pack") != 0) + goto skipline; + + token = yylex(); + if (token != '(') { + error ("invalid #pragma pack expecting '('"); + goto skipline; + } + + /* setup default alignment first */ + + pragma_pack_default(); + + token = yylex(); + if (token != ')') + { + if (token == CONSTANT + && TREE_CODE (yylval.ttype) == INTEGER_CST) { + int l = TREE_INT_CST_LOW (yylval.ttype); + pragma_pack(l); + } + else { + error ("invalid #pragma pack expecting 1, 2 or 4"); + goto skipline; + } + + token = yylex(); + } + + if (token != ')') { + error ("invalid #pragma pack expecting ')'"); + goto skipline; + } + } + #endif goto skipline; } *** gcc-1.40/config/tm-xenix386.h --- config/tm-xenix386.h Thu Aug 22 15:28:27 1991 *************** *** 0 **** --- 1,146 ---- + /* Definitions for Intel 386 running SCO XENIX 386. + Copyright (C) 1988 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 1, 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 "tm-i386.h" + + /* Use the XENIX GAS assembler syntax. */ + + #include "tm-xgas386.h" + + /* By default, target has a 80387 -- XENIX emulates it anyway */ + + #define TARGET_DEFAULT 1 + + /* Use crt1.o as a startup file and crtn.o as a closing file. */ + + #define STARTFILE_SPEC "Sseg.o%s %{!p:Scrt0.o%s} %{p:Smcrt0.o%s}" + #define STANDARD_STARTFILE_PREFIX_1 "/lib/386/" + + /* -v is appropriate for use with GAS */ + + #define ASM_SPEC "%{v} %{g}" + + #define LIB_SPEC "Slibcfp.a%s Slibc.a%s" + + #define FULL_LINK_SPEC "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l %{g:-g} \ + %{A} %{r} %{s} %{u*} \ + %{!nostdlib:%S} %{L*} %{!o:-o a.out} %o %{!nostdlib:gnulib%s %L gnulib%s}\n \ + }}}}"; + #define LINK_SPEC "-i" + + /* This is for use with G++. FASCIST_LDR is defined in G++'s Makefile */ + + #ifdef FASCIST_LDR + + #define FULL_COLLECT_SPEC \ + "%{!c:%{!M*:%{!E:%{!S:collect -o %g.S %g.R\n\ + as %g.S -o %g.O\n\ + ld %{o*} %{!o:-o a.out} %{!nostdlib:%S } %l %{g:-g} \ + %{L*} %o %g.O %{!nostdlib:gnulib++%s gnulib%s %L } \n\ + }}}}" + + #define PLUS_FULL_LINK_SPEC \ + "%{!c:%{!M*:%{!E:%{!S:ld -o %g.R \ + %{!nostdlib:%S } %l %{g:-g}\ + %{L*} %o %{!nostdlib:gnulib++%s gnulib%s g++dummy%s %L }\n }}}}"; + + #else /* not FASCIST_LDR */ + + #define FULL_COLLECT_SPEC \ + "%{!c:%{!M*:%{!E:%{!S:collect -o %g.S %g.R\n\ + as %g.S -o %g.O\n\ + ld %{o*} %{!o:-o a.out} %{!nostdlib:%S } %g.R %g.O \ + %{!nostdlib:gnulib++%s gnulib%s %L } \n\ + }}}}" + + #define PLUS_FULL_LINK_SPEC \ + "%{!c:%{!M*:%{!E:%{!S:ld -r -o %g.R %l %{g:-g}\ + %{L*} %o %{!nostdlib:%L }\n }}}}"; + + #endif /* not FASCIST_LDR */ + + /* Specify predefined symbols in preprocessor. */ + /* You may wish to add -DM_INTERNAT, depending on your libraries. */ + + #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" + + /* no #sccs in preprocessor. */ + + #undef SCCS_DIRECTIVE + + /* no #ident */ + + /* #define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME); */ + + /* 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 + + /* Writing `int' for a bitfield forces int alignment for the structure. */ + + #undef PCC_BITFIELD_TYPE_MATTERS + + /* Generate an external symbol request for __fltused if 80387 selected */ + + #undef ASM_FILE_START + #define ASM_FILE_START(FILE) \ + { fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name); \ + if (TARGET_80387) \ + fprintf (FILE, "\t.stabs\t\"__fltused\",0,0,0,0\n"); } + + + /* Machines that use the AT&T assembler syntax + also return floating point values in an FP register. */ + /* Define how to find the value returned by a function. + VALTYPE is the data type of the value (as a tree). + If the precise function being called is known, FUNC is its FUNCTION_DECL; + otherwise, FUNC is 0. */ + + #define VALUE_REGNO(MODE) \ + (((MODE)==SFmode || (MODE)==DFmode) ? FIRST_FLOAT_REG : 0) + + /* 1 if N is a possible register number for a function value. */ + + #define FUNCTION_VALUE_REGNO_P(N) ((N) == 0 || (N)== FIRST_FLOAT_REG) + + /* Put address tables in data segment */ + + #undef ASM_OUTPUT_CASE_LABEL + #define ASM_OUTPUT_CASE_LABEL(FILE,PREFIX,NUM,JUMPTABLE) \ + { data_section(); \ + ASM_OUTPUT_INTERNAL_LABEL(FILE,PREFIX,NUM); } + + #undef ASM_OUTPUT_CASE_END + #define ASM_OUTPUT_CASE_END(FILE,NUM,INSN) text_section() + + #undef FUNCTION_PROFILER + #define FUNCTION_PROFILER(FILE, LABELNO) \ + fprintf (FILE, "\tmovl $%sP%d,%%edx\n\tcall __mcount\n", LPREFIX, (LABELNO)); *** gcc-1.40/config/tm-xgas386.h --- config/tm-xgas386.h Wed Jul 10 15:56:17 1991 *************** *** 0 **** --- 1,253 ---- + /* Definitions for AT&T assembler syntax for the Intel 80386. + Copyright (C) 1988 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 1, 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. */ + + + #ifdef PRAGMA_PACK + #define TARGET_VERSION fprintf (stderr, " (80386, Xenix GAS syntax, #pragma pack() support included)"); + #else + #define TARGET_VERSION fprintf (stderr, " (80386, Xenix GAS syntax)"); + #endif + + /* Define the syntax of instructions and addresses. */ + + /* Define some concatenation macros to concatenate an opcode + and one, two or three operands. In other assembler syntaxes + they may alter the order of ther operands. */ + + #ifdef __STDC__ + #define AS2(a,b,c) #a " " #b "," #c + #define AS3(a,b,c,d) #a " " #b "," #c "," #d + #define AS1(a,b) #a " " #b + #else + #define AS1(a,b) "a b" + #define AS2(a,b,c) "a b,c" + #define AS3(a,b,c,d) "a b,c,d" + #endif + + /* Output the size-letter for an opcode. + CODE is the letter used in an operand spec (L, B, W, S or Q). + CH is the corresponding lower case letter + (except if CODE is L then CH is `l'). */ + #define PUT_OP_SIZE(CODE,CH,FILE) putc (CH,(FILE)) + + /* Opcode suffix for fullword insn. */ + #define L_SIZE "l" + + /* Prefix for register names in this syntax. */ + #define RP "%" + + /* Prefix for immediate operands in this syntax. */ + #define IP "$" + + /* Prefix for internally generated assembler labels. */ + #define LPREFIX ".L" + + /* Output the prefix for an immediate operand, or for an offset operand. */ + #define PRINT_IMMED_PREFIX(FILE) fputs ("$", (FILE)) + #define PRINT_OFFSET_PREFIX(FILE) fputs ("$", (FILE)) + + /* Indirect call instructions should use `*'. */ + #define USE_STAR 1 + + /* Prefix for a memory-operand X. */ + #define PRINT_PTR(X, FILE) + + /* Delimiters that surround base reg and index reg. */ + #define ADDR_BEG(FILE) putc('(', (FILE)) + #define ADDR_END(FILE) putc(')', (FILE)) + + /* Print an index register (whose rtx is IREG). */ + #define PRINT_IREG(FILE,IREG) \ + do \ + { fputs (",", (FILE)); PRINT_REG ((IREG), 0, (FILE)); } \ + while (0) + + /* Print an index scale factor SCALE. */ + #define PRINT_SCALE(FILE,SCALE) \ + if ((SCALE) != 1) fprintf ((FILE), ",%d", (SCALE)) + + /* Print a base/index combination. + BREG is the base reg rtx, IREG is the index reg rtx, + and SCALE is the index scale factor (an integer). */ + + #define PRINT_B_I_S(BREG,IREG,SCALE,FILE) \ + { ADDR_BEG (FILE); \ + if (BREG) PRINT_REG ((BREG), 0, (FILE)); \ + if ((IREG) != 0) \ + { PRINT_IREG ((FILE), (IREG)); \ + PRINT_SCALE ((FILE), (SCALE)); } \ + ADDR_END (FILE); } + + /* Define the syntax of pseudo-ops, labels and comments. */ + + /* Assembler pseudos to introduce constants of various size. */ + + #define ASM_BYTE "\t.byte " + #define ASM_SHORT "\t.value " + #define ASM_LONG "\t.long " + #define ASM_DOUBLE "\t.double " + + /* String containing the assembler's comment-starter. */ + + #define COMMENT_BEGIN "/" + + /* Output at beginning of assembler file. */ + /* The .file command should always begin the output. */ + + #undef ASM_FILE_START + #define ASM_FILE_START(FILE) \ + fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name); + + /* Don't write a `.optim' pseudo; this assembler doesn't handle them. */ + + #undef ASM_FILE_START_1 + #define ASM_FILE_START_1(FILE) + + /* Output to assembler file text saying following lines + may contain character constants, extra white space, comments, etc. */ + + #define ASM_APP_ON "/APP\n" + + /* Output to assembler file text saying following lines + no longer contain unusual constructs. */ + + #define ASM_APP_OFF "/NO_APP\n" + + /* This is how to output an assembler line + that says to advance the location counter by SIZE bytes. */ + + #define ASM_OUTPUT_SKIP(FILE,SIZE) \ + fprintf ((FILE), "\t.set .,.+%d\n", (SIZE)) + + /* Output before read-only data. */ + + #define TEXT_SECTION_ASM_OP ".text" + + /* Output before writable data. */ + + #define DATA_SECTION_ASM_OP ".data" + + /* Define the syntax of labels and symbol definitions/declarations. */ + + /* This says how to output an assembler line + to define a global common symbol. */ + /* We don't use ROUNDED because the standard compiler doesn't, + and the linker gives error messages if a common symbol + has more than one length value. */ + + #define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \ + ( fputs (".comm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%d\n", (SIZE))) + + /* This says how to output an assembler line + to define a local common symbol. */ + + /* Try lcomm to generate local bss + * + * #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ + * (data_section (), \ + * ASM_OUTPUT_LABEL ((FILE), (NAME)), \ + * fprintf ((FILE), "\t.set .,.+%d\n", (ROUNDED))) + */ + #define ASM_OUTPUT_LOCAL(FILE, NAME, SIZE, ROUNDED) \ + ( fputs (".lcomm ", (FILE)), \ + assemble_name ((FILE), (NAME)), \ + fprintf ((FILE), ",%d\n", (SIZE))) + + + /* This is how to output an assembler line + that says to advance the location counter + by a multiple of 2**LOG bytes. */ + + #define ASM_OUTPUT_ALIGN(FILE,LOG) \ + if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG)) + + /* 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'. */ + + #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. */ + + #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. */ + + #define ASM_OUTPUT_LABELREF(FILE,NAME) \ + fprintf (FILE, "_%s", NAME) + + /* This is how to output a command to make the user-level label named NAME + defined for reference from other files. */ + + #define ASM_GLOBALIZE_LABEL(FILE,NAME) \ + (fputs (".globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE)) + + /* How to output an ASCII string constant. */ + + #define ASM_OUTPUT_ASCII(FILE, p, size) \ + { int i=0; \ + while (i < size) \ + { if (i%10 == 0) { if (i!=0) fprintf (FILE, "\n"); \ + fprintf (FILE, ASM_BYTE); } \ + else fprintf (FILE, ","); \ + fprintf (FILE, "0x%x",(p[i++] & 0377)) ;} \ + fprintf (FILE, "\n"); } + + #define EXTRA_SECTIONS in_cdata + + /* Define the additional functions to select our additional sections. */ + + #define CDATA_SECTION_ASM_OP ".data 1" + + #define EXTRA_SECTION_FUNCTIONS \ + void \ + cdata_section () \ + { \ + if (in_section != in_cdata) \ + { \ + fprintf (asm_out_file, "%s\n", CDATA_SECTION_ASM_OP); \ + in_section = in_cdata; \ + } \ + } + + /* Given a decl node or constant node, choose the section to output it in + and select that section. */ + + /* following takes care of constants emitted from + the hash table entries (see above comment) + */ + #define SELECT_SECTION_MODE(MODE,RTX) cdata_section(); + #define SELECT_RTX_SECTION(MODE, RTX) cdata_section(); + #define SELECT_SECTION(DECL) \ + { if (TREE_CODE (DECL) == STRING_CST) { \ + if (flag_writable_strings) \ + data_section (); \ + else \ + cdata_section (); \ + } \ + else if (TREE_READONLY (DECL) && ! TREE_VOLATILE (DECL)) \ + cdata_section (); \ + else \ + data_section (); } *** gcc-1.40/config/xm-xenix386.h --- config/xm-xenix386.h Fri Jul 12 07:43:58 1991 *************** *** 0 **** --- 1,55 ---- + /* Configuration for GNU C-compiler for Intel 80386 running SCO Xenix 386 + Copyright (C) 1988 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 1, 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. */ + + + /* #defines that need visibility everywhere. */ + #define FALSE 0 + #define TRUE 1 + + /* This describes the machine the compiler is hosted on. */ + #define HOST_BITS_PER_CHAR 8 + #define HOST_BITS_PER_SHORT 16 + #define HOST_BITS_PER_INT 32 + #define HOST_BITS_PER_LONG 32 + + /* Arguments to use with `exit'. */ + #define SUCCESS_EXIT_CODE 0 + #define FATAL_EXIT_CODE 33 + + #define USG + + #ifndef __GNUC__ + #define register auto /* Register variables are broken */ + #endif + + /* target machine dependencies. + tm.h is a symbolic link to the actual target specific file. */ + #include "tm.h" + + #define bcopy(a,b,c) memcpy (b,a,c) + #define bzero(a,b) memset (a,0,b) + #define bcmp(a,b,c) memcmp (a,b,c) + + #ifdef __GNUC__ + #define alloca(n) __builtin_alloca(n) + #endif + + /* Implement Microsoft C compatible #pragma pack() */ + + #define PRAGMA_PACK *** gcc-1.40/config.gcc Mon Jul 29 13:16:42 1991 --- config.gcc Wed Jul 10 15:56:16 1991 *************** *** 331,336 **** --- 331,340 ---- # 370) # machine=370 # ;; + xenix386) # for SCO Xenix/386 + cpu_type=i386 + configuration_file=xm-${machine}.h + ;; esac # if cpu_type is not set, define cpu_type to machine. *** gcc-1.40/gcc.c Mon Jul 29 13:16:57 1991 --- gcc.c Fri Jul 12 08:15:31 1991 *************** *** 303,312 **** --- 303,316 ---- }; /* Here is the spec for running the linker, after compiling all files. */ + #ifdef FULL_LINK_SPEC + char *link_spec = FULL_LINK_SPEC + #else char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l\ %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\ %{y*} %{!A:%{!nostdlib:%S}} \ %{L*} %o %{!nostdlib:%G gnulib%s %L gnulib%s %{!A:%E}}\n }}}}"; + #endif /* Accumulate a command (program name and args), and run it. */ *************** *** 361,368 **** #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/"; char *standard_startfile_prefix_2 = "/usr/lib/"; /* Clear out the vector of arguments (after a command is executed). */ --- 365,376 ---- #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 */ + char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; ! char *standard_startfile_prefix_1 = STANDARD_STARTFILE_PREFIX_1; char *standard_startfile_prefix_2 = "/usr/lib/"; /* Clear out the vector of arguments (after a command is executed). */ *************** *** 1383,1389 **** char * handle_braces (p) ! register char *p; { register char *q; char *filter; --- 1391,1397 ---- char * handle_braces (p) ! char *p; { register char *q; char *filter; *** gcc-1.40/pragmapack.c --- pragmapack.c Wed Jul 10 16:57:32 1991 *************** *** 0 **** --- 1,26 ---- + #define DEFAULT_ALIGN 32 + + static int pack_align = DEFAULT_ALIGN; + static int was_pragma = 0; + + pragma_pack(val) + int val; + { + pack_align = 8 * val; + was_pragma = 1; + } + + pragma_align_val() + { + return pack_align; + } + + pragma_pack_default() + { + pack_align = DEFAULT_ALIGN; + } + + int pragma_pack_seen() + { + return was_pragma; + } *** gcc-1.40/stor-layout.c Mon Jul 29 13:17:35 1991 --- stor-layout.c Wed Jul 10 15:56:23 1991 *************** *** 514,519 **** --- 514,523 ---- or some divisor of it. */ layout_decl (field, var_size ? size_unit : const_size); + #ifdef PRAGMA_PACK + if (pragma_pack_seen()) + DECL_ALIGN(field) = MIN(pragma_align_val(), DECL_ALIGN(field)); + #endif desired_align = DECL_ALIGN (field); /* Record must have at least as much alignment as any field. *** gcc-1.40/c-parse.tab.c Mon Jul 29 13:21:25 1991 --- c-parse.tab.c Mon Jul 29 13:53:35 1991 *************** *** 3201,3206 **** --- 3205,3251 ---- && getc (finput) == 'm' && getc (finput) == 'a' && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n')) + #ifdef PRAGMA_PACK + { + token = yylex(); + if (token != IDENTIFIER) + goto skipline; + + if (strcmp(token_buffer, "pack") != 0) + goto skipline; + + token = yylex(); + if (token != '(') { + error ("invalid #pragma pack expecting '('"); + goto skipline; + } + + /* setup default alignment first */ + + pragma_pack_default(); + + token = yylex(); + if (token != ')') + { + if (token == CONSTANT + && TREE_CODE (yylval.ttype) == INTEGER_CST) { + int l = TREE_INT_CST_LOW (yylval.ttype); + pragma_pack(l); + } + else { + error ("invalid #pragma pack expecting 1, 2 or 4"); + goto skipline; + } + + token = yylex(); + } + + if (token != ')') { + error ("invalid #pragma pack expecting ')'"); + goto skipline; + } + } + #endif goto skipline; } *** fix.h.xenix --- fix.h.xenix Thu Aug 22 21:18:21 1991 *************** *** 0 **** --- 1,198 ---- + # @(#) $Id: fix.h.xenix,v 1.3 1991/08/22 05:39:05 ronald Exp $ + # + # (C) Copyright 1990, 1991 Ronald Khoo + # Permission granted to use or abuse this program for any purpose, + # provided that all modified copies are clearly marked as such. + # No warranty is given for the fitness of this program for any purpose. + # + # Please treat this file as a document saying what I did and not really + # a program. i.e. Please read it through before considering running it. + # + # This is a quick hack to fix the SCO Xenix 386 include files so that + # they work with gcc at all. No attempt has been made to do this + # in a general way whatsoever, and this script was not made with any + # reference to the GCC fixincludes script: I still have no idea what + # that does. This works (ish) for me. Your mileage may vary. + # My include files were from the 2.3.4 operating system and the 2.3.1b + # development system. + # + # What the script does do: + # + # * stream edit files from /usr/include and /usr/include/sys + # into /usr/local/lib/gcc-include, skipping those which are + # provided by GCC. + # * make all references to M_I386 refer to __M_I386__ instead. + # This enables programs compiled with gcc -ansi not to coredump. + # This only works with gcc so don't give these hacked .h files to cc !! + # * put protection #ifdef tests to all files to allow them to be safely + # multiply included. + # * time_t and size_t seem to be typedefed all over the place. Protect them. + # * remove definition and use of va_list in stdio.h -- that's bogus. + # (SCO has already fixed this one in 2.3.1) + # * make types of SIG_IGN, etc consistently void * in sys/signal.h + # (to be consistent with ) + # * various other individual hacks I've come across. Note that these + # are entirely ad-hoc. You can find them in the lines starting with + # sed_=" + # + # In particular, the ad-hocery was intended to make rcs 5.5 compile without + # hacking, even with all the recommended warning options set. + # It doesn't quite work -- rcs 5.5's configuration script is slightly broken. + # I hate gratuitous declarations. + # + # Note that this is only a beginning. I keep finding annoyances which + # have to be fixed by hand. Many prototypes are wrong in places like + # , etc. An afternoon spent with an editor in one + # hand and the ANSI standard in the other would probably not go amiss. + # + # This script will probably fall flat on its face if you've already + # modified the system include files to do what it wants to do. + # Starting from a fresh set may be a reasonable approach. + # + # $Log: fix.h.xenix,v $ + # Revision 1.3 1991/08/22 05:39:05 ronald + # pre-release version for gfm@mencon.oz to try out. + # + # Revision 1.2 1991/08/19 10:55:30 ronald + # Interim release for gcc 1.40, beta testers. + # + # Revision 1.1 90/04/25 18:51:21 ronald + # Initial revision + # + + PATH=/etc:/bin:/usr/bin export PATH + + # usage: /usr/local/lib/fix.h.xenix + + lib=${lib-/usr/local/lib} + include=$lib/gcc-include + stdinc=${stdinc-/usr/include} + + sed_mi386=" -e '/\\([^_]\\)M_I386/s//\\1__M_I386__/g'" + sed_timet=" -e '/typedef.*[ ]time_t/ { + i\\ + #ifndef _TIME_T + i\\ + #define _TIME_T + a\\ + #endif /* _TIME_T */ + }'" + sed_sizet=" -e '/typedef.*[ ]size_t/ { + i\\ + #ifndef _SIZE_T + i\\ + #define _SIZE_T + a\\ + #endif /* _SIZE_T */ + }'" + # No prizes for guessing what this macro is used for. + # Also, no prizes for guessing which editor I use. + # :s/^[ ]*\([^( ]*\)[ ]*\((.*\);[ ]*$/ \/\\\\(\1[ ]*\\\\)([^)][^)]*)\/s\/\/\\\\1 \2\// + # + sed_param=" -e ' + /\(\/\*[^/]*\)\/\*/s//\1 *\/ \/*/ + /^\/\*.*\/\*.*pdp11[ ]*\$/s/\$/*\// + '" + sed_errno=" -e ' + /\\(perror[ ]*\\)([^)][^)]*)/s//\\1 ( const char * )/ + '" + sed_stdlib=" -e ' + /\\(getenv[ ]*\\)([^)][^)]*)/s//\\1 (const char *)/ + /\\(atoi[ ]*\\)([^)][^)]*)/s//\\1 (const char *)/ + /.*\\(free[ ]*\\)([^)][^)]*)/s//extern void \\1 ( void * )/ + /.*\\(malloc[ ]*\\)([^)][^)]*)/s//extern void *\\1 (unsigned)/ + /.*\\(realloc[ ]*\\)([^)][^)]*)/s//extern void *\\1 (void *, unsigned)/ + /.*\\(calloc[ ]*\\)([^)][^)]*)/s//extern void *\\1 (unsigned, unsigned)/ + '" + sed_stdio=" -e ' + /\\(printf[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, ...)/ + /\\(fprintf[ ]*\\)([^)][^)]*)/s//\\1 ( FILE *, const char *, ... )/ + /\\(vfprintf[ ]*\\)([^)][^)]*)/s//\\1 ( FILE *, const char *, char * )/ + /\\(vprintf[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, char * )/ + /\\(sprintf[ ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, ... )/ + /\\(vsprintf[ ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, char * )/ + /\\(fopen[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, const char * )/ + /\\(fdopen[ ]*\\)([^)][^)]*)/s//\\1 ( int, const char * )/ + /\\(fputs[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, FILE * )/ + /\\(fread[ ]*\\)([^)][^)]*)/s//\\1 ( void *, size_t, size_t, FILE * )/ + /\\(fwrite[ ]*\\)([^)][^)]*)/s//\\1 ( const void *, size_t, size_t, FILE * )/ + /typedef.*va_list/d + /va_list/s//char */ + '" + sed_string=" -e ' + /\\(strlen[ ]*\\)([^)][^)]*)/s//\\1 ( const char * )/ + /\\(strcat[ ]*\\)([^)][^)]*)/s//\\1 ( char *, const char * )/ + /\\(strncat[ ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, int )/ + /\\(strcpy[ ]*\\)([^)][^)]*)/s//\\1 ( char *, const char * )/ + /\\(strncpy[ ]*\\)([^)][^)]*)/s//\\1 ( char *, const char *, int )/ + /\\(strchr[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, int )/ + /\\(strrchr[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, int )/ + /\\(strcmp[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, const char * )/ + /\\(strncmp[ ]*\\)([^)][^)]*)/s//\\1 ( const char *, const char *, int )/ + /define.*strerror.*;[ ]*\$/s/;[ ]*\$// + '" + sed_signal=" -e '/int.*(\\*)/s/int/void/g'" + sed_error=" -e '/^[ ]*ERROR[ ]\\(.*\\)\$/ { + s//\\1/ + s/\"//g + s/[ ][ ]*/ /g + s/.*/ #error \"&\"/ + }'" + + hackit() + { + echo "\r \rHacking $1\c" >&2 + idemp= + expr "`sed 1q $1`" : '.*ifn.*_H.*' > /dev/null && idemp=yes + test "$idemp" || { + name=_INCLUDED_`echo $1 | tr './[a-z]' '__[A-Z]'`_AUTOFIX + echo "#ifndef $name" > $include/$1 + echo "#define $name" >> $include/$1 + } + script="$sed_mi386" + grep -s size_t $1 > /dev/null && + grep -s _SIZE_T $1 > /dev/null || script="$script $sed_sizet" + grep -s time_t $1 > /dev/null && + grep -s _TIME_T $1 > /dev/null || script="$script $sed_timet" + case $1 in + errno.h) script="$script $sed_errno" ;; + stdlib.h) script="$script $sed_stdlib" ;; + string.h) script="$script $sed_string" ;; + stdio.h) script="$script $sed_errno $sed_stdio" ;; + sys/param.h) script="$script $sed_param" ;; + sys/signal.h) script="$script $sed_signal" ;; + curses.h|sys/emap.h|sys/param.h|sys/sxt.h) + script="$script $sed_error" ;; + esac + eval sed "$script" $1 >> $include/$1 + test "$idemp" || echo "#endif /* $name */" >> $include/$1 + } + + [ -d $include ] || mkdir $include + [ -d $include/sys ] || mkdir $include/sys + + cd $stdinc || exit 1 + echo "\rHacking files from $stdinc into $include" >&2 + + # This bit is useful for hacking the sed scripts above. + # for i in sys/param.h # stdio.h stdlib.h errno.h curses.h string.h + # do hackit $i ; done + # exit 1 + + for i in *.h + do + case $i in + # Use the GCC supplied versions of these files: + assert.h|float.h|limits.h|stdarg.h|stddef.h|varargs.h) ;; + *) hackit $i ;; + esac + done + + echo "\rHacking files from $stdinc/sys into $include/sys" >&2 + for i in sys/*.h ; do hackit $i ; done + + cd $include + cd sys ; chgrp bin . *.h ; chmod 664 *.h ; chmod 775 . ; chown bin . *.h + cd .. ; chgrp bin . *.h ; chmod 664 *.h ; chmod 775 . ; chown bin . *.h + + echo '\r..... done. Have a nice day. --Ronald' >&2 *** fixmin.xenix --- fixmin.xenix Thu Aug 22 21:09:28 1991 *************** *** 0 **** --- 1,76 ---- + # $Id: fixmin.xenix,v 1.1 1991/08/22 20:06:32 ronald Exp $ + # Change Log is at the end of the file. + # + # This is the bare minimum of header fixing that I could get away with + # in order to compile GCC. This applies to Xenix 2.3.3 with 2.3.1 + # Development System. You're on your own with other versions. + # These changes should only be in effect while building gcc. + # You should undo them, and replace the fixes with something better + # in /usr/local/lib/gcc-include once you've installed gcc. + + # usage: fixmin.xenix [ undo ] + # If the "undo" parameter is specified, reverses the actions of a + # previous run of fixmin. + + cd /usr/include + + if test "$1" = undo ; then + for i in *.bfm ; do + j=`basename $i .bfm` + mv $i $j + echo restored $j >&2 + done + cd sys + for i in *.bfm ; do + j=`basename $i .bfm` + mv $i $j + echo restored sys/$j >&2 + done + exit 0 + fi + + for i in stdio.h time.h string.h sys/types.h ; do + if egrep '(_SIZE_T|_TIME_T)' $i > /dev/null || test -r $i.bfm; then + : do nothing, already there + else + echo fixing $i + sed '/typedef.*[ ]size_t/ { + i\ + #ifndef _SIZE_T + i\ + #define _SIZE_T + a\ + #endif + } + /typedef.*[ ]time_t/ { + i\ + #ifndef _TIME_T + i\ + #define _TIME_T + a\ + #endif + }' $i > $i.new + mv $i $i.bfm + mv $i.new $i + fi + done + + if sed 1q stdio.h | grep -s 'ifndef[ ][ ]*FILE' > /dev/null ; then + : do nothing -- already there. + else + echo stdio.h once more ... + ed stdio.h <<-\EOF + 0a + #ifndef FILE + . + $a + #endif + . + w + EOF + fi + # + # $Log: fixmin.xenix,v $ + # Revision 1.1 1991/08/22 20:06:32 ronald + # Initial revision + # *** xenixld.c --- xenixld.c Thu Aug 22 21:17:40 1991 *************** *** 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); + } -- 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. | ...!ukc!robobar!steve