summaryrefslogtreecommitdiff
path: root/asm
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 /asm
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 'asm')
-rw-r--r--asm/assemble.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/asm/assemble.c b/asm/assemble.c
index a6bb0ee5..e71e907a 100644
--- a/asm/assemble.c
+++ b/asm/assemble.c
@@ -415,7 +415,18 @@ static void out(struct out_data *data)
data->size = amax;
}
lfmt->output(data);
- ofmt->output(data);
+
+ if (likely(data->segment != NO_SEG)) {
+ ofmt->output(data);
+ } else {
+ /* Outputting to ABSOLUTE section - only reserve is permitted */
+ if (data->type != OUT_RESERVE) {
+ nasm_error(ERR_NONFATAL, "attempt to assemble code in [ABSOLUTE]"
+ " space");
+ }
+ /* No need to push to the backend */
+ }
+
data->offset += data->size;
data->insoffs += data->size;