+Mon Jan 3 11:09:28 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+
+ * aout-target.h, netbsd386.c: Replace NO_SWAP_MAGIC with SWAP_MAGIC,
+ and do the swapping here rather than calling ntohl from the N_*
+ macros. This cleans up assumptions about the size of a host long,
+ the existence to ntohl, etc.
+
Sat Jan 1 13:50:05 1994 Rob Savoye (rob@darkstar.cygnus.com)
* config.bfd: Add support for VSTa micro-kernel. It currently uses
return 0;
}
-#ifdef NO_SWAP_MAGIC
- memcpy (&exec.a_info, exec_bytes.e_info, sizeof(exec.a_info));
+#ifdef SWAP_MAGIC
+ exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#else
exec.a_info = bfd_h_get_32 (abfd, exec_bytes.e_info);
-#endif /* NO_SWAP_MAGIC */
+#endif /* SWAP_MAGIC */
if (N_BADMAG (exec)) return 0;
#ifdef MACHTYPE_OK
#define TARGETNAME "a.out-netbsd-386"
#define N_MAGIC(ex) \
- ( (((ex).a_info)&0xffff0000) ? (ntohl(((ex).a_info))&0xffff) : ((ex).a_info))
+ ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info))&0xffff) : ((ex).a_info))
#define N_MACHTYPE(ex) \
- ( (((ex).a_info)&0xffff0000) ? ((ntohl(((ex).a_info))>>16)&0x03ff) : 0 )
+ ( (((ex).a_info)&0xffff0000) ? (((((ex).a_info))>>16)&0x03ff) : 0 )
# define N_FLAGS(ex) \
- ( (((ex).a_info)&0xffff0000) ? ((ntohl(((ex).a_info))>>26)&0x3f) : 0 )
+ ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info)>>26)&0x3f) : 0 )
#define N_SET_INFO(ex, mag,mid,flag) \
( (ex).a_info = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) | \
(((mag)&0xffff)) ) )
#include "libaout.h"
#define N_GETMAGIC2(ex) \
- ( (((ex).a_info)&0xffff0000) ? (ntohl(((ex).a_info))&0xffff) : \
+ ( (((ex).a_info)&0xffff0000) ? ((((ex).a_info))&0xffff) : \
(((ex).a_info) | 0x10000) )
#define N_TXTADDR(ex) (N_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : 4096)
/* #define N_BADMAG(x) n_badmag(N_MAGIC(x)) */
-#define NO_SWAP_MAGIC /* magic number already in correct endian format */
+/* On NetBSD, the magic number is always in ntohl's "network" (big-endian)
+ format. */
+#define SWAP_MAGIC(ext) bfd_getb32 (ext)
#include "aout-target.h"