Adding the GCC extension __builtin_frame_address(). We support only zero as the argument for now. With this functionality, we can implement GCC compatible stdarg by macros in x86-64.
Unified · Split
| @@ -7599,6 +7599,24 @@ static void unary(void) · 7598 unmodified lines | ||
| 7599 | 7599 | vpushi(res); |
| 7600 | 7600 | } |
| 7601 | 7601 | break; |
| 7602 | + case TOK_builtin_frame_address: | |
| 7603 | + { | |
| 7604 | + CType type; | |
| 7605 | + next(); | |
| 7606 | + skip('('); | |
| 7607 | + if (tok != TOK_CINT) { | |
| 7608 | + error("__builtin_frame_address only takes integers"); | |
| 7609 | + } | |
| 7610 | + if (tokc.i != 0) { | |
| 7611 | + error("TCC only supports __builtin_frame_address(0)"); | |
| 7612 | + } | |
| 7613 | + next(); | |
| 7614 | + skip(')'); | |
| 7615 | + type.t = VT_VOID; | |
| 7616 | + mk_pointer(&type); | |
| 7617 | + vset(&type, VT_LOCAL, 0); | |
| 7618 | + } | |
| 7619 | + break; | |
| 7602 | 7620 | case TOK_INC: |
| 7603 | 7621 | case TOK_DEC: |
| 7604 | 7622 | t = tok; |
| @@ -109,6 +109,7 @@ · 108 unmodified lines | ||
| 109 | 109 | DEF(TOK_NORETURN2, "__noreturn__") |
| 110 | 110 | DEF(TOK_builtin_types_compatible_p, "__builtin_types_compatible_p") |
| 111 | 111 | DEF(TOK_builtin_constant_p, "__builtin_constant_p") |
| 112 | + DEF(TOK_builtin_frame_address, "__builtin_frame_address") | |
| 112 | 113 | DEF(TOK_REGPARM1, "regparm") |
| 113 | 114 | DEF(TOK_REGPARM2, "__regparm__") |
| 114 | 115 | |