Several consistency nits, and don't define the get_*() macros twice.

This commit is contained in:
mycroft 1995-01-17 06:41:43 +00:00
parent d11034718e
commit 2c64d3be89
6 changed files with 162 additions and 246 deletions

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.c,v 1.10 1994/06/10 15:16:32 pk Exp $
* $Id: md.c,v 1.11 1995/01/17 06:41:43 mycroft Exp $
*/
#include <sys/param.h>
@ -58,9 +58,10 @@ unsigned char *addr;
return get_short(addr);
case 2:
return get_long(addr);
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
}
errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
return 0;
}
/*
@ -76,15 +77,17 @@ int relocatable_output;
switch (RELOC_TARGET_SIZE(rp)) {
case 0:
put_byte(addr, relocation);
return;
break;
case 1:
put_short(addr, relocation);
return;
break;
case 2:
put_long(addr, relocation);
return;
break;
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
}
errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
}
/*
@ -257,7 +260,7 @@ int magic, flags;
#endif
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
if (!(link_mode & SHAREABLE))
hp->a_entry = PAGSIZ;
}
#endif /* RTLD */
@ -305,15 +308,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
bits = ((int *)r)[1];
r->r_symbolnum = md_swap_long(bits & 0xffffff00);
r->r_symbolnum = md_swap_long(bits) & 0x00ffffff;
r->r_pcrel = (bits & 1);
r->r_length = ((bits >> 1) & 3);
r->r_extern = ((bits >> 3) & 1);
r->r_baserel = ((bits >> 4) & 1);
r->r_jmptable = ((bits >> 5) & 1);
r->r_relative = ((bits >> 6) & 1);
r->r_length = (bits >> 1) & 3;
r->r_extern = (bits >> 3) & 1;
r->r_baserel = (bits >> 4) & 1;
r->r_jmptable = (bits >> 5) & 1;
r->r_relative = (bits >> 6) & 1;
#ifdef N_SIZE
r->r_copy = ((bits >> 7) & 1);
r->r_copy = (bits >> 7) & 1;
#endif
}
}
@ -327,15 +330,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
bits = (md_swap_long(r->r_symbolnum) & 0xffffff00);
bits = md_swap_long(r->r_symbolnum) & 0xffffff00;
bits |= (r->r_pcrel & 1);
bits |= ((r->r_length << 1) & 6);
bits |= ((r->r_extern << 3) & 8);
bits |= ((r->r_baserel << 4) & 0x10);
bits |= ((r->r_jmptable << 5) & 0x20);
bits |= ((r->r_relative << 6) & 0x40);
bits |= (r->r_length & 3) << 1;
bits |= (r->r_extern & 1) << 3;
bits |= (r->r_baserel & 1) << 4;
bits |= (r->r_jmptable & 1) << 5;
bits |= (r->r_relative & 1) << 6;
#ifdef N_SIZE
bits |= ((r->r_copy << 7) & 0x80);
bits |= (r->r_copy & 1) << 7;
#endif
((int *)r)[1] = bits;
}

View File

