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
335 sec = cur_text_section;335 sec = cur_text_section;
336 switch(tok) {336 switch(tok) {
337 case TOK_ASM_align:337 case TOK_ASM_align:
338 case TOK_ASM_p2align:
338 case TOK_ASM_skip:339 case TOK_ASM_skip:
339 case TOK_ASM_space:340 case TOK_ASM_space:
340 tok1 = tok;341 tok1 = tok;
341 next();342 next();
342 n = asm_int_expr(s1);343 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 }
343 if (tok1 == TOK_ASM_align) {351 if (tok1 == TOK_ASM_align) {
344 if (n < 0 || (n & (n-1)) != 0)352 if (n < 0 || (n & (n-1)) != 0)
345 tcc_error("alignment must be a positive power of two");353 tcc_error("alignment must be a positive power of two");
tcctok.h+1−0
@@ -258,6 +258,7 @@ · 257 unmodified lines
258 DEF_ASM(byte)258 DEF_ASM(byte)
259 DEF_ASM(word)259 DEF_ASM(word)
260 DEF_ASM(align)260 DEF_ASM(align)
261 DEF_ASM(p2align)
261 DEF_ASM(skip)262 DEF_ASM(skip)
262 DEF_ASM(space)263 DEF_ASM(space)
263 DEF_ASM(string)264 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