[testsuite] Fix gcc.dg/memcmp-1.c for targets using __USER_LABEL_PREFIX__

Message ID 0A6DDA5E-8107-4110-88F8-BD4D05718555@sandoe.co.uk
State New
Headers show
Series
  • [testsuite] Fix gcc.dg/memcmp-1.c for targets using __USER_LABEL_PREFIX__
Related show

Commit Message

Iain Sandoe Aug. 15, 2018, 4:05 p.m.
Hi,

The test fails on Darwin (and presumably on other _U_L_P_ targets) because the asm-specified symbol isn’t found at link time.

OK for trunk?

thanks
Iain

gcc/testsuite:

	* gcc.dg/memcmp-1.c (lib_memcmp): Apply __USER_LABEL_PREFIX__.
	(lib_strncmp): Likewise.

Comments

Jeff Law Aug. 15, 2018, 4:43 p.m. | #1
On 08/15/2018 10:05 AM, Iain Sandoe wrote:
> Hi,

> 

> The test fails on Darwin (and presumably on other _U_L_P_ targets) because the asm-specified symbol isn’t found at link time.

> 

> OK for trunk?

> 

> thanks

> Iain

> 

> gcc/testsuite:

> 

> 	* gcc.dg/memcmp-1.c (lib_memcmp): Apply __USER_LABEL_PREFIX__.

> 	(lib_strncmp): Likewise.

OK.
jeff

Patch

diff --git a/gcc/testsuite/gcc.dg/memcmp-1.c b/gcc/testsuite/gcc.dg/memcmp-1.c
index a79db51..619cf9b 100644
--- a/gcc/testsuite/gcc.dg/memcmp-1.c
+++ b/gcc/testsuite/gcc.dg/memcmp-1.c
@@ -8,8 +8,13 @@ 
 #include <string.h>
 #include <stdint.h>
 
-int lib_memcmp(const void *a, const void *b, size_t n) asm("memcmp");
-int lib_strncmp(const char *a, const char *b, size_t n) asm("strncmp");
+#define STR1(X) #X
+#define STR2(X) STR1(X)
+
+int lib_memcmp(const void *a, const void *b, size_t n)
+ asm(STR2(__USER_LABEL_PREFIX__) "memcmp");
+int lib_strncmp(const char *a, const char *b, size_t n)
+ asm(STR2(__USER_LABEL_PREFIX__) "strncmp");
 
 #ifndef NRAND
 #ifdef TEST_ALL