jw@sics.se (Johan Widen) (03/02/90)
While trying to install g++ on the Sequent Symmetry I discovered that there were some mismatched #ifdef's in ld.c. My patch follows. I have tested this on the Sun-3, Sun-4 and the Sequent Symmetry. *** ../g++-1.37.0-/ld.c.org Tue Feb 6 01:06:31 1990 --- ld.c Thu Mar 1 11:12:14 1990 *************** *** 21,41 **** /* Define how to initialize system-dependent header fields. */ #ifdef sun /* Use Sun's TARGET convention. */ ! #ifndef TARGET ! #define SUN2 2 ! #define SUN3 3 ! #define SUN4 4 ! #if defined(sparc) ! #define TARGET SUN4 ! #else ! #if defined(mc68020) || defined(m68020) ! #define TARGET SUN3 #else ! #define TARGET SUN2 #endif #endif - #else - #define _CROSS_TARGET_ARCH TARGET /* locate the correct a.out.h file */ #endif #include <ar.h> --- 21,42 ---- /* Define how to initialize system-dependent header fields. */ #ifdef sun /* Use Sun's TARGET convention. */ ! #ifndef TARGET ! #define SUN2 2 ! #define SUN3 3 ! #define SUN4 4 ! #if defined(sparc) ! #define TARGET SUN4 #else ! #if defined(mc68020) || defined(m68020) ! #define TARGET SUN3 ! #else ! #define TARGET SUN2 ! #endif #endif + #else + #define _CROSS_TARGET_ARCH TARGET /* locate the correct a.out.h file */ #endif #endif #include <ar.h> *************** *** 118,187 **** /* Ordinary 4.3bsd lacks these macros in a.out.h. */ #ifndef N_TXTADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_TXTADDR(X) 0 ! #endif ! #ifdef is68k ! #define N_TXTADDR(x) (sizeof (struct exec)) ! #endif ! #ifdef sequent ! #define N_TXTADDR(x) (N_ADDRADJ(x)) ! #endif #endif #ifndef N_DATADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+((N_TXTADDR(x)+(x).a_text-1) & ~(page_size-1)))) ! #endif ! #ifdef is68k ! #define SEGMENT_SIZE 0x20000 ! #define N_DATADDR(x) \ (((x).a_magic==Omagic)? (N_TXTADDR(x)+(x).a_text) \ : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) ! #endif ! #ifdef sequent ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+(((x).a_text-1) & ~(page_size-1)))) ! #endif #endif ! #if TARGET == SUN4 ! #define INITIALIZE_HEADER \ ! {outheader.a_machtype = M_SPARC; outheader.a_toolversion = 1;} ! #endif ! #if TARGET == SUN2 ! #define INITIALIZE_HEADER outheader.a_machtype = M_68010 ! #endif ! #ifndef INITIALIZE_HEADER ! #define INITIALIZE_HEADER outheader.a_machtype = M_68020 ! #endif #endif #ifdef ALTOS ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_68020) #endif #ifdef is68k ! #ifdef M_68020 ! /* ISI rel 4.0D doesn't use it, and rel 3.05 doesn't have an ! a_machtype field and so won't recognize the magic number. To keep ! binary compatibility for now, just ignore it */ ! #define INITIALIZE_HEADER outheader.a_machtype = 0; ! #endif #endif #ifdef hpux ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, HP9000S200_ID) #endif #if defined(i386) && !defined(sequent) ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_386) #endif #ifdef is68k ! /* This enables code to take care of an ugly hack in the ISI OS. ! If a symbol beings with _$, then the object file is included only ! if the rest of the symbol name has been referenced. */ ! #define DOLLAR_KLUDGE #endif /* --- 119,189 ---- /* Ordinary 4.3bsd lacks these macros in a.out.h. */ #ifndef N_TXTADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_TXTADDR(X) 0 ! #endif ! #ifdef is68k ! #define N_TXTADDR(x) (sizeof (struct exec)) ! #endif ! #ifdef sequent ! #define N_TXTADDR(x) (N_ADDRADJ(x)) ! #endif #endif #ifndef N_DATADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+((N_TXTADDR(x)+(x).a_text-1) & ~(page_size-1)))) ! #endif ! #ifdef is68k ! #define SEGMENT_SIZE 0x20000 ! #define N_DATADDR(x) \ (((x).a_magic==Omagic)? (N_TXTADDR(x)+(x).a_text) \ : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) ! #endif ! #ifdef sequent ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+(((x).a_text-1) & ~(page_size-1)))) ! #endif #endif ! #ifdef sun ! #if TARGET == SUN4 ! #define INITIALIZE_HEADER \ ! {outheader.a_machtype = M_SPARC; outheader.a_toolversion = 1;} ! #endif ! #if TARGET == SUN2 ! #define INITIALIZE_HEADER outheader.a_machtype = M_68010 ! #endif ! #ifndef INITIALIZE_HEADER ! #define INITIALIZE_HEADER outheader.a_machtype = M_68020 ! #endif #endif #ifdef ALTOS ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_68020) #endif #ifdef is68k ! #ifdef M_68020 ! /* ISI rel 4.0D doesn't use it, and rel 3.05 doesn't have an ! a_machtype field and so won't recognize the magic number. To keep ! binary compatibility for now, just ignore it */ ! #define INITIALIZE_HEADER outheader.a_machtype = 0; ! #endif #endif #ifdef hpux ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, HP9000S200_ID) #endif #if defined(i386) && !defined(sequent) ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_386) #endif #ifdef is68k ! /* This enables code to take care of an ugly hack in the ISI OS. ! If a symbol beings with _$, then the object file is included only ! if the rest of the symbol name has been referenced. */ ! #define DOLLAR_KLUDGE #endif /* *************** *** 188,198 **** * Alloca include. */ #if defined(sun) && defined(sparc) && !defined(__GNUC__) ! #include "alloca.h" #endif #ifndef L_SET ! #define L_SET 0 #endif /* --- 190,200 ---- * Alloca include. */ #if defined(sun) && defined(sparc) && !defined(__GNUC__) ! #include "alloca.h" #endif #ifndef L_SET ! #define L_SET 0 #endif /* -- Johan Widen SICS, PO Box 1263, S-164 28 KISTA, SWEDEN Internet: jw@sics.se Tel: +46 8 752 15 32 Ttx: 812 61 54 SICS S Fax: +46 8 751 72 30