@ -27,14 +27,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.h,v 1.8 1994/04/07 19:43:38 pk Exp $
* $Id: md.h,v 1.9 1995/01/17 06:41:45 mycroft Exp $
*/
#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
#define NEED_SWAP
#endif
#define MAX_ALIGNMENT (sizeof (long))
@ -144,6 +142,34 @@ typedef struct jmpslot {
#ifdef CROSS_LINKER
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
( ((unsigned char *)(p))[1] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
( ((unsigned char *)(p))[1] << 16) | \
( ((unsigned char *)(p))[2] << 8 ) | \
( ((unsigned char *)(p))[3] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[3] = \
((((unsigned long)(v)) ) & 0xff); }
#ifdef NEED_SWAP
/* Define IO byte swapping routines */
@ -177,67 +203,11 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swap_long(x) ( (((x) >> 24) & 0xff ) | (((x) >> 8 ) & 0xff00 ) | \
(((x) << 8 ) & 0xff0000) | (((x) << 24) & 0xff000000))
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[1] << 8) | \
( ((unsigned char *)(p))[0] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[3] << 24) | \
( ((unsigned char *)(p))[2] << 16) | \
( ((unsigned char *)(p))[1] << 8 ) | \
( ((unsigned char *)(p))[0] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[0] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[3] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[0] = \
((((unsigned long)(v)) ) & 0xff); }
#else /* We need not swap, but must pay attention to alignment: */
#define md_swap_short(x) (x)
#define md_swap_long(x) (x)
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
( ((unsigned char *)(p))[1] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
( ((unsigned char *)(p))[1] << 16) | \
( ((unsigned char *)(p))[2] << 8 ) | \
( ((unsigned char *)(p))[3] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[3] = \
((((unsigned long)(v)) ) & 0xff); }
#endif /* NEED_SWAP */
#else /* Not a cross linker: use native */
@ -254,4 +224,3 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define put_long(where,what) (*(long *)(where) = (what))
#endif /* CROSS_LINKER */

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.c,v 1.10 1994/06/10 15:16:32 pk Exp $
* $Id: md.c,v 1.11 1995/01/17 06:41:43 mycroft Exp $
*/
#include <sys/param.h>
@ -58,9 +58,10 @@ unsigned char *addr;
return get_short(addr);
case 2:
return get_long(addr);
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
}
errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
return 0;
}
/*
@ -76,15 +77,17 @@ int relocatable_output;
switch (RELOC_TARGET_SIZE(rp)) {
case 0:
put_byte(addr, relocation);
return;
break;
case 1:
put_short(addr, relocation);
return;
break;
case 2:
put_long(addr, relocation);
return;
break;
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
}
errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
}
/*
@ -257,7 +260,7 @@ int magic, flags;
#endif
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
if (!(link_mode & SHAREABLE))
hp->a_entry = PAGSIZ;
}
#endif /* RTLD */
@ -305,15 +308,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
bits = ((int *)r)[1];
r->r_symbolnum = md_swap_long(bits & 0xffffff00);
r->r_symbolnum = md_swap_long(bits) & 0x00ffffff;
r->r_pcrel = (bits & 1);
r->r_length = ((bits >> 1) & 3);
r->r_extern = ((bits >> 3) & 1);
r->r_baserel = ((bits >> 4) & 1);
r->r_jmptable = ((bits >> 5) & 1);
r->r_relative = ((bits >> 6) & 1);
r->r_length = (bits >> 1) & 3;
r->r_extern = (bits >> 3) & 1;
r->r_baserel = (bits >> 4) & 1;
r->r_jmptable = (bits >> 5) & 1;
r->r_relative = (bits >> 6) & 1;
#ifdef N_SIZE
r->r_copy = ((bits >> 7) & 1);
r->r_copy = (bits >> 7) & 1;
#endif
}
}
@ -327,15 +330,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
bits = (md_swap_long(r->r_symbolnum) & 0xffffff00);
bits = md_swap_long(r->r_symbolnum) & 0xffffff00;
bits |= (r->r_pcrel & 1);
bits |= ((r->r_length << 1) & 6);
bits |= ((r->r_extern << 3) & 8);
bits |= ((r->r_baserel << 4) & 0x10);
bits |= ((r->r_jmptable << 5) & 0x20);
bits |= ((r->r_relative << 6) & 0x40);
bits |= (r->r_length & 3) << 1;
bits |= (r->r_extern & 1) << 3;
bits |= (r->r_baserel & 1) << 4;
bits |= (r->r_jmptable & 1) << 5;
bits |= (r->r_relative & 1) << 6;
#ifdef N_SIZE
bits |= ((r->r_copy << 7) & 0x80);
bits |= (r->r_copy & 1) << 7;
#endif
((int *)r)[1] = bits;
}

View File

