summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-11-08 20:43:22 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-11-08 20:43:22 -0800
commit44d7dcf87b5717306318f0b5882157f801e844f4 (patch)
tree01be48b1c1813b712cb1edec9aa623d5226feceb /output
parent88602aa53acc6826b358de2adfb4c554df48aba0 (diff)
downloadnasm-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.
Diffstat (limited to 'output')
-rw-r--r--output/outmacho.c25
1 files changed, 12 insertions, 13 deletions
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");