History

tcctest.c: disallow textrel on i386

On musl this isn't suported.

Sigrid Solveig Haflínudóttir committed 10 months ago

Commit d25b70f1 parent bb94d932 files · +7 −8Browse files

Unified · Split

2 files
  1. tests/Makefile +0 −5
  2. tests/tcctest.c +7 −3
tests/Makefile+0−5
@@ -52,11 +52,6 @@ ifeq ($(ARCH),arm) · 51 unmodified lines
52# of functions via bit masking comes out as 1. Just disable thumb.52# of functions via bit masking comes out as 1. Just disable thumb.
53test.ref: CFLAGS+=-marm53test.ref: CFLAGS+=-marm
54endif54endif
55ifeq ($(ARCH)$(CONFIG_WIN32),i386)
56# tcctest.c:get_asm_string uses a construct that is checked too strictly
57# by GCC in 32bit mode when PIC is enabled.
58test.ref: CFLAGS+=-fno-PIC -fno-PIE -Wl,-z,notext
59endif
60ifeq ($(CC_NAME),msvc)55ifeq ($(CC_NAME),msvc)
61test.ref abitest : CC = gcc56test.ref abitest : CC = gcc
62endif57endif
tests/tcctest.c+7−3
@@ -3521,8 +3521,8 @@ char * get_asm_string (void) · 3520 unmodified lines
3521 the problem being the "i" constraint used with a symbolic operand3521 the problem being the "i" constraint used with a symbolic operand
3522 resolving to a local label. That check is overly zealous as the code3522 resolving to a local label. That check is overly zealous as the code
3523 within the asm makes sure to use it only in PIC-possible contexts,3523 within the asm makes sure to use it only in PIC-possible contexts,
3524 but all GCC versions behave like so. We arrange for PIC to be disabled3524 but all GCC versions behave like so. Disabling PIC does not necessarily
3525 for compiling tcctest.c in the Makefile.3525 make this work, one example being musl (no textrel support).
3526 3526
3527 Additionally the usage of 'c' in "%c0" in the template is actually wrong,3527 Additionally the usage of 'c' in "%c0" in the template is actually wrong,
3528 as that would expect an operand that is a condition code. The operand3528 as that would expect an operand that is a condition code. The operand
@@ -3531,7 +3531,7 @@ char * get_asm_string (void) · 2 unmodified lines
3531 to the printed operand (as in "$.LC0" where the template only wants the3531 to the printed operand (as in "$.LC0" where the template only wants the
3532 bare operand ".LC0"). But the code below is what the linux kernel3532 bare operand ".LC0"). But the code below is what the linux kernel
3533 happens to use and as such is the one we want to test. */3533 happens to use and as such is the one we want to test. */
3534#ifndef __clang__3534#if !defined(__clang__) && !defined(__i386__)
3535 extern int some_symbol;3535 extern int some_symbol;
3536 asm volatile (".globl some_symbol\n"3536 asm volatile (".globl some_symbol\n"
3537 "jmp .+6\n"3537 "jmp .+6\n"
@@ -3739,6 +3739,7 @@ void test_asm_call(void) · 201 unmodified lines
3739 3739
3740void asm_dot_test(void)3740void asm_dot_test(void)
3741{3741{
3742#ifndef __i386__
3742#ifndef __APPLE__3743#ifndef __APPLE__
3743 int x;3744 int x;
3744 for (x = 1;; ++x) {3745 for (x = 1;; ++x) {
@@ -3780,10 +3781,12 @@ void asm_dot_test(void) · 35 unmodified lines
3780 printf("asm_dot_test %d: %d\n", x, r);3781 printf("asm_dot_test %d: %d\n", x, r);
3781 }3782 }
3782#endif3783#endif
3784#endif
3783}3785}
3784 3786
3785void asm_pcrel_test(void)3787void asm_pcrel_test(void)
3786{3788{
3789#ifndef __i386__
3787 unsigned o1, o2;3790 unsigned o1, o2;
3788 /* subtract text-section label from forward or other-section label */3791 /* subtract text-section label from forward or other-section label */
3789 asm("1: mov $2f-1b,%%eax; mov %%eax,%0" : "=m"(o1));3792 asm("1: mov $2f-1b,%%eax; mov %%eax,%0" : "=m"(o1));
@@ -3791,6 +3794,7 @@ void asm_pcrel_test(void) · 1 unmodified line
3791 asm("2: lea 2b"RX",%eax; lea 1b"RX",%ecx; sub %ecx,%eax");3794 asm("2: lea 2b"RX",%eax; lea 1b"RX",%ecx; sub %ecx,%eax");
3792 asm("mov %%eax,%0" : "=m"(o2));3795 asm("mov %%eax,%0" : "=m"(o2));
3793 printf("%s : %x\n", __FUNCTION__, o1 - o2); /* should be zero */3796 printf("%s : %x\n", __FUNCTION__, o1 - o2); /* should be zero */
3797#endif
3794}3798}
3795 3799
3796void asm_test(void)3800void asm_test(void)

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