@ -27,14 +27,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.h,v 1.8 1994/04/07 19:43:38 pk Exp $
* $Id: md.h,v 1.9 1995/01/17 06:41:45 mycroft Exp $
*/
#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
#define NEED_SWAP
#endif
#define MAX_ALIGNMENT (sizeof (long))
@ -144,6 +142,34 @@ typedef struct jmpslot {
#ifdef CROSS_LINKER
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
( ((unsigned char *)(p))[1] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
( ((unsigned char *)(p))[1] << 16) | \
( ((unsigned char *)(p))[2] << 8 ) | \
( ((unsigned char *)(p))[3] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[3] = \
((((unsigned long)(v)) ) & 0xff); }
#ifdef NEED_SWAP
/* Define IO byte swapping routines */
@ -177,67 +203,11 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swap_long(x) ( (((x) >> 24) & 0xff ) | (((x) >> 8 ) & 0xff00 ) | \
(((x) << 8 ) & 0xff0000) | (((x) << 24) & 0xff000000))
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[1] << 8) | \
( ((unsigned char *)(p))[0] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[3] << 24) | \
( ((unsigned char *)(p))[2] << 16) | \
( ((unsigned char *)(p))[1] << 8 ) | \
( ((unsigned char *)(p))[0] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[0] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[3] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[0] = \
((((unsigned long)(v)) ) & 0xff); }
#else /* We need not swap, but must pay attention to alignment: */
#define md_swap_short(x) (x)
#define md_swap_long(x) (x)
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
( ((unsigned char *)(p))[1] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
( ((unsigned char *)(p))[1] << 16) | \
( ((unsigned char *)(p))[2] << 8 ) | \
( ((unsigned char *)(p))[3] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[3] = \
((((unsigned long)(v)) ) & 0xff); }
#endif /* NEED_SWAP */
#else /* Not a cross linker: use native */
@ -254,4 +224,3 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define put_long(where,what) (*(long *)(where) = (what))
#endif /* CROSS_LINKER */

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.c,v 1.10 1994/06/10 15:16:32 pk Exp $
* $Id: md.c,v 1.11 1995/01/17 06:41:43 mycroft Exp $
*/
#include <sys/param.h>
@ -58,9 +58,10 @@ unsigned char *addr;
return get_short(addr);
case 2:
return get_long(addr);
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
}
errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
return 0;
}
/*
@ -76,15 +77,17 @@ int relocatable_output;
switch (RELOC_TARGET_SIZE(rp)) {
case 0:
put_byte(addr, relocation);
return;
break;
case 1:
put_short(addr, relocation);
return;
break;
case 2:
put_long(addr, relocation);
return;
break;
default:
errx(1, "Unsupported relocation size: %x",
RELOC_TARGET_SIZE(rp));
}
errx(1, "Unsupported relocation size: %x", RELOC_TARGET_SIZE(rp));
}
/*
@ -257,7 +260,7 @@ int magic, flags;
#endif
/* TEXT_START depends on the value of outheader.a_entry. */
if (!(link_mode & SHAREABLE)) /*WAS: if (entry_symbol) */
if (!(link_mode & SHAREABLE))
hp->a_entry = PAGSIZ;
}
#endif /* RTLD */
@ -305,15 +308,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
bits = ((int *)r)[1];
r->r_symbolnum = md_swap_long(bits & 0xffffff00);
r->r_symbolnum = md_swap_long(bits) & 0x00ffffff;
r->r_pcrel = (bits & 1);
r->r_length = ((bits >> 1) & 3);
r->r_extern = ((bits >> 3) & 1);
r->r_baserel = ((bits >> 4) & 1);
r->r_jmptable = ((bits >> 5) & 1);
r->r_relative = ((bits >> 6) & 1);
r->r_length = (bits >> 1) & 3;
r->r_extern = (bits >> 3) & 1;
r->r_baserel = (bits >> 4) & 1;
r->r_jmptable = (bits >> 5) & 1;
r->r_relative = (bits >> 6) & 1;
#ifdef N_SIZE
r->r_copy = ((bits >> 7) & 1);
r->r_copy = (bits >> 7) & 1;
#endif
}
}
@ -327,15 +330,15 @@ int n;
for (; n; n--, r++) {
r->r_address = md_swap_long(r->r_address);
bits = (md_swap_long(r->r_symbolnum) & 0xffffff00);
bits = md_swap_long(r->r_symbolnum) & 0xffffff00;
bits |= (r->r_pcrel & 1);
bits |= ((r->r_length << 1) & 6);
bits |= ((r->r_extern << 3) & 8);
bits |= ((r->r_baserel << 4) & 0x10);
bits |= ((r->r_jmptable << 5) & 0x20);
bits |= ((r->r_relative << 6) & 0x40);
bits |= (r->r_length & 3) << 1;
bits |= (r->r_extern & 1) << 3;
bits |= (r->r_baserel & 1) << 4;
bits |= (r->r_jmptable & 1) << 5;
bits |= (r->r_relative & 1) << 6;
#ifdef N_SIZE
bits |= ((r->r_copy << 7) & 0x80);
bits |= (r->r_copy & 1) << 7;
#endif
((int *)r)[1] = bits;
}

