diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-12 14:07:54 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2013-11-12 14:07:54 +0000 |
commit | bca8f23f423148199bdf6ea86b701651efcc31ca (patch) | |
tree | eb804fd144535283f05a0a2a039058661af2023f | |
parent | cb2c993f5d7a3a5dc73588bf03fa5b9f64b1ebbb (diff) |
remove more code accidentally left behind during the a.out purge
-rw-r--r-- | usr.bin/nm/byte.c | 107 | ||||
-rw-r--r-- | usr.bin/nm/nm.c | 5 |
2 files changed, 1 insertions, 111 deletions
diff --git a/usr.bin/nm/byte.c b/usr.bin/nm/byte.c deleted file mode 100644 index b5556088bbf..00000000000 --- a/usr.bin/nm/byte.c +++ /dev/null @@ -1,107 +0,0 @@ -/* $OpenBSD: byte.c,v 1.6 2004/10/09 20:26:57 mickey Exp $ */ -/* - * Copyright (c) 1999 - * Marc Espie. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - */ - -/* - * A set of routines to read object files and compensate for host - * endianness - */ -static int -byte_sex(int mid) -{ - switch (mid) { - case MID_I386: - case MID_VAX: - case MID_ALPHA: - case MID_PMAX: - return LITTLE_ENDIAN; - case MID_M68K: - case MID_M68K4K: - case MID_M88K: - case MID_SUN010: - case MID_SUN020: - case MID_HP200: - case MID_HP300: - case MID_HPPA: - case MID_HPUX800: - case MID_HPUX: - case MID_SPARC: - case MID_MIPS: - case MID_SPARC64: - case MID_POWERPC: - return BIG_ENDIAN; - default: - /* we don't know what this is, so we don't want to process it */ - return 0; - } -} - -#define BAD_OBJECT(h) (N_BADMAG(h) || !byte_sex(N_GETMID(h))) - -/* handles endianess swaps */ -static void -swap_u32s(u_int32_t *h, size_t n) -{ - size_t i; - - for (i = 0; i < n; i++) - h[i] = swap32(h[i]); -} - -static void -fix_header_order(struct exec *h) -{ - if (byte_sex(N_GETMID(*h)) != BYTE_ORDER) - swap_u32s( ((u_int32_t *)(h))+1, sizeof *h/sizeof(u_int32_t) - 1); -} - -static long -fix_32_order(u_int32_t l, int mid) -{ - if (byte_sex(mid) != BYTE_ORDER) - return swap32(l); - else - return l; -} - -static void -swap_nlist(struct nlist *p) -{ - p->n_un.n_strx = swap32(p->n_un.n_strx); - p->n_desc = swap16(p->n_desc); - p->n_value = swap32(p->n_value); -} - -static void -fix_nlist_order(struct nlist *p, int mid) -{ - if (byte_sex(mid) != BYTE_ORDER) - swap_nlist(p); -} - -static void -fix_nlists_order(struct nlist *p, size_t n, int mid) -{ - size_t i; - - if (byte_sex(mid) != BYTE_ORDER) - for (i = 0; i < n; i++) - swap_nlist(p+i); -} - -static void -fix_ranlib_order(struct ranlib *r, int mid) -{ - if (byte_sex(mid) != BYTE_ORDER) { - r->ran_un.ran_strx = swap32(r->ran_un.ran_strx); - r->ran_off = swap32(r->ran_off); - } -} diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c index 571b82cc0da..df35b9ee800 100644 --- a/usr.bin/nm/nm.c +++ b/usr.bin/nm/nm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nm.c,v 1.37 2013/10/24 19:53:43 miod Exp $ */ +/* $OpenBSD: nm.c,v 1.38 2013/11/12 14:07:53 deraadt Exp $ */ /* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */ /* @@ -52,9 +52,6 @@ #include "elfuncs.h" #include "util.h" -/* XXX get shared code to handle a.out byte-order swaps */ -#include "byte.c" - #define SYMTABMAG "/ " #define STRTABMAG "//" |