From 8e3d11580a618ef60a4581c69d9db5fced2ddd9c Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 28 Aug 1992 00:08:13 +0000 Subject: [PATCH] Thu Aug 27 17:01:04 1992 Ian Lance Taylor (ian@cygnus.com) * targets.c, config/i960-bout.mt, hosts/*: added HOST_BIG_ENDIAN_DEFAULT_VECTOR and HOST_LITTLE_ENDIAN_DEFAULT_VECTOR because bout archive format depends on the endianness of the host. Added #define HOST_BIG_ENDIAN_P and #undef HOST_BIG_ENDIAN_P to a number of configuration files in hosts/ (it was already in some). --- bfd/ChangeLog | 9 +++++++++ bfd/hosts/amix.h | 2 ++ bfd/hosts/apollo68.h | 2 ++ bfd/hosts/apollov68.h | 2 ++ bfd/hosts/decstation.h | 18 +++--------------- bfd/hosts/delta88.h | 1 + bfd/hosts/dgux.h | 2 ++ bfd/hosts/dose.h | 2 ++ bfd/hosts/go32.h | 2 ++ bfd/hosts/harris.h | 3 +++ bfd/hosts/hp9000.h | 2 ++ bfd/hosts/hppabsd.h | 2 ++ bfd/hosts/hppahpux.h | 3 +++ bfd/hosts/i386mach.h | 2 ++ bfd/hosts/i386v.h | 2 ++ bfd/hosts/i386v4.h | 2 ++ bfd/hosts/irix3.h | 2 ++ bfd/hosts/irix4.h | 2 ++ bfd/hosts/ncr3000.h | 2 ++ bfd/hosts/news.h | 43 ++++++++++++++---------------------------- bfd/hosts/rs6000.h | 2 ++ bfd/hosts/rtbsd.h | 1 + bfd/hosts/solaris2.h | 2 ++ bfd/hosts/sparc-ll.h | 2 ++ bfd/hosts/sparc.h | 2 ++ bfd/hosts/stratus.h | 2 ++ bfd/hosts/sun3.h | 1 + bfd/hosts/ultra3.h | 2 ++ bfd/hosts/we32k.h | 2 ++ bfd/targets.c | 37 ++++++++++++++++++++++++++++++++++-- 30 files changed, 112 insertions(+), 46 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f103442d6f4..99b543224f4 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +Thu Aug 27 17:01:04 1992 Ian Lance Taylor (ian@cygnus.com) + + * targets.c, config/i960-bout.mt, hosts/*: added + HOST_BIG_ENDIAN_DEFAULT_VECTOR and + HOST_LITTLE_ENDIAN_DEFAULT_VECTOR because bout archive format + depends on the endianness of the host. Added #define + HOST_BIG_ENDIAN_P and #undef HOST_BIG_ENDIAN_P to a number of + configuration files in hosts/ (it was already in some). + Thu Aug 27 13:05:28 1992 Brendan Kehoe (brendan@cygnus.com) Add preliminary support for the we32k: diff --git a/bfd/hosts/amix.h b/bfd/hosts/amix.h index ed0a1db7418..d73c10e4422 100644 --- a/bfd/hosts/amix.h +++ b/bfd/hosts/amix.h @@ -47,6 +47,8 @@ extern long atol(); extern int fputc(); extern int unlink(); +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/apollo68.h b/bfd/hosts/apollo68.h index ce68846bed9..569cde40a6f 100644 --- a/bfd/hosts/apollo68.h +++ b/bfd/hosts/apollo68.h @@ -27,6 +27,8 @@ extern PTR EXFUN(realloc, (PTR, unsigned)); extern void EXFUN( free,(PTR)); #endif +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/apollov68.h b/bfd/hosts/apollov68.h index 13793ffab8e..1bc38210d6a 100644 --- a/bfd/hosts/apollov68.h +++ b/bfd/hosts/apollov68.h @@ -50,6 +50,8 @@ extern PTR EXFUN(realloc, (PTR, unsigned)); extern void EXFUN( free,(PTR)); #endif +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/decstation.h b/bfd/hosts/decstation.h index 64a5e92b68e..49e945a4d13 100644 --- a/bfd/hosts/decstation.h +++ b/bfd/hosts/decstation.h @@ -23,22 +23,10 @@ #define HOST_TEXT_START_ADDR USRTEXT #define HOST_DATA_START_ADDR USRDATA #define HOST_STACK_END_ADDR USRSTACK -/* Macros for the 'type' part of an fopen, freopen or fdopen. - [Update] - */ -#define FOPEN_RB "r" -#define FOPEN_WB "w" -#define FOPEN_AB "a" -#define FOPEN_RUB "r+" -#define FOPEN_WUB "w+" -#define FOPEN_AUB "a+" -#define FOPEN_RT "r" -#define FOPEN_WT "w" -#define FOPEN_AT "a" -#define FOPEN_RUT "r+" -#define FOPEN_WUT "w+" -#define FOPEN_AUT "a+" +#undef HOST_BIG_ENDIAN_P + +#include "fopen-same.h" /* EXACT TYPES */ typedef char int8e_type; diff --git a/bfd/hosts/delta88.h b/bfd/hosts/delta88.h index 4337d22f65c..f8d65b95eed 100644 --- a/bfd/hosts/delta88.h +++ b/bfd/hosts/delta88.h @@ -59,6 +59,7 @@ extern char *getenv(); extern int fputc(); extern int unlink(); +#define HOST_BIG_ENDIAN_P /* EXACT TYPES */ typedef char int8e_type; diff --git a/bfd/hosts/dgux.h b/bfd/hosts/dgux.h index 08479826727..b89dd83e27c 100644 --- a/bfd/hosts/dgux.h +++ b/bfd/hosts/dgux.h @@ -11,6 +11,8 @@ #include +#define HOST_BIG_ENDIAN_P + #ifndef DONTDECLARE_MALLOC extern PTR EXFUN(malloc,(unsigned)); extern PTR EXFUN(realloc, (PTR, unsigned)); diff --git a/bfd/hosts/dose.h b/bfd/hosts/dose.h index 359d15b34c4..1dff45a48a5 100644 --- a/bfd/hosts/dose.h +++ b/bfd/hosts/dose.h @@ -12,6 +12,8 @@ #define SEEK_SET 0 #define SEEK_CUR 1 +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/go32.h b/bfd/hosts/go32.h index 92d80bc490a..43483f910f9 100644 --- a/bfd/hosts/go32.h +++ b/bfd/hosts/go32.h @@ -16,6 +16,8 @@ #define POSIX_UTIME #define NO_FCNTL +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/harris.h b/bfd/hosts/harris.h index 274ccbdf9b9..e9b1bc8647c 100644 --- a/bfd/hosts/harris.h +++ b/bfd/hosts/harris.h @@ -21,6 +21,9 @@ extern void EXFUN(exit,(int)); extern void EXFUN(bzero,(char *, int)); extern int strtol(); + +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/hp9000.h b/bfd/hosts/hp9000.h index e1c8bb775ba..83babcd92d6 100644 --- a/bfd/hosts/hp9000.h +++ b/bfd/hosts/hp9000.h @@ -47,6 +47,8 @@ rename(from, to) # endif */ +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/hppabsd.h b/bfd/hosts/hppabsd.h index 44911367cfa..770d7e59d33 100644 --- a/bfd/hosts/hppabsd.h +++ b/bfd/hosts/hppabsd.h @@ -28,6 +28,8 @@ void free(); #define HOST_DATA_START_ADDR UDATASEG #define HOST_STACK_END_ADDR KSTAKSEG +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/hppahpux.h b/bfd/hosts/hppahpux.h index 08e08140c30..e52b6baa32d 100644 --- a/bfd/hosts/hppahpux.h +++ b/bfd/hosts/hppahpux.h @@ -55,6 +55,9 @@ rename(from, to) # endif */ +/* Not sure about this. */ +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/i386mach.h b/bfd/hosts/i386mach.h index 874ead482a7..13f5572cdb3 100644 --- a/bfd/hosts/i386mach.h +++ b/bfd/hosts/i386mach.h @@ -28,6 +28,8 @@ extern void EXFUN(free, (PTR)); #define HOST_TEXT_START_ADDR 0x10000 /* By inspection */ #define HOST_STACK_END_ADDR KERNBASE +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/i386v.h b/bfd/hosts/i386v.h index 328703be941..c2a96c164e8 100644 --- a/bfd/hosts/i386v.h +++ b/bfd/hosts/i386v.h @@ -50,6 +50,8 @@ # endif */ +#undef HOST_BIG_ENDIAN_P + #ifndef DONTDECLARE_MALLOC extern PTR EXFUN(malloc,(unsigned)); extern PTR EXFUN(realloc, (PTR, unsigned)); diff --git a/bfd/hosts/i386v4.h b/bfd/hosts/i386v4.h index 7b7205926a5..27def2ce831 100644 --- a/bfd/hosts/i386v4.h +++ b/bfd/hosts/i386v4.h @@ -47,6 +47,8 @@ extern long atol(); extern int fputc(); extern int unlink(); +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/irix3.h b/bfd/hosts/irix3.h index 1ae0a584a1b..d72065370c4 100644 --- a/bfd/hosts/irix3.h +++ b/bfd/hosts/irix3.h @@ -22,6 +22,8 @@ #define SEEK_CUR 1 #endif +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/irix4.h b/bfd/hosts/irix4.h index 1ae0a584a1b..d72065370c4 100644 --- a/bfd/hosts/irix4.h +++ b/bfd/hosts/irix4.h @@ -22,6 +22,8 @@ #define SEEK_CUR 1 #endif +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/ncr3000.h b/bfd/hosts/ncr3000.h index 7b7205926a5..27def2ce831 100644 --- a/bfd/hosts/ncr3000.h +++ b/bfd/hosts/ncr3000.h @@ -47,6 +47,8 @@ extern long atol(); extern int fputc(); extern int unlink(); +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/news.h b/bfd/hosts/news.h index edfdc4dbc00..d42f90413c5 100644 --- a/bfd/hosts/news.h +++ b/bfd/hosts/news.h @@ -12,21 +12,19 @@ #define SEEK_SET 0 #define SEEK_CUR 1 -extern PROTO(int, abort,(void)); -extern PROTO(int, close,(int)); -extern PROTO(int, fcntl,(int des, int cmd, int e)); -extern PROTO(int, fprintf,(FILE *,char *,...)); -extern PROTO(int, printf,(char *,...)); -extern PROTO(int, qsort,(void *data,int els, int siz, int func())); -extern PROTO(int, exit,(int)); -extern PROTO(int, fseek,(FILE*, int, int)); -extern PROTO(int, fclose,(FILE*)); -extern PROTO(void, bcopy,(char*,char*,int)); -extern PROTO(int, bcmp,(char *, char *, int)); -extern PROTO(void, bzero,(char *, int)); -extern char * strchr(); -extern PROTO(void, perror,(CONST char *)); +extern int EXFUN(close,(int)); +extern int EXFUN(fcntl,(int des, int cmd, int e)); +extern int EXFUN(fprintf,(FILE *,char *,...)); +extern int EXFUN(printf,(char *,...)); +extern int EXFUN(qsort,(void *data,int els, int siz, int func())); +extern int EXFUN(fseek,(FILE*, int, int)); +extern int EXFUN(fclose,(FILE*)); +extern void EXFUN(bcopy,(char*,char*,int)); +extern int EXFUN(bcmp,(char *, char *, int)); +extern void EXFUN(bzero,(char *, int)); +extern void EXFUN(perror,(CONST char *)); extern char *getenv(); +extern char * strchr(); extern char *memchr(); extern char *strrchr(); extern int chmod(); @@ -51,6 +49,7 @@ extern char *getenv(); extern int fputc(); extern int unlink(); +#define HOST_BIG_ENDIAN_P /* EXACT TYPES */ typedef char int8e_type; @@ -67,18 +66,4 @@ typedef short int16_type; typedef unsigned short uint16_type; typedef int int32_type; typedef unsigned int uint32_type; -/* Macros for the 'type' part of an fopen, freopen or fdopen. - [Update] - */ -#define FOPEN_RB "r" -#define FOPEN_WB "w" -#define FOPEN_AB "a" -#define FOPEN_RUB "r+" -#define FOPEN_WUB "w+" -#define FOPEN_AUB "a+" -#define FOPEN_RT "r" -#define FOPEN_WT "w" -#define FOPEN_AT "a" -#define FOPEN_RUT "r+" -#define FOPEN_WUT "w+" -#define FOPEN_AUT "a+" +#include "fopen-same.h" diff --git a/bfd/hosts/rs6000.h b/bfd/hosts/rs6000.h index b41ed5ff168..70f20ad064e 100644 --- a/bfd/hosts/rs6000.h +++ b/bfd/hosts/rs6000.h @@ -17,6 +17,8 @@ #define SEEK_SET 0 #define SEEK_CUR 1 +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/rtbsd.h b/bfd/hosts/rtbsd.h index 071ee04f989..c071707a288 100644 --- a/bfd/hosts/rtbsd.h +++ b/bfd/hosts/rtbsd.h @@ -17,6 +17,7 @@ extern char *malloc(); extern void free(); +#define HOST_BIG_ENDIAN_P /* EXACT TYPES */ typedef char int8e_type; diff --git a/bfd/hosts/solaris2.h b/bfd/hosts/solaris2.h index b1ec809b536..03673d6760c 100644 --- a/bfd/hosts/solaris2.h +++ b/bfd/hosts/solaris2.h @@ -2,4 +2,6 @@ #include "hosts/sysv4.h" +#define HOST_BIG_ENDIAN_P + /* That's all... */ diff --git a/bfd/hosts/sparc-ll.h b/bfd/hosts/sparc-ll.h index 1f7c6952a8c..9506551da30 100644 --- a/bfd/hosts/sparc-ll.h +++ b/bfd/hosts/sparc-ll.h @@ -74,6 +74,8 @@ extern int fputc(); extern int unlink(); +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/sparc.h b/bfd/hosts/sparc.h index 3ae9af69618..00cf8bf9772 100644 --- a/bfd/hosts/sparc.h +++ b/bfd/hosts/sparc.h @@ -87,6 +87,8 @@ extern int fputc(); extern int unlink(); #endif /* __STDC__ */ +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/stratus.h b/bfd/hosts/stratus.h index dbe7a010b93..bd0686a70cb 100644 --- a/bfd/hosts/stratus.h +++ b/bfd/hosts/stratus.h @@ -47,6 +47,8 @@ extern long atol(); extern int fputc(); extern int unlink(); +#undef HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/sun3.h b/bfd/hosts/sun3.h index 0c3b4955993..2b6538d8fef 100644 --- a/bfd/hosts/sun3.h +++ b/bfd/hosts/sun3.h @@ -59,6 +59,7 @@ extern char *getenv(); extern int fputc(); extern int unlink(); +#define HOST_BIG_ENDIAN_P /* EXACT TYPES */ typedef char int8e_type; diff --git a/bfd/hosts/ultra3.h b/bfd/hosts/ultra3.h index 17aad5aba58..1980e770b5f 100644 --- a/bfd/hosts/ultra3.h +++ b/bfd/hosts/ultra3.h @@ -17,6 +17,8 @@ extern char *malloc(); extern void free(); +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/hosts/we32k.h b/bfd/hosts/we32k.h index 6de135ebc6e..7d69c17d7f2 100644 --- a/bfd/hosts/we32k.h +++ b/bfd/hosts/we32k.h @@ -24,6 +24,8 @@ extern void EXFUN(bzero,(char *, int)); extern int strtol(); #define NO_STDARG 1 +#define HOST_BIG_ENDIAN_P + /* EXACT TYPES */ typedef char int8e_type; typedef unsigned char uint8e_type; diff --git a/bfd/targets.c b/bfd/targets.c index 8cd9ffff812..49a819616bc 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -401,10 +401,27 @@ extern bfd_target hppa_vec; #ifdef DEFAULT_VECTOR extern bfd_target DEFAULT_VECTOR; #endif +#ifdef HOST_BIG_ENDIAN_DEFAULT_VECTOR +extern bfd_target HOST_BIG_ENDIAN_DEFAULT_VECTOR; +#endif +#ifdef HOST_LITTLE_ENDIAN_DEFAULT_VECTOR +extern bfd_target HOST_LITTLE_ENDIAN_DEFAULT_VECTOR; +#endif #ifdef SELECT_VECS bfd_target *target_vector[] = { + + /* 960 bout format depends on the host, so let targets choose a + default vector even if the provide SELECT_VECS. */ +#ifdef HOST_BIG_ENDIAN_DEFAULT_VECTOR +#ifdef HOST_BIG_ENDIAN_P + &HOST_BIG_ENDIAN_DEFAULT_VECTOR, +#else /* ! defined (HOST_BIG_ENDIAN_P) */ + &HOST_LITTLE_ENDIAN_DEFAULT_VECTOR, +#endif /* ! defined (HOST_BIG_ENDIAN_P) */ +#endif /* defined (HOST_BIG_ENDIAN_DEFAULT_VECTOR) */ + SELECT_VECS, 0 }; @@ -415,7 +432,15 @@ bfd_target *target_vector[] = { #ifdef DEFAULT_VECTOR &DEFAULT_VECTOR, -#endif +#else /* ! defined (DEFAULT_VECTOR) */ +#ifdef HOST_BIG_ENDIAN_DEFAULT_VECTOR +#ifdef HOST_BIG_ENDIAN_P + &HOST_BIG_ENDIAN_DEFAULT_VECTOR, +#else /* ! defined (HOST_BIG_ENDIAN_P) */ + &HOST_LITTLE_ENDIAN_DEFAULT_VECTOR, +#endif /* ! defined (HOST_BIG_ENDIAN_P) */ +#endif /* defined (HOST_BIG_ENDIAN_DEFAULT_VECTOR) */ +#endif /* ! defined (DEFAULT_VECTOR) */ &i386coff_vec, &i386aout_vec, @@ -465,7 +490,15 @@ bfd_target *target_vector[] = { bfd_target *default_vector[] = { #ifdef DEFAULT_VECTOR &DEFAULT_VECTOR, -#endif +#else /* ! defined (DEFAULT_VECTOR) */ +#ifdef HOST_BIG_ENDIAN_DEFAULT_VECTOR +#ifdef HOST_BIG_ENDIAN_P + &HOST_BIG_ENDIAN_DEFAULT_VECTOR, +#else /* ! defined (HOST_BIG_ENDIAN_P) */ + &HOST_LITTLE_ENDIAN_DEFAULT_VECTOR, +#endif /* ! defined (HOST_BIG_ENDIAN_P) */ +#endif /* defined (HOST_BIG_ENDIAN_DEFAULT_VECTOR) */ +#endif /* ! defined (DEFAULT_VECTOR) */ 0, }; -- 2.30.2