Subject: bin/3939: amd fails to determine endianness
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@cv.sony.co.jp>
List: netbsd-bugs
Date: 08/05/1997 11:32:11
>Number:         3939
>Category:       bin
>Synopsis:       amd fails to determine endianness
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug  4 19:35:01 1997
>Last-Modified:
>Originator:     enami tsugutomo
>Organization:
	Sony Corp.,  IS Center,  Engineering System Dept., CAE Group
>Release:        NetBSD-current 1997 Aug 02
>Environment:
System: NetBSD parity-error.cv.sony.co.jp 1.2G NetBSD 1.2G (PARITY_ERROR) #184: Tue Aug 5 09:35:59 JST 1997 enami@parity-error.cv.sony.co.jp:/usr/src/sys/arch/i386/compile/PARITY_ERROR i386


>Description:
	Amd fails to determine the endianness of port.

>How-To-Repeat:
	Compile amd on little endian machine (e.g. i386), and type amd
	-v.  It says it is big endian.

% amd -v
Copyright (c) 1997 Erez Zadok
Copyright (c) 1990 Jan-Simon Pendry
Copyright (c) 1990 Imperial College of Science, Technology & Medicine
Copyright (c) 1990 The Regents of the University of California.
am-utils version 6.0a8 (build 1).
Built by enami@parity-error.cv.sony.co.jp on date Tue Aug  5 11:23:33 JST 1997.
cpu=i386 (big-endian), arch=i386, karch=i386.
          ^^^^^^^^^^
full_os=netbsd1.2G, os=netbsd1, osver=1.2G, vendor=unknown.
Map support for: root, passwd, union, nis, ndbm, file, error.
AMFS: nfs, link, nfsx, host, linkx, program, union, inherit, ufs, cdfs, 
      pcfs, auto, direct, toplvl, error.
FS: cdfs, mfs, nfs, nfs3, nullfs, pcfs, ufs, umapfs, unionfs.
Primary network: primnetname="43.4.144.0" (primnetnum=43.4.144).
No Subsidiary network.

>Fix:
	Amd uses macro constant BYTE_ORDER and BIG_ENDIAN too early.
	Here is workaround:

Index: config.h
===================================================================
RCS file: /cvsroot/NetBSD/src/usr.sbin/amd/include/config.h,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 config.h
*** config.h	1997/07/29 01:42:02	1.1.1.2
--- config.h	1997/08/05 02:17:47
***************
*** 794,805 ****
  /* Define vfork as fork if vfork does not work.  */
  /* #undef vfork */
  
- /* Define if your processor stores words with the most significant
-    byte first (like Motorola and SPARC, unlike Intel and VAX).  */
- #if BYTE_ORDER == BIG_ENDIAN
- #define WORDS_BIGENDIAN 
- #endif
- 
  /* Turn off general debugging by default */
  /* #undef DEBUG */
  
--- 794,799 ----
Index: am_defs.h
===================================================================
RCS file: /cvsroot/NetBSD/src/usr.sbin/amd/include/am_defs.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 am_defs.h
*** am_defs.h	1997/07/29 01:42:03	1.1.1.1
--- am_defs.h	1997/08/05 02:17:20
***************
*** 104,109 ****
--- 104,117 ----
  #endif /* HAVE_MACHINE_ENDIAN_H */
  
  /*
+  * Define if your processor stores words with the most significant
+  * byte first (like Motorola and SPARC, unlike Intel and VAX).
+  */
+ #if BYTE_ORDER == BIG_ENDIAN
+ #define WORDS_BIGENDIAN 
+ #endif
+ 
+ /*
   * Big-endian or little-endian?
   */
  #ifdef WORDS_BIGENDIAN
>Audit-Trail:
>Unformatted: