History

Add support for .p2align asm directive.

Reimar Döffinger committed 11 years ago

Commit ff783b91 parent fb6331e2 files · +9 −0Browse files

Unified · Split

2 files
  1. tccasm.c +8 −0
  2. tcctok.h +1 −0
tccasm.c+8−0
@@ -335,11 +335,19 @@ static void asm_parse_directive(TCCState *s1) · 334 unmodified lines
335335 sec = cur_text_section;
336336 switch(tok) {
337337 case TOK_ASM_align:
338+ case TOK_ASM_p2align:
338339 case TOK_ASM_skip:
339340 case TOK_ASM_space:
340341 tok1 = tok;
341342 next();
342343 n = asm_int_expr(s1);
344+ if (tok1 == TOK_ASM_p2align)
345+ {
346+ if (n < 0 || n > 30)
347+ tcc_error("invalid p2align, must be between 0 and 30");
348+ n = 1 << n;
349+ tok1 = TOK_ASM_align;
350+ }
343351 if (tok1 == TOK_ASM_align) {
344352 if (n < 0 || (n & (n-1)) != 0)
345353 tcc_error("alignment must be a positive power of two");
tcctok.h+1−0
@@ -258,6 +258,7 @@ · 257 unmodified lines
258258 DEF_ASM(byte)
259259 DEF_ASM(word)
260260 DEF_ASM(align)
261+ DEF_ASM(p2align)
261262 DEF_ASM(skip)
262263 DEF_ASM(space)
263264 DEF_ASM(string)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t