Patchwork glibc 2.27 regression on powerpc-linux-gnuspe

login
register
mail settings
Submitter Adhemerval Zanella Netto
Date March 5, 2018, 1:30 p.m.
Message ID <96d9640e-86f8-fad9-53b3-eacc591898eb@linaro.org>
Download mbox | patch
Permalink /patch/26199/
State Superseded
Headers show

Comments

Adhemerval Zanella Netto - March 5, 2018, 1:30 p.m.
On 04/03/2018 06:27, John Paul Adrian Glaubitz wrote:
> Hi!
> 
> Just a quick heads-up, glibc 2.27 fails to build on powerpc-linux-gnuspe [1]:
> 
> powerpc-linux-gnuspe-gcc-7 -no-pie -fno-PIE -c   -isystem /<<PKGBUILDDIR>>/debian/include  -I../include -I/<<PKGBUILDDIR>>/build-tree/powerpcspe-libc/signal
> -I/<<PKGBUILDDIR>>/build-tree/powerpcspe-libc  -I../sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/nofpu  -I../sysdeps/powerpc/powerpc32/e500/nofpu
> -I../sysdeps/powerpc/nofpu  -I../sysdeps/powerpc/soft-fp  -I../sysdeps/unix/sysv/linux/powerpc/powerpc32/e500
> -I../sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu  -I../sysdeps/unix/sysv/linux/powerpc/powerpc32  -I../sysdeps/unix/sysv/linux/powerpc
> -I../sysdeps/powerpc/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu
> -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/powerpc  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/powerpc/powerpc32/e500
> -I../sysdeps/powerpc/powerpc32  -I../sysdeps/wordsize-32  -I../sysdeps/powerpc  -I../sysdeps/ieee754/ldbl-128ibm/include -I../sysdeps/ieee754/ldbl-128ibm
> -I../sysdeps/ieee754/ldbl-opt  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I.
> -nostdinc -isystem /usr/lib/gcc/powerpc-linux-gnuspe/7/include -isystem /usr/lib/gcc/powerpc-linux-gnuspe/7/include-fixed -isystem
> /<<PKGBUILDDIR>>/debian/include  -D_LIBC_REENTRANT -include /<<PKGBUILDDIR>>/build-tree/powerpcspe-libc/libc-modules.h -DMODULE_NAME=libc -include
> ../include/libc-symbols.h       -DTOP_NAMESPACE=glibc -DASSEMBLER  -pipe -O2 -g  -Werror=undef -Wa,--noexecstack   -o
> /<<PKGBUILDDIR>>/build-tree/powerpcspe-libc/signal/kill.o -x assembler-with-cpp - -MD -MP -MF /<<PKGBUILDDIR>>/build-tree/powerpcspe-libc/signal/kill.o.dt -MT
> /<<PKGBUILDDIR>>/build-tree/powerpcspe-libc/signal/kill.o
> ../sysdeps/unix/syscall-template.S: Assembler messages:
> ../sysdeps/unix/syscall-template.S:78: Error: unrecognized opcode: `tabort.'
> make[3]: *** [/<<PKGBUILDDIR>>/build-tree/powerpcspe-libc/sysd-syscalls:2109: /<<PKGBUILDDIR>>/build-tree/powerpcspe-libc/signal/kill.o] Error 1
> make[3]: Leaving directory '/<<PKGBUILDDIR>>/signal'
> make[2]: *** [Makefile:231: signal/subdir_lib] Error 2
> make[2]: Leaving directory '/<<PKGBUILDDIR>>'
> make[1]: *** [Makefile:9: all] Error 2
> make[1]: Leaving directory '/<<PKGBUILDDIR>>/build-tree/powerpcspe-libc'
> make: *** [debian/rules.d/build.mk:103: /<<PKGBUILDDIR>>/stamp-dir/build_libc] Error 2
> dpkg-buildpackage: error: debian/rules build-arch subprocess returned exit status 2
> 
> Adrian
> 
>> [1] https://buildd.debian.org/status/fetch.php?pkg=glibc&arch=powerpcspe&ver=2.27-1&stamp=1520078744&raw=0
> 

VLE opcodes clashes with some recent ISA opcodes and until recently gas
did not complain about it.  However it was recently changed by Alan
on 14b57c7c6 and now VLE configure gas does not support to assembler
some opcodes that might class with VLE (HTM included).  It does not
help when we changed glibc to add lock elision support with HLE as
default (regardless of assembler support).

I think best approach is just to disable any HTM usage when __VLE__ is
defined:


I will prepare a patch.

Patch

diff --git a/sysdeps/powerpc/powerpc32/sysdep.h b/sysdeps/powerpc/powerpc32/sysdep.h
index 8e32a2a..5f1294e 100644
--- a/sysdeps/powerpc/powerpc32/sysdep.h
+++ b/sysdeps/powerpc/powerpc32/sysdep.h
@@ -90,7 +90,7 @@  GOT_LABEL:			;					      \
   cfi_endproc;								      \
   ASM_SIZE_DIRECTIVE(name)
 
-#if ! IS_IN(rtld)
+#if !IS_IN(rtld) && !defined(__SPE__)
 # define ABORT_TRANSACTION_IMPL \
     cmpwi    2,0;		\
     beq      1f;		\
diff --git a/sysdeps/powerpc/sysdep.h b/sysdeps/powerpc/sysdep.h
index 03db75f..8a6d236 100644
--- a/sysdeps/powerpc/sysdep.h
+++ b/sysdeps/powerpc/sysdep.h
@@ -174,7 +174,7 @@ 
    we abort transaction just before syscalls.
 
    [1] Documentation/powerpc/transactional_memory.txt [Syscalls]  */
-#if !IS_IN(rtld)
+#if !IS_IN(rtld) && !defined(__SPE__)
 # define ABORT_TRANSACTION \
   ({ 						\
     if (THREAD_GET_TM_CAPABLE ())		\
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
index b7093fe..98a23f0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-lock.c
@@ -45,6 +45,7 @@ 
 int
 __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
 {
+#ifndef __SPE__
   /* adapt_count is accessed concurrently but is just a hint.  Thus,
      use atomic accesses but relaxed MO is sufficient.  */
   if (atomic_load_relaxed (adapt_count) > 0)
@@ -82,5 +83,6 @@  __lll_lock_elision (int *lock, short *adapt_count, EXTRAARG int pshared)
 			  aconf.skip_lock_out_of_tbegin_retries);
 
 use_lock:
+#endif
   return LLL_LOCK ((*lock), pshared);
 }
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
index b74a810..fabb03b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-trylock.c
@@ -30,6 +30,7 @@ 
 int
 __lll_trylock_elision (int *futex, short *adapt_count)
 {
+#ifndef __SPE__
   /* Implement POSIX semantics by forbiding nesting elided trylocks.  */
   __libc_tabort (_ABORT_NESTED_TRYLOCK);
 
@@ -65,5 +66,6 @@  __lll_trylock_elision (int *futex, short *adapt_count)
     }
 
 use_lock:
+#endif
   return lll_trylock (*futex);
 }
diff --git a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
index dcfab19..14e0680 100644
--- a/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
+++ b/sysdeps/unix/sysv/linux/powerpc/elision-unlock.c
@@ -23,6 +23,7 @@ 
 int
 __lll_unlock_elision (int *lock, short *adapt_count, int pshared)
 {
+#ifndef __SPE__
   /* When the lock was free we're in a transaction.  */
   if (*lock == 0)
     __libc_tend (0);
@@ -39,5 +40,8 @@  __lll_unlock_elision (int *lock, short *adapt_count, int pshared)
 
       lll_unlock ((*lock), pshared);
     }
+#else
+  lll_unlock ((*lock), pshared);
+#endif
   return 0;
 }