summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2018-06-15 00:03:53 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2018-06-15 00:03:53 -0700
commited859f72a120888868eb37beee0fcb2ab1710af5 (patch)
treebf426751c5ecea02fb29a42cb1f038a05ee0e4ca /output
parent0125c446ddba6ce02cc5654bdcfcfa41e46b8223 (diff)
downloadnasm-ed859f72a120888868eb37beee0fcb2ab1710af5.tar.gz
output: remove ABSOLUTE handling, OUT_RAWDATA asserts
ABSOLUTE handling can be done centrally, and shouldn't need to be in every backend. Simply drop the call to ofmt->output(). Many backends have an assert for OUT_RAWDATA not having a target segment; this doesn't make any sense as output/legacy.c will not allow that to happen. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'output')
-rw-r--r--output/outaout.c16
-rw-r--r--output/outas86.c16
-rw-r--r--output/outbin.c8
-rw-r--r--output/outcoff.c12
-rw-r--r--output/outelf.c12
-rw-r--r--output/outieee.c10
-rw-r--r--output/outmacho.c10
-rw-r--r--output/outobj.c10
-rw-r--r--output/outrdf2.c10
9 files changed, 0 insertions, 104 deletions
diff --git a/output/outaout.c b/output/outaout.c
index a662994e..0ad797e4 100644
--- a/output/outaout.c
+++ b/output/outaout.c
@@ -586,16 +586,6 @@ static void aout_out(int32_t segto, const void *data,
int32_t addr;
uint8_t mydata[4], *p;
- /*
- * handle absolute-assembly (structure definitions)
- */
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
- " space");
- return;
- }
-
if (segto == stext.index)
s = &stext;
else if (segto == sdata.index)
@@ -626,8 +616,6 @@ static void aout_out(int32_t segto, const void *data,
} else
sbss.len += size;
} else if (type == OUT_RAWDATA) {
- if (segment != NO_SEG)
- nasm_panic(0, "OUT_RAWDATA with other than NO_SEG");
aout_sect_write(s, data, size);
} else if (type == OUT_ADDRESS) {
int asize = abs((int)size);
@@ -678,8 +666,6 @@ static void aout_out(int32_t segto, const void *data,
WRITELONG(p, addr);
aout_sect_write(s, mydata, asize);
} else if (type == OUT_REL2ADR) {
- if (segment == segto)
- nasm_panic(0, "intra-segment OUT_REL2ADR");
if (segment != NO_SEG && segment % 2) {
nasm_error(ERR_NONFATAL, "a.out format does not support"
" segment base references");
@@ -708,8 +694,6 @@ static void aout_out(int32_t segto, const void *data,
WRITESHORT(p, *(int64_t *)data - (size + s->len));
aout_sect_write(s, mydata, 2L);
} else if (type == OUT_REL4ADR) {
- if (segment == segto)
- nasm_panic(0, "intra-segment OUT_REL4ADR");
if (segment != NO_SEG && segment % 2) {
nasm_error(ERR_NONFATAL, "a.out format does not support"
" segment base references");
diff --git a/output/outas86.c b/output/outas86.c
index a72f37aa..3a84fc07 100644
--- a/output/outas86.c
+++ b/output/outas86.c
@@ -297,16 +297,6 @@ static void as86_out(int32_t segto, const void *data,
nasm_error(ERR_NONFATAL, "WRT not supported by as86 output format");
}
- /*
- * handle absolute-assembly (structure definitions)
- */
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
- " space");
- return;
- }
-
if (segto == stext.index)
s = &stext;
else if (segto == sdata.index)
@@ -338,8 +328,6 @@ static void as86_out(int32_t segto, const void *data,
} else
bsslen += size;
} else if (type == OUT_RAWDATA) {
- if (segment != NO_SEG)
- nasm_panic(0, "OUT_RAWDATA with other than NO_SEG");
as86_sect_write(s, data, size);
as86_add_piece(s, 0, 0L, 0L, size, 0);
} else if (type == OUT_ADDRESS) {
@@ -359,8 +347,6 @@ static void as86_out(int32_t segto, const void *data,
as86_add_piece(s, 0, 0L, 0L, asize, 0);
}
} else if (type == OUT_REL2ADR) {
- if (segment == segto)
- nasm_panic(0, "intra-segment OUT_REL2ADR");
if (segment != NO_SEG) {
if (segment % 2) {
nasm_error(ERR_NONFATAL, "as86 format does not support"
@@ -372,8 +358,6 @@ static void as86_out(int32_t segto, const void *data,
}
}
} else if (type == OUT_REL4ADR) {
- if (segment == segto)
- nasm_panic(0, "intra-segment OUT_REL4ADR");
if (segment != NO_SEG) {
if (segment % 2) {
nasm_error(ERR_NONFATAL, "as86 format does not support"
diff --git a/output/outbin.c b/output/outbin.c
index 8c1cf0a7..fb87e334 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -737,14 +737,6 @@ static void bin_out(int32_t segto, const void *data,
nasm_error(ERR_NONFATAL, "WRT not supported by binary output format");
}
- /* Handle absolute-assembly (structure definitions). */
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in"
- " [ABSOLUTE] space");
- return;
- }
-
/* Find the segment we are targeting. */
s = find_section_by_index(segto);
if (!s)
diff --git a/output/outcoff.c b/output/outcoff.c
index 58659e06..eed80a8d 100644
--- a/output/outcoff.c
+++ b/output/outcoff.c
@@ -559,16 +559,6 @@ static void coff_out(int32_t segto, const void *data,
nasm_error(ERR_NONFATAL, "WRT not supported by COFF output formats");
}
- /*
- * handle absolute-assembly (structure definitions)
- */
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
- " space");
- return;
- }
-
s = NULL;
for (i = 0; i < coff_nsects; i++) {
if (segto == coff_sects[i]->index) {
@@ -621,8 +611,6 @@ static void coff_out(int32_t segto, const void *data,
} else
s->len += size;
} else if (type == OUT_RAWDATA) {
- if (segment != NO_SEG)
- nasm_panic(0, "OUT_RAWDATA with other than NO_SEG");
coff_sect_write(s, data, size);
} else if (type == OUT_ADDRESS) {
int asize = abs((int)size);
diff --git a/output/outelf.c b/output/outelf.c
index 492ee22f..34c88361 100644
--- a/output/outelf.c
+++ b/output/outelf.c
@@ -799,16 +799,6 @@ static void elf32_out(int32_t segto, const void *data,
int i;
static struct symlininfo sinfo;
- /*
- * handle absolute-assembly (structure definitions)
- */
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
- " space");
- return;
- }
-
s = NULL;
for (i = 0; i < nsects; i++)
if (segto == sects[i]->index) {
@@ -851,8 +841,6 @@ static void elf32_out(int32_t segto, const void *data,
break;
case OUT_RAWDATA:
- if (segment != NO_SEG)
- nasm_panic(0, "OUT_RAWDATA with other than NO_SEG");
elf_sect_write(s, data, size);
break;
diff --git a/output/outieee.c b/output/outieee.c
index 3a28942d..f2ff61f1 100644
--- a/output/outieee.c
+++ b/output/outieee.c
@@ -399,16 +399,6 @@ static void ieee_out(int32_t segto, const void *data,
struct ieeeSection *seg;
/*
- * handle absolute-assembly (structure definitions)
- */
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
- " space");
- return;
- }
-
- /*
* If `any_segs' is still false, we must define a default
* segment.
*/
diff --git a/output/outmacho.c b/output/outmacho.c
index 207fa90e..4d41a1f7 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -635,13 +635,6 @@ static void macho_output(int32_t secto, const void *data,
bool is_bss;
enum reltype reltype;
- if (secto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in "
- "[ABSOLUTE] space");
- return;
- }
-
s = get_section_by_index(secto);
if (!s) {
nasm_error(ERR_WARNING, "attempt to assemble code in"
@@ -687,9 +680,6 @@ static void macho_output(int32_t secto, const void *data,
break;
case OUT_RAWDATA:
- if (section != NO_SEG)
- nasm_panic(0, "OUT_RAWDATA with other than NO_SEG");
-
sect_write(s, data, size);
break;
diff --git a/output/outobj.c b/output/outobj.c
index a223c60a..eda28e6a 100644
--- a/output/outobj.c
+++ b/output/outobj.c
@@ -1029,16 +1029,6 @@ static void obj_out(int32_t segto, const void *data,
ObjRecord *orp;
/*
- * handle absolute-assembly (structure definitions)
- */
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
- " space");
- return;
- }
-
- /*
* If `any_segs' is still false, we must define a default
* segment.
*/
diff --git a/output/outrdf2.c b/output/outrdf2.c
index 4e161a03..fa0886a7 100644
--- a/output/outrdf2.c
+++ b/output/outrdf2.c
@@ -533,13 +533,6 @@ static void rdf2_out(int32_t segto, const void *data,
uint8_t databuf[8], *pd;
int seg;
- if (segto == NO_SEG) {
- if (type != OUT_RESERVE)
- nasm_error(ERR_NONFATAL,
- "attempt to assemble code in ABSOLUTE space");
- return;
- }
-
segto >>= 1; /* convert NASM segment no to RDF number */
for (seg = 0; seg < nsegments; seg++) {
@@ -576,9 +569,6 @@ static void rdf2_out(int32_t segto, const void *data,
while (size--)
membufwrite(segto, databuf, 1);
} else if (type == OUT_RAWDATA) {
- if (segment != NO_SEG)
- nasm_panic(0, "OUT_RAWDATA with other than NO_SEG");
-
membufwrite(segto, data, size);
} else if (type == OUT_ADDRESS) {
int asize = abs((int)size);