The x86-64 target has 64bit relocs, and hence can accept generic expressions for '.quad'.
Unified · Split
| @@ -433,7 +433,7 @@ ST_FUNC void gen_expr32(ExprValue *pe) · 432 unmodified lines | ||
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | #ifdef TCC_TARGET_X86_64 |
| 436 | −static void gen_expr64(ExprValue *pe) | |
| 436 | +ST_FUNC void gen_expr64(ExprValue *pe) | |
| 437 | 437 | { |
| 438 | 438 | gen_addr64(pe->sym ? VT_SYM : 0, pe->sym, pe->v); |
| 439 | 439 | } |
| @@ -1526,6 +1526,9 @@ ST_FUNC int asm_int_expr(TCCState *s1); · 1525 unmodified lines | ||
| 1526 | 1526 | ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess); |
| 1527 | 1527 | /* ------------ i386-asm.c ------------ */ |
| 1528 | 1528 | ST_FUNC void gen_expr32(ExprValue *pe); |
| 1529 | +#ifdef TCC_TARGET_X86_64 | |
| 1530 | +ST_FUNC void gen_expr64(ExprValue *pe); | |
| 1531 | +#endif | |
| 1529 | 1532 | ST_FUNC void asm_opcode(TCCState *s1, int opcode); |
| 1530 | 1533 | ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg); |
| 1531 | 1534 | ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier); |
| @@ -407,6 +407,10 @@ static void asm_parse_directive(TCCState *s1) · 406 unmodified lines | ||
| 407 | 407 | ind += size; |
| 408 | 408 | break; |
| 409 | 409 | case TOK_ASMDIR_quad: |
| 410 | +#ifdef TCC_TARGET_X86_64 | |
| 411 | + size = 8; | |
| 412 | + goto asm_data; | |
| 413 | +#else | |
| 410 | 414 | next(); |
| 411 | 415 | for(;;) { |
| 412 | 416 | uint64_t vl; |
| @@ -433,6 +437,7 @@ static void asm_parse_directive(TCCState *s1) · 20 unmodified lines | ||
| 433 | 437 | next(); |
| 434 | 438 | } |
| 435 | 439 | break; |
| 440 | +#endif | |
| 436 | 441 | case TOK_ASMDIR_byte: |
| 437 | 442 | size = 1; |
| 438 | 443 | goto asm_data; |
| @@ -451,6 +456,10 @@ static void asm_parse_directive(TCCState *s1) · 12 unmodified lines | ||
| 451 | 456 | if (sec->sh_type != SHT_NOBITS) { |
| 452 | 457 | if (size == 4) { |
| 453 | 458 | gen_expr32(&e); |
| 459 | +#ifdef TCC_TARGET_X86_64 | |
| 460 | + } else if (size == 8) { | |
| 461 | + gen_expr64(&e); | |
| 462 | +#endif | |
| 454 | 463 | } else { |
| 455 | 464 | if (e.sym) |
| 456 | 465 | expect("constant"); |
| @@ -739,6 +739,7 @@ nop · 738 unmodified lines | ||
| 739 | 739 | .long 145 + 2b |
| 740 | 740 | .word 164, 0 |
| 741 | 741 | .org 2b+32 |
| 742 | + .quad 1b | |
| 742 | 743 | .popsection |
| 743 | 744 | |
| 744 | 745 | movd %esi, %mm1 |