aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-11-19 15:36:47 +0100
committerMichael Matz <matz@suse.de>2017-11-19 15:36:47 +0100
commit330c01bfc6fa6721fd455911a966bce041df31d8 (patch)
treeea394ccbbac5a3c8ad543d1eaf995b3b36ac5dae /tests
parentd0db21757afc625a6299aec51cbc282f36abb85f (diff)
downloadtinycc-330c01bfc6fa6721fd455911a966bce041df31d8.tar.gz
tinycc-330c01bfc6fa6721fd455911a966bce041df31d8.tar.bz2
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/tcctest.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c
index d6fb7e2..000523e 100644
--- a/tests/tcctest.c
+++ b/tests/tcctest.c
@@ -3358,7 +3358,13 @@ void test_asm_call(void)
would have a global symbol entry, not triggering the bug which is
tested here). */
/* 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));
printf("asmd: %s\n", s);
#endif