History

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.

Michael Matz committed 8 years ago

Commit 330c01b1 parent d0db2171 file · +7 −1Browse files

Unified · Split

tests/tcctest.c+7−1
@@ -3358,7 +3358,13 @@ void test_asm_call(void) · 3357 unmodified lines
33583358 would have a global symbol entry, not triggering the bug which is
33593359 tested here). */
33603360 /* two pushes so stack remains aligned */
3361− asm volatile ("push %%rdi; push %%rdi; mov %0, %%rdi; call getenv; pop %%rdi; pop %%rdi"
3361+ asm volatile ("push %%rdi; push %%rdi; mov %0, %%rdi;"
3362+#if 1 && !defined(__TINYC__) && (defined(__PIC__) || defined(__PIE__))
3363+ "call getenv@plt;"
3364+#else
3365+ "call getenv;"
3366+#endif
3367+ "pop %%rdi; pop %%rdi"
33623368 : "=a" (s) : "r" (str));
33633369 printf("asmd: %s\n", s);
33643370 #endif

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