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
433433 }
434434
435435 #ifdef TCC_TARGET_X86_64
436−static void gen_expr64(ExprValue *pe)
436+ST_FUNC void gen_expr64(ExprValue *pe)
437437 {
438438 gen_addr64(pe->sym ? VT_SYM : 0, pe->sym, pe->v);
439439 }
tcc.h+3−0
@@ -1526,6 +1526,9 @@ ST_FUNC int asm_int_expr(TCCState *s1); · 1525 unmodified lines
15261526 ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess);
15271527 /* ------------ i386-asm.c ------------ */
15281528 ST_FUNC void gen_expr32(ExprValue *pe);
1529+#ifdef TCC_TARGET_X86_64
1530+ST_FUNC void gen_expr64(ExprValue *pe);
1531+#endif
15291532 ST_FUNC void asm_opcode(TCCState *s1, int opcode);
15301533 ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg);
15311534 ST_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
407407 ind += size;
408408 break;
409409 case TOK_ASMDIR_quad:
410+#ifdef TCC_TARGET_X86_64
411+ size = 8;
412+ goto asm_data;
413+#else
410414 next();
411415 for(;;) {
412416 uint64_t vl;
@@ -433,6 +437,7 @@ static void asm_parse_directive(TCCState *s1) · 20 unmodified lines
433437 next();
434438 }
435439 break;
440+#endif
436441 case TOK_ASMDIR_byte:
437442 size = 1;
438443 goto asm_data;
@@ -451,6 +456,10 @@ static void asm_parse_directive(TCCState *s1) · 12 unmodified lines
451456 if (sec->sh_type != SHT_NOBITS) {
452457 if (size == 4) {
453458 gen_expr32(&e);
459+#ifdef TCC_TARGET_X86_64
460+ } else if (size == 8) {
461+ gen_expr64(&e);
462+#endif
454463 } else {
455464 if (e.sym)
456465 expect("constant");
tests/asmtest.S+1−0
@@ -739,6 +739,7 @@ nop · 738 unmodified lines
739739 .long 145 + 2b
740740 .word 164, 0
741741 .org 2b+32
742+ .quad 1b
742743 .popsection
743744
744745 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