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