From: Jim Kingdon Date: Mon, 3 Jan 1994 16:16:01 +0000 (+0000) Subject: * aout-target.h, netbsd386.c: Replace NO_SWAP_MAGIC with SWAP_MAGIC, X-Git-Tag: gdb-4_18~16215 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f99570ec9e7026a8f4a2567029ef8231b9c1fbf;p=external%2Fbinutils.git * 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. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 5cf054a..18fdc63 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/bfd/aout-target.h b/bfd/aout-target.h index 70835c5..379cf69 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -93,11 +93,11 @@ DEFUN(MY(object_p),(abfd), 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 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"