aboutsummaryrefslogtreecommitdiff
path: root/bfd/netbsd386.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-01-03 16:16:01 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-01-03 16:16:01 +0000
commit3f99570ec9e7026a8f4a2567029ef8231b9c1fbf (patch)
treec96e31d427615fd7055200f3a7db7260ba1e1f1e /bfd/netbsd386.c
parentae5c71d6c13dfadec2d7be265848b25f7d6ae8fa (diff)
downloadgdb-3f99570ec9e7026a8f4a2567029ef8231b9c1fbf.zip
gdb-3f99570ec9e7026a8f4a2567029ef8231b9c1fbf.tar.gz
gdb-3f99570ec9e7026a8f4a2567029ef8231b9c1fbf.tar.bz2
* 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.
Diffstat (limited to 'bfd/netbsd386.c')
-rw-r--r--bfd/netbsd386.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bfd/netbsd386.c b/bfd/netbsd386.c
index ab6aa12..5682df3 100644
--- a/bfd/netbsd386.c
+++ b/bfd/netbsd386.c
@@ -38,11 +38,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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)) ) )
@@ -60,7 +60,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#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)
@@ -78,7 +78,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* #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"