x86-64-asm: Accept expressions for .quad
The x86-64 target has 64bit relocs, and hence can accept generic expressions for '.quad'.
This commit is contained in:
parent
253afeed1e
commit
ff5561ff7d
4 changed files with 14 additions and 1 deletions
|
@ -433,7 +433,7 @@ ST_FUNC void gen_expr32(ExprValue *pe)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TCC_TARGET_X86_64
|
#ifdef TCC_TARGET_X86_64
|
||||||
static void gen_expr64(ExprValue *pe)
|
ST_FUNC void gen_expr64(ExprValue *pe)
|
||||||
{
|
{
|
||||||
gen_addr64(pe->sym ? VT_SYM : 0, pe->sym, pe->v);
|
gen_addr64(pe->sym ? VT_SYM : 0, pe->sym, pe->v);
|
||||||
}
|
}
|
||||||
|
|
3
tcc.h
3
tcc.h
|
@ -1526,6 +1526,9 @@ ST_FUNC int asm_int_expr(TCCState *s1);
|
||||||
ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess);
|
ST_FUNC int tcc_assemble(TCCState *s1, int do_preprocess);
|
||||||
/* ------------ i386-asm.c ------------ */
|
/* ------------ i386-asm.c ------------ */
|
||||||
ST_FUNC void gen_expr32(ExprValue *pe);
|
ST_FUNC void gen_expr32(ExprValue *pe);
|
||||||
|
#ifdef TCC_TARGET_X86_64
|
||||||
|
ST_FUNC void gen_expr64(ExprValue *pe);
|
||||||
|
#endif
|
||||||
ST_FUNC void asm_opcode(TCCState *s1, int opcode);
|
ST_FUNC void asm_opcode(TCCState *s1, int opcode);
|
||||||
ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg);
|
ST_FUNC void asm_compute_constraints(ASMOperand *operands, int nb_operands, int nb_outputs, const uint8_t *clobber_regs, int *pout_reg);
|
||||||
ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier);
|
ST_FUNC void subst_asm_operand(CString *add_str, SValue *sv, int modifier);
|
||||||
|
|
9
tccasm.c
9
tccasm.c
|
@ -407,6 +407,10 @@ static void asm_parse_directive(TCCState *s1)
|
||||||
ind += size;
|
ind += size;
|
||||||
break;
|
break;
|
||||||
case TOK_ASMDIR_quad:
|
case TOK_ASMDIR_quad:
|
||||||
|
#ifdef TCC_TARGET_X86_64
|
||||||
|
size = 8;
|
||||||
|
goto asm_data;
|
||||||
|
#else
|
||||||
next();
|
next();
|
||||||
for(;;) {
|
for(;;) {
|
||||||
uint64_t vl;
|
uint64_t vl;
|
||||||
|
@ -433,6 +437,7 @@ static void asm_parse_directive(TCCState *s1)
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case TOK_ASMDIR_byte:
|
case TOK_ASMDIR_byte:
|
||||||
size = 1;
|
size = 1;
|
||||||
goto asm_data;
|
goto asm_data;
|
||||||
|
@ -451,6 +456,10 @@ static void asm_parse_directive(TCCState *s1)
|
||||||
if (sec->sh_type != SHT_NOBITS) {
|
if (sec->sh_type != SHT_NOBITS) {
|
||||||
if (size == 4) {
|
if (size == 4) {
|
||||||
gen_expr32(&e);
|
gen_expr32(&e);
|
||||||
|
#ifdef TCC_TARGET_X86_64
|
||||||
|
} else if (size == 8) {
|
||||||
|
gen_expr64(&e);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
if (e.sym)
|
if (e.sym)
|
||||||
expect("constant");
|
expect("constant");
|
||||||
|
|
|
@ -739,6 +739,7 @@ nop
|
||||||
.long 145 + 2b
|
.long 145 + 2b
|
||||||
.word 164, 0
|
.word 164, 0
|
||||||
.org 2b+32
|
.org 2b+32
|
||||||
|
.quad 1b
|
||||||
.popsection
|
.popsection
|
||||||
|
|
||||||
movd %esi, %mm1
|
movd %esi, %mm1
|
||||||
|
|
Loading…
Reference in a new issue