aboutsummaryrefslogtreecommitdiff
path: root/tccasm.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2015-01-20 08:49:49 +0100
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2015-01-20 08:49:49 +0100
commitff783b94c7b973e86b1145e53a40926bb87eb47f (patch)
tree7c013e4ae6fa0e7e779cc87b28199ea5a1cecace /tccasm.c
parentfb6331e0fa34338f4ff8a54d5efabc8a6b46f119 (diff)
downloadtinycc-ff783b94c7b973e86b1145e53a40926bb87eb47f.tar.gz
tinycc-ff783b94c7b973e86b1145e53a40926bb87eb47f.tar.bz2
Add support for .p2align asm directive.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'tccasm.c')
-rw-r--r--tccasm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tccasm.c b/tccasm.c
index 38efe1c..d9c929c 100644
--- a/tccasm.c
+++ b/tccasm.c
@@ -335,11 +335,19 @@ static void asm_parse_directive(TCCState *s1)
sec = cur_text_section;
switch(tok) {
case TOK_ASM_align:
+ case TOK_ASM_p2align:
case TOK_ASM_skip:
case TOK_ASM_space:
tok1 = tok;
next();
n = asm_int_expr(s1);
+ if (tok1 == TOK_ASM_p2align)
+ {
+ if (n < 0 || n > 30)
+ tcc_error("invalid p2align, must be between 0 and 30");
+ n = 1 << n;
+ tok1 = TOK_ASM_align;
+ }
if (tok1 == TOK_ASM_align) {
if (n < 0 || (n & (n-1)) != 0)
tcc_error("alignment must be a positive power of two");