summaryrefslogtreecommitdiff
path: root/assemble.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-05-06 15:25:43 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-05-06 15:33:24 -0700
commit55ae12052cd110cc27fa8ef15a114b4e75fa4c24 (patch)
treebdb7acd17f7c4b75f2ff48e527a9d454260b35ba /assemble.c
parent97ec06a16a0871330d8f4544de9cd95fc88d31df (diff)
downloadnasm-55ae12052cd110cc27fa8ef15a114b4e75fa4c24.tar.gz
Add support for one-byte relocations
Add OUT_REL1ADR (one-byte relative address) and support for OUT_ADDRESs with size == 1. Add support for it in outbin and outdbg. *It still needs to be added to other backends*, both the OUT_REL*ADR and OUT_ADDRESS codepaths need to be handled. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'assemble.c')
-rw-r--r--assemble.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/assemble.c b/assemble.c
index ca6f18f1..00ee78fb 100644
--- a/assemble.c
+++ b/assemble.c
@@ -365,23 +365,15 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, uint32_t cp,
while (t--) { /* repeat TIMES times */
list_for_each(e, instruction->eops) {
if (e->type == EOT_DB_NUMBER) {
- if (wsize == 1) {
- if (e->segment != NO_SEG)
- errfunc(ERR_NONFATAL,
- "one-byte relocation attempted");
- else {
- uint8_t out_byte = e->offset;
- out(offset, segment, &out_byte,
- OUT_RAWDATA, 1, NO_SEG, NO_SEG);
- }
- } else if (wsize > 8) {
+ if (wsize > 8) {
errfunc(ERR_NONFATAL,
"integer supplied to a DT, DO or DY"
" instruction");
- } else
+ } else {
out(offset, segment, &e->offset,
OUT_ADDRESS, wsize, e->segment, e->wrt);
- offset += wsize;
+ offset += wsize;
+ }
} else if (e->type == EOT_DB_STRING ||
e->type == EOT_DB_STRING_FREE) {
int align;