View File

@ -27,14 +27,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: md.h,v 1.8 1994/04/07 19:43:38 pk Exp $
* $Id: md.h,v 1.9 1995/01/17 06:41:45 mycroft Exp $
*/
#if defined(CROSS_LINKER) && defined(XHOST) && XHOST==sparc
#define NEED_SWAP
#endif
#define MAX_ALIGNMENT (sizeof (long))
@ -144,6 +142,34 @@ typedef struct jmpslot {
#ifdef CROSS_LINKER
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
( ((unsigned char *)(p))[1] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
( ((unsigned char *)(p))[1] << 16) | \
( ((unsigned char *)(p))[2] << 8 ) | \
( ((unsigned char *)(p))[3] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[3] = \
((((unsigned long)(v)) ) & 0xff); }
#ifdef NEED_SWAP
/* Define IO byte swapping routines */
@ -177,67 +203,11 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define md_swap_long(x) ( (((x) >> 24) & 0xff ) | (((x) >> 8 ) & 0xff00 ) | \
(((x) << 8 ) & 0xff0000) | (((x) << 24) & 0xff000000))
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[1] << 8) | \
( ((unsigned char *)(p))[0] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[3] << 24) | \
( ((unsigned char *)(p))[2] << 16) | \
( ((unsigned char *)(p))[1] << 8 ) | \
( ((unsigned char *)(p))[0] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[0] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[3] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[0] = \
((((unsigned long)(v)) ) & 0xff); }
#else /* We need not swap, but must pay attention to alignment: */
#define md_swap_short(x) (x)
#define md_swap_long(x) (x)
#define get_byte(p) ( ((unsigned char *)(p))[0] )
#define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \
( ((unsigned char *)(p))[1] ) \
)
#define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \
( ((unsigned char *)(p))[1] << 16) | \
( ((unsigned char *)(p))[2] << 8 ) | \
( ((unsigned char *)(p))[3] ) \
)
#define put_byte(p, v) { ((unsigned char *)(p))[0] = ((unsigned long)(v)); }
#define put_short(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) ) & 0xff); }
#define put_long(p, v) { ((unsigned char *)(p))[0] = \
((((unsigned long)(v)) >> 24) & 0xff); \
((unsigned char *)(p))[1] = \
((((unsigned long)(v)) >> 16) & 0xff); \
((unsigned char *)(p))[2] = \
((((unsigned long)(v)) >> 8) & 0xff); \
((unsigned char *)(p))[3] = \
((((unsigned long)(v)) ) & 0xff); }
#endif /* NEED_SWAP */
#else /* Not a cross linker: use native */
@ -254,4 +224,3 @@ void md_swapout_jmpslot __P((jmpslot_t *, int));
#define put_long(where,what) (*(long *)(where) = (what))
#endif /* CROSS_LINKER */