mirror of
https://github.com/mirror/tinycc.git
synced 2026-08-22 11:23:27 +08:00
i386-asm: fix pc-relative label ariths
See test. We need to use 'ind' from later when the address field of the instruction is put. Also: fix crash when the substracted symbol is undefined Also: assume asm-symbols to be lvalues (except func/array)
This commit is contained in:
@@ -3758,6 +3758,16 @@ void asm_dot_test(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void asm_pcrel_test(void)
|
||||
{
|
||||
unsigned o1, o2;
|
||||
/* subtract text-section label from forward or other-section label */
|
||||
asm("1: mov $2f-1b,%%eax; mov %%eax,%0" : "=m"(o1));
|
||||
/* verify ... */
|
||||
asm("2: mov $2b,%%eax; sub $1b,%%eax; mov %%eax,%0" : "=m"(o2));
|
||||
printf("%s : %x\n", __FUNCTION__, o1 - o2); /* should be zero */
|
||||
}
|
||||
|
||||
void asm_test(void)
|
||||
{
|
||||
char buf[128];
|
||||
@@ -3849,6 +3859,7 @@ void asm_test(void)
|
||||
test_asm_dead_code();
|
||||
test_asm_call();
|
||||
asm_dot_test();
|
||||
asm_pcrel_test();
|
||||
return;
|
||||
label1:
|
||||
goto label2;
|
||||
|
||||
Reference in New Issue
Block a user