forked from Mirrors/tinycc
Adjust testcase for PIE compilers
one some systems GCC defaults to PIC/PIE code which is incompatible with a unannotated asm call to a function (getenv here). TCC doesn't support these PIC annotations (yet), so play some pre-processor games.master
parent
d0db21757a
commit
330c01bfc6
|
@ -3358,7 +3358,13 @@ void test_asm_call(void)
|
||||||
would have a global symbol entry, not triggering the bug which is
|
would have a global symbol entry, not triggering the bug which is
|
||||||
tested here). */
|
tested here). */
|
||||||
/* two pushes so stack remains aligned */
|
/* two pushes so stack remains aligned */
|
||||||
asm volatile ("push %%rdi; push %%rdi; mov %0, %%rdi; call getenv; pop %%rdi; pop %%rdi"
|
asm volatile ("push %%rdi; push %%rdi; mov %0, %%rdi;"
|
||||||
|
#if 1 && !defined(__TINYC__) && (defined(__PIC__) || defined(__PIE__))
|
||||||
|
"call getenv@plt;"
|
||||||
|
#else
|
||||||
|
"call getenv;"
|
||||||
|
#endif
|
||||||
|
"pop %%rdi; pop %%rdi"
|
||||||
: "=a" (s) : "r" (str));
|
: "=a" (s) : "r" (str));
|
||||||
printf("asmd: %s\n", s);
|
printf("asmd: %s\n", s);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue