diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-11-08 20:43:22 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-11-08 20:43:22 -0800 |
commit | 44d7dcf87b5717306318f0b5882157f801e844f4 (patch) | |
tree | 01be48b1c1813b712cb1edec9aa623d5226feceb | |
parent | 88602aa53acc6826b358de2adfb4c554df48aba0 (diff) | |
download | nasm-44d7dcf87b5717306318f0b5882157f801e844f4.tar.gz |
Fix building under OpenWatcom
OpenWatcom doesn't like 64-bit switch arguments; the change to 64-bit
type arguments caused that to happen in outmacho.c. Hack around it
for now; however, realistically speaking the whole bit stealing thing
is probably a bad idea, especially since virtually all CPUs handle
short immediates better than long ones.
-rw-r--r-- | nasm.h | 17 | ||||
-rw-r--r-- | output/outmacho.c | 25 |
2 files changed, 21 insertions, 21 deletions
@@ -840,14 +840,15 @@ struct ofmt { * OUT_RAWDATA, in which case it points to an "uint8_t" * array. */ -#define OUT_RAWDATA (uint64_t)0x0000000000000000 -#define OUT_ADDRESS (uint64_t)0x1000000000000000 -#define OUT_REL2ADR (uint64_t)0x2000000000000000 -#define OUT_REL4ADR (uint64_t)0x3000000000000000 -#define OUT_RESERVE (uint64_t)0x4000000000000000 -#define OUT_REL8ADR (uint64_t)0x5000000000000000 -#define OUT_TYPMASK (uint64_t)0xF000000000000000 -#define OUT_SIZMASK (uint64_t)0x0FFFFFFFFFFFFFFF +#define OUT_RAWDATA UINT64_C(0x0000000000000000) +#define OUT_ADDRESS UINT64_C(0x1000000000000000) +#define OUT_REL2ADR UINT64_C(0x2000000000000000) +#define OUT_REL4ADR UINT64_C(0x3000000000000000) +#define OUT_RESERVE UINT64_C(0x4000000000000000) +#define OUT_REL8ADR UINT64_C(0x5000000000000000) +#define OUT_TYPMASK UINT64_C(0xF000000000000000) +#define OUT_SIZMASK UINT64_C(0x0FFFFFFFFFFFFFFF) +#define OUT_TYPE(x) ((int)((x) >> 60)) /* * ------------------------------------------------------------ diff --git a/output/outmacho.c b/output/outmacho.c index 29d8dbcd..939f882a 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -386,15 +386,14 @@ static void add_reloc(struct section *sect, int32_t section, ++sect->nreloc; } -static void macho_output(int32_t secto, const void *data, uint64_t type, +static void macho_output(int32_t secto, const void *data, uint64_t xtype, int32_t section, int32_t wrt) { struct section *s, *sbss; - int32_t realbytes = type & OUT_SIZMASK; + int64_t realbytes = xtype & OUT_SIZMASK; int32_t addr; uint8_t mydata[4], *p; - - type &= OUT_TYPMASK; + int type = OUT_TYPE(xtype); if (wrt != NO_SEG) { wrt = NO_SEG; @@ -403,7 +402,7 @@ static void macho_output(int32_t secto, const void *data, uint64_t type, } if (secto == NO_SEG) { - if (type != OUT_RESERVE) + if (type != OUT_TYPE(OUT_RESERVE)) error(ERR_NONFATAL, "attempt to assemble code in " "[ABSOLUTE] space"); @@ -424,16 +423,16 @@ static void macho_output(int32_t secto, const void *data, uint64_t type, sbss = get_section_by_name("__DATA", "__bss"); - if (s == sbss && type != OUT_RESERVE) { + if (s == sbss && type != OUT_TYPE(OUT_RESERVE)) { error(ERR_WARNING, "attempt to initialize memory in the" " BSS section: ignored"); switch (type) { - case OUT_REL2ADR: + case OUT_TYPE(OUT_REL2ADR): realbytes = 2; break; - case OUT_REL4ADR: + case OUT_TYPE(OUT_REL4ADR): realbytes = 4; break; @@ -446,7 +445,7 @@ static void macho_output(int32_t secto, const void *data, uint64_t type, } switch (type) { - case OUT_RESERVE: + case OUT_TYPE(OUT_RESERVE): if (s != sbss) { error(ERR_WARNING, "uninitialized space declared in" " %s section: zeroing", @@ -458,14 +457,14 @@ static void macho_output(int32_t secto, const void *data, uint64_t type, break; - case OUT_RAWDATA: + case OUT_TYPE(OUT_RAWDATA): if (section != NO_SEG) error(ERR_PANIC, "OUT_RAWDATA with other than NO_SEG"); sect_write(s, data, realbytes); break; - case OUT_ADDRESS: + case OUT_TYPE(OUT_ADDRESS): addr = *(int32_t *)data; if (section != NO_SEG) { @@ -486,7 +485,7 @@ static void macho_output(int32_t secto, const void *data, uint64_t type, sect_write(s, mydata, realbytes); break; - case OUT_REL2ADR: + case OUT_TYPE(OUT_REL2ADR): if (section == secto) error(ERR_PANIC, "intra-section OUT_REL2ADR"); @@ -501,7 +500,7 @@ static void macho_output(int32_t secto, const void *data, uint64_t type, sect_write(s, mydata, 2L); break; - case OUT_REL4ADR: + case OUT_TYPE(OUT_REL4ADR): if (section == secto) error(ERR_PANIC, "intra-section OUT_REL4ADR"); |