1 diff --git a/elftoaout-2.3/elftoaout.c b/elftoaout-2.3/elftoaout.c
2 index 943c9ef..1f9b4c0 100644
3 --- a/elftoaout-2.3/elftoaout.c
4 +++ b/elftoaout-2.3/elftoaout.c
11 #include <linux/elf.h>
17 -#define swab16(x) (((x)<<8&0xFF00)|((x)>>8&0x00FF))
18 -#define swab32(x) (((x)<<24&0xFF000000)|((x)<<8&0x00FF0000)|((x)>>24&0x000000FF)|((x)>>8&0x0000FF00))
19 -#define swab64(x) ((((unsigned long long)(swab32((unsigned int)x))) << 32) | (swab32(((unsigned long long)x)>>32)))
20 +static uint16_t swab16(uint16_t x)
22 + return (((x)<<8&0xFF00)|((x)>>8&0x00FF));
25 +static uint32_t swab32(uint32_t x)
27 + return (((x)<<24&0xFF000000)|((x)<<8&0x00FF0000)|((x)>>24&0x000000FF)|((x)>>8&0x0000FF00));
30 +static uint64_t swab64(uint64_t x)
32 + return ((((unsigned long long)(swab32(x))) << 32) | (swab32(x>>32)));
35 /* We carry a.out header here in order to compile the thing on Solaris */
38 #define CMAGIC 0x01030108
41 - unsigned long a_magic; /* magic number */
42 - unsigned long a_text; /* size of text segment */
43 - unsigned long a_data; /* size of initialized data */
44 - unsigned long a_bss; /* size of uninitialized data */
45 - unsigned long a_syms; /* size of symbol table || checksum */
46 - unsigned long a_entry; /* entry point */
47 - unsigned long a_trsize; /* size of text relocation */
48 - unsigned long a_drsize; /* size of data relocation */
49 + uint32_t a_magic; /* magic number */
50 + uint32_t a_text; /* size of text segment */
51 + uint32_t a_data; /* size of initialized data */
52 + uint32_t a_bss; /* size of uninitialized data */
53 + uint32_t a_syms; /* size of symbol table || checksum */
54 + uint32_t a_entry; /* entry point */
55 + uint32_t a_trsize; /* size of text relocation */
56 + uint32_t a_drsize; /* size of data relocation */
60 @@ -75,7 +87,7 @@ void print_ptab(ProgTable *t);
61 void print_ptab64(ProgTable64 *t);
64 - char *buf; /* Image data */
65 + unsigned char *buf; /* Image data */
66 unsigned len; /* Length of buffer */
67 unsigned bss; /* Length of extra data */
69 @@ -386,9 +398,9 @@ void print_ptab64(ProgTable64 *t) {
73 - printf("Loadable to 0x%Lx[0x%Lx] from 0x%Lx[0x%Lx] align 0x%Lx",
74 - p->p_vaddr, p->p_memsz, p->p_offset, p->p_filesz,
76 + printf("Loadable to 0x%jx[0x%jx] from 0x%jx[0x%jx] align 0x%jx",
77 + (uintmax_t)p->p_vaddr, (uintmax_t)p->p_memsz, (uintmax_t)p->p_offset, (uintmax_t)p->p_filesz,
78 + (uintmax_t)p->p_align);