History

x86-64-asm: Accept expressions for .quad

The x86-64 target has 64bit relocs, and hence can accept generic expressions for '.quad'.

Michael Matz committed 10 years ago

Commit ff5561f1 parent 253afee4 files · +14 −1Browse files

Unified · Split

4 files
  1. i386-asm.c +1 −1
  2. tcc.h +3 −0
  3. tccasm.c +9 −0
  4. tests/asmtest.S +1 −0
i386-asm.c+1−1
@@ -433,7 +433,7 @@ ST_FUNC void gen_expr32(ExprValue *pe) · 432 unmodified lines
433}433}
434 434
435#ifdef TCC_TARGET_X86_64435#ifdef TCC_TARGET_X86_64
436static void gen_expr64(ExprValue *pe)436ST_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}
tcc.h+3−0
@@ -1526,6 +1526,9 @@ ST_FUNC int asm_int_expr(TCCState *s1); · 1525 unmodified lines
1526ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess);1526ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess);
1527/* ------------ i386-asm.c ------------ */1527/* ------------ i386-asm.c ------------ */
1528ST_FUNC void gen_expr32(ExprValue *pe);1528ST_FUNC void gen_expr32(ExprValue *pe);
1529#ifdef TCC_TARGET_X86_64
1530ST_FUNC void gen_expr64(ExprValue *pe);
1531#endif
1529ST_FUNC void asm_opcode(TCCState *s1, int opcode);1532ST_FUNC void asm_opcode(TCCState *s1, int opcode);
1530ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg);1533ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg);
1531ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier);1534ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier);
tccasm.c+9−0
@@ -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");
tests/asmtest.S+1−0
@@ -739,6 +739,7 @@ nop · 738 unmodified lines
739 .long 145 + 2b739 .long 145 + 2b
740 .word 164, 0740 .word 164, 0
741 .org 2b+32741 .org 2b+32
742 .quad 1b
742.popsection743.popsection
743 744
744 movd %esi, %mm1745 movd %esi, %mm1

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