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
5252 # of functions via bit masking comes out as 1. Just disable thumb.
5353 test.ref: CFLAGS+=-marm
5454 endif
55−ifeq ($(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.
58−test.ref: CFLAGS+=-fno-PIC -fno-PIE -Wl,-z,notext
59−endif
6055 ifeq ($(CC_NAME),msvc)
6156 test.ref abitest : CC = gcc
6257 endif
tests/tcctest.c+7−3
@@ -3521,8 +3521,8 @@ char * get_asm_string (void) · 3520 unmodified lines
35213521 the problem being the "i" constraint used with a symbolic operand
35223522 resolving to a local label. That check is overly zealous as the code
35233523 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 disabled
3525− for compiling tcctest.c in the Makefile.
3524+ but all GCC versions behave like so. Disabling PIC does not necessarily
3525+ make this work, one example being musl (no textrel support).
35263526
35273527 Additionally the usage of 'c' in "%c0" in the template is actually wrong,
35283528 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
35313531 to the printed operand (as in "$.LC0" where the template only wants the
35323532 bare operand ".LC0"). But the code below is what the linux kernel
35333533 happens to use and as such is the one we want to test. */
3534−#ifndef __clang__
3534+#if !defined(__clang__) && !defined(__i386__)
35353535 extern int some_symbol;
35363536 asm volatile (".globl some_symbol\n"
35373537 "jmp .+6\n"
@@ -3739,6 +3739,7 @@ void test_asm_call(void) · 201 unmodified lines
37393739
37403740 void asm_dot_test(void)
37413741 {
3742+#ifndef __i386__
37423743 #ifndef __APPLE__
37433744 int x;
37443745 for (x = 1;; ++x) {
@@ -3780,10 +3781,12 @@ void asm_dot_test(void) · 35 unmodified lines
37803781 printf("asm_dot_test %d: %d\n", x, r);
37813782 }
37823783 #endif
3784+#endif
37833785 }
37843786
37853787 void asm_pcrel_test(void)
37863788 {
3789+#ifndef __i386__
37873790 unsigned o1, o2;
37883791 /* subtract text-section label from forward or other-section label */
37893792 asm("1: mov $2f-1b,%%eax; mov %%eax,%0" : "=m"(o1));
@@ -3791,6 +3794,7 @@ void asm_pcrel_test(void) · 1 unmodified line
37913794 asm("2: lea 2b"RX",%eax; lea 1b"RX",%ecx; sub %ecx,%eax");
37923795 asm("mov %%eax,%0" : "=m"(o2));
37933796 printf("%s : %x\n", __FUNCTION__, o1 - o2); /* should be zero */
3797+#endif
37943798 }
37953799
37963800 void 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