From 3ec573e750fca863ee46c699431852155761b507 Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Fri, 2 Dec 2016 14:35:33 -0500 Subject: [PATCH] Add support for .align directive. --- dynasm/dasm_s390x.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dynasm/dasm_s390x.h b/dynasm/dasm_s390x.h index 12b8b2bd..d505b381 100644 --- a/dynasm/dasm_s390x.h +++ b/dynasm/dasm_s390x.h @@ -215,7 +215,7 @@ void dasm_put(Dst_DECL, int start, ...) case DASM_REL_EXT: break; case DASM_ALIGN: - ofs += (ins & 255); + ofs += *p++; b[pos++] = ofs; break; case DASM_REL_LG: @@ -344,7 +344,7 @@ int dasm_link(Dst_DECL, size_t * szp) case DASM_REL_EXT: break; case DASM_ALIGN: - ofs -= (b[pos++] + ofs) & (ins & 255); + ofs -= (b[pos++] + ofs) & *p++; break; case DASM_REL_LG: case DASM_REL_PC: @@ -410,9 +410,10 @@ int dasm_encode(Dst_DECL, void *buffer) n = DASM_EXTERN(Dst, (unsigned char *)cp, (ins & 2047), 1) - 4; goto patchrel; case DASM_ALIGN: - ins &= 255; + ins = *p++; + /* TODO: emit 4-byte noprs instead of 2-byte nops where possible. */ while ((((char *)cp - base) & ins)) - *cp++ = 0x0707; + *cp++ = 0x0700; /* nop */ break; case DASM_REL_LG: CK(n >= 0, UNDEF_LG);