TRANLE@INTELLICORP.COM (Minh Tran-Le) (07/05/89)
After having struggle for a few days trying to get gnu emacs compile with ibm c compiler, I decided to switch to gcc to get the job done. The ibm c compiler has somewhere a bug that make unsuitable to compile gnu emacs but it can compile the first bootstrap phase of gcc. The recipe for building gnu emacs for the ps2 aix is the following: 1) get the gnu gcc compiler and configure it with the file tm-aix386.h and xm-aix386.h given below. Add to the config.gcc file: aix386 | ps2aix ) # for IBM PS/2 running AIX machine=aix386 cpu_type=i386 configuration_file=xm-${machine}.h target_machine=tm-${machine}.h ;; move tm-aix386.h and xm-aix386.h to the gcc/config directory. 2) configure and build gcc: config.gcc aix386 make bootstrap 3) copy the file m-ibmps2-aix.h to the emacs/src/ 4) modify the config.h file to use: s-usg5-2-2.h and m-ibmps2-aix.h 5) modify the emacs/src/Makefile to the CC environment variable CC = $(CC) -E 6) set the CC environment variable and build emacs CC=gcc ; export CC make There are still a few files in emacs that gcc couldn't compile by itself due to a bug the ibm assembler when it is trying to do span optimization. The assembler just dies in "* * panic * *" error. I don't how to get around it maybe some real gcc gurus have any suggestions. The files with problems are: buffer.c, data.c, eval.c, fns.c, minibuf.c, window.c . When that error occurs just execute the assemble step by hand. For example for window.c you would do: gcc -S -O -Demacs window.c edit the window.s file and replace the second line containing a .optim by a .noopt which should disable the span optimization by the assembler. as -s2 -o window.o window.s make ; to continue compiling emacs. There is also a runtime bug in that version of emacs: filename completion does not work. It must be something strange in the ps2/aix filesystem. I have built it with X11 and it seem to work fine except for the above bug. Minh Tran-Le arpanet: tranle@intellicorp.com uucp: ..sun!icmv!mtranle ----------------------- m-ibmps2-aix.h ------------------------------------- /* m- file for ibm ps/2 aix386. Copyright (C) 1987 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Refer to the GNU Emacs General Public License for full details. Everyone is granted permission to copy, modify and redistribute GNU Emacs, but only under the conditions described in the GNU Emacs General Public License. A copy of this license is supposed to have been given to you along with GNU Emacs so you can know your rights and responsibilities. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ /* The following three symbols give information on the size of various data types. */ #define SHORTBITS 16 /* Number of bits in a short */ #define INTBITS 32 /* Number of bits in an int */ #define LONGBITS 32 /* Number of bits in a long */ /* i386 is not big-endian: lowest numbered byte is least significant. */ /* #undef BIG_ENDIAN */ /* Define NO_ARG_ARRAY if you cannot take the address of the first of a * group of arguments and treat it as an array of the arguments. */ /* #define NO_ARG_ARRAY */ /* Define WORD_MACHINE if addresses and such have * to be corrected before they can be used as byte counts. */ /* #define WORD_MACHINE */ /* Define how to take a char and sign-extend into an int. On machines where char is signed, this is a no-op. */ #define SIGN_EXTEND_CHAR(c) (c) /* Now define a symbol for the cpu type, if your compiler does not define it automatically: Ones defined so far include vax, m68000, ns16000, pyramid, orion, tahoe, APOLLO and many others */ #define INTEL386 #define aix386 /* Use type int rather than a union, to represent Lisp_Object */ #define NO_UNION_TYPE /* crt0.c, if it is used, should use the i386-bsd style of entry. with no extra dummy args. On USG and XENIX, NO_REMAP says this isn't used. */ #define CRT0_DUMMIES bogus_fp, /* crt0.c should define a symbol `start' and do .globl with a dot. */ #define DOT_GLOBAL_START /* USG systems do not actually support the load average, so disable it for them. */ /* Define CANNOT_DUMP on machines where unexec does not work. Then the function dump-emacs will not be defined and temacs will do (load "loadup") automatically unless told otherwise. */ /* #define CANNOT_DUMP */ /* Define VIRT_ADDR_VARIES if the virtual addresses of pure and impure space as loaded can vary, and even their relative order cannot be relied on. Otherwise Emacs assumes that text space precedes data space, numerically. */ /* #define VIRT_ADDR_VARIES */ /* Define addresses, macros, change some setup for dump */ #define NO_REMAP #undef static /* Since NO_REMAP, problem with statics doesn't exist */ #define TEXT_START 0x00400000 #define TEXT_END 0 #define DATA_START 0x00800000 #define DATA_END 0 /* The data segment in this machine always starts at address 0x00800000. An address of data cannot be stored correctly in a Lisp object; we always lose the high bits. We must tell XPNTR to add them back. */ #define DATA_SEG_BITS 0x00800000 #if 0 /* I refuse to promulgate a recommendation that would make users unable to debug - RMS. */ /* delete the following line to foil optimization, enable debugging */ #define C_DEBUG_SWITCH -O #endif #define BSTRING #define HAVE_DUP2 #define HAVE_GETTIMEOFDAY #define HAVE_SELECT #define HAVE_TIMEVAL #define HAVE_VFORK /* But don't use utimes() -- it causes SIGSEGV! Use utime() instead. */ #define USE_UTIME /* AIX defines FIONREAD, but it does not work. */ #define BROKEN_FIONREAD /* Define C_ALLOCA if this machine does not support a true alloca and the one written in C should be used instead. Define HAVE_ALLOCA to say that the system provides a properly working alloca function and it should be used. Define neither one if an assembler-language alloca in the file alloca.s should be used. */ #ifdef __GNUC__ #define HAVE_ALLOCA #define alloca(n) __builtin_alloca(n) #define LIBS_MACHINE /usr/local/lib/gcc-gnulib -lbsd -lrts #else #define C_ALLOCA #define STACK_DIRECTION -1 /* tell alloca.c which way it grows */ #define LIBS_MACHINE -lbsd -lrts #endif #define OBJECTS_MACHINE hftctl.o #define LD_SWITCH_MACHINE -T0x00400000 -K -e start ---------------------- end of m-ibmps2-aix.h ---------------------------------- the following file is a diff file of sysdep.c. Same comment as for the IBMRTAIX, the file /usr/lib/samples/hftctl.c must be compiled into hftctl.o, with the result left in the src directory (hftctl.c is part of the standard AIX distribution). ----------------------------- sysdep.diff ------------------------------------- *** sysdep.c~ Thu Jun 29 18:46:35 1989 --- sysdep.c Tue Jul 4 15:47:26 1989 *************** *** 826,830 #endif ! #ifdef IBMRTAIX hft_init (); #endif --- 826,830 ----- #endif ! #ifdef AIX hft_init (); #endif *************** *** 1031,1035 #endif /* not VMS */ ! #ifdef IBMRTAIX hft_reset (); #endif --- 1031,1035 ----- #endif /* not VMS */ ! #ifdef AIX hft_reset (); #endif *************** *** 3511,3515 #endif /* VMS */ ! #ifdef IBMRTAIX /* Get files for keyboard remapping */ --- 3511,3515 ----- #endif /* VMS */ ! #ifdef AIX /* Get files for keyboard remapping */ *************** *** 3572,3574 } ! #endif IBMRTAIX --- 3572,3574 ----- } ! #endif /* AIX */ ----------------------- end of sysdep.diff ----------------------------------- here come the 2 files needed for gcc configuration. They are modification of the tm-i386v.h and xm-i386v.h ------------------------ tm-aix386.h ----------------------------------------- /* Definitions for IBM PS2 running AIX/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 ATT assembler syntax. */ #include "tm-att386.h" /* By default, target has a 80387. */ #define TARGET_DEFAULT 1 /* Use crt1.o as a startup file and crtn.o as a closing file. */ #define STARTFILE_SPEC \ "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}}" #define LIB_SPEC "%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} crtn.o%s" /* Specify predefined symbols in preprocessor. */ #define CPP_PREDEFINES "-Dunix -Di386 -DAIX" /* special flags for the aix assembler to generate the short form for all qualifying forward reference */ #define ASM_SPEC "-s2" /* Allow #sccs in preprocessor. */ #define SCCS_DIRECTIVE /* Output #ident as a .ident. */ #define ASM_OUTPUT_IDENT(FILE, NAME) fprintf (FILE, "\t.ident \"%s\"\n", NAME); /* We don't want to output SDB debugging information. */ #undef SDB_DEBUGGING_INFO #undef ASM_FILE_START #define ASM_FILE_START(FILE) \ do { fprintf (FILE, "\t.file\t\"%s\"\n", dump_base_name); \ if (optimize) ASM_FILE_START_1 (FILE); \ } while (0) /* This was suggested, but it shouldn't be right for DBX output. -- RMS #define ASM_OUTPUT_SOURCE_FILENAME(FILE, NAME) */ /* This is IBM AIX, it has a DBX debugger */ #define DBX_DEBUGGING_INFO /* Implicit library calls should use memcpy, not bcopy, etc. */ #define TARGET_MEM_FUNCTIONS /* 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) --------------------------- end of tm-aix386.h -------------------------------- --------------------------- xm-aix386.h --------------------------------------- /* Configuration for GNU C-compiler for IBM PS/2 running AIX/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 /* 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) #define LINK_SPEC "%{!K:-K} %{!T*:-T0x00400000} %{lg} %{g} %{z:-lm}" #ifdef __GNUC__ #define alloca(n) __builtin_alloca(n) #endif ---------------------------- end of xm-aix386.h ------------------------------