Re: [PATCH, PR d/90086] Fix linker warning and SEGV in core.thread tests

2019-04-25 Thread Rainer Orth
Hi Iain,

> This patch removes the monolithic and cumbersome to maintain
> core/threadasm.S, and splitted it into multiple parts, one for each
> intended target cpu/os.
>
> Added .type and .size directives for all asm implementations of
> fiber_switchContent and callWithStackShell where they were missing,
> fixing the last remaining failing test on -m32 that I can reproduce
> locally.
>
> Bootstrapped and regression tested on x86_64-linux-gnu with multilibs
> -m32, -mx32, and -m64.
>
> Committed to trunk as r270560.

this patch badly broke x86 libphobos testing, as noticed during a
i386-pc-solaris2.11 build.  All link tests FAIL like this:

FAIL: libphobos.cycles/mod1.d --DRT-oncycle=print (test for excess errors)
Excess errors:
Undefined   first referenced
 symbol in file
fiber_switchContext 
/var/gcc/gcc-9.0.1-20190425/11.5-gcc-gas-libphobos/i386-pc-solaris2.11/libphobos/libdruntime/.libs/libgdruntime.a(thread.o)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status

UNRESOLVED: libphobos.cycles/mod1.d --DRT-oncycle=print compilation failed to 
produce executable

You need to quote brackets to get them from m4/autoconf macros into
configure.  Fixed as follows, tested on i386-pc-solaris2.11, installed
as obvious.

Rainer

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


2019-04-25  Rainer Orth  

* m4/druntime/cpu.m4 (DRUNTIME_CPU_SOURCES): Quote brackets.
* configure: Regenerate.

# HG changeset patch
# Parent  a7a44865fd130abcbd002e700515b1b113704d0c
Fix typo in m4/druntime/cpu.m4

diff --git a/libphobos/configure b/libphobos/configure
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -14050,7 +14050,7 @@ fi
   powerpc64)
druntime_target_cpu_parsed="powerpc64"
;;
-  i3456786|x86_64)
+  i[34567]86|x86_64)
druntime_target_cpu_parsed="x86"
;;
   esac
diff --git a/libphobos/m4/druntime/cpu.m4 b/libphobos/m4/druntime/cpu.m4
--- a/libphobos/m4/druntime/cpu.m4
+++ b/libphobos/m4/druntime/cpu.m4
@@ -22,7 +22,7 @@ AC_DEFUN([DRUNTIME_CPU_SOURCES],
   powerpc64)
druntime_target_cpu_parsed="powerpc64"
;;
-  i[34567]86|x86_64)
+  i[[34567]]86|x86_64)
druntime_target_cpu_parsed="x86"
;;
   esac


[PATCH, PR d/90086] Fix linker warning and SEGV in core.thread tests

2019-04-24 Thread Iain Buclaw
Hi,

This patch removes the monolithic and cumbersome to maintain
core/threadasm.S, and splitted it into multiple parts, one for each
intended target cpu/os.

Added .type and .size directives for all asm implementations of
fiber_switchContent and callWithStackShell where they were missing,
fixing the last remaining failing test on -m32 that I can reproduce
locally.

Bootstrapped and regression tested on x86_64-linux-gnu with multilibs
-m32, -mx32, and -m64.

Committed to trunk as r270560.

-- 
Iain
---
libphobos/ChangeLog:

2019-04-25  Iain Buclaw  

PR d/90086
* m4/druntime/cpu.m4 (DRUNTIME_CPU_SOURCES): New macro.
* configure.ac: Use it.
* configure: Regenerate.
* libdruntime/Makefile.am: Add new config sources to
DRUNTIME_SOURCES_CONFIGURED.
* libdruntime/Makefile.in: Regenerate.
* libdruntime/config/aarch64/switchcontext.S: New file.
* libdruntime/config/arm/switchcontext.S: New file.
* libdruntime/config/common/threadasm.S: New file.
* libdruntime/config/mingw/switchcontext.S: New file.
* libdruntime/config/mips/switchcontext.S: New file.
* libdruntime/config/powerpc/switchcontext.S: New file.
* libdruntime/config/powerpc64/callwithstack.S: New file.
* libdruntime/config/x86/switchcontext.S: New file.
* libdruntime/core/threadasm.S: Remove.
---
diff --git a/libphobos/configure b/libphobos/configure
index 7c019899c5c..67fe34d7184 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -681,6 +681,18 @@ DRUNTIME_OS_AIX_FALSE
 DRUNTIME_OS_AIX_TRUE
 DRUNTIME_OS_UNIX_FALSE
 DRUNTIME_OS_UNIX_TRUE
+DRUNTIME_CPU_X86_FALSE
+DRUNTIME_CPU_X86_TRUE
+DRUNTIME_CPU_POWERPC64_FALSE
+DRUNTIME_CPU_POWERPC64_TRUE
+DRUNTIME_CPU_POWERPC_FALSE
+DRUNTIME_CPU_POWERPC_TRUE
+DRUNTIME_CPU_MIPS_FALSE
+DRUNTIME_CPU_MIPS_TRUE
+DRUNTIME_CPU_ARM_FALSE
+DRUNTIME_CPU_ARM_TRUE
+DRUNTIME_CPU_AARCH64_FALSE
+DRUNTIME_CPU_AARCH64_TRUE
 DRUNTIME_GC_ENABLE_FALSE
 DRUNTIME_GC_ENABLE_TRUE
 libphobos_srcdir
@@ -11623,7 +11635,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11626 "configure"
+#line 11638 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11729,7 +11741,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11732 "configure"
+#line 11744 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14024,6 +14036,74 @@ fi
 
 
 
+  druntime_target_cpu_parsed=""
+  case "$target_cpu" in
+  aarch64*)
+   druntime_target_cpu_parsed="aarch64"
+   ;;
+  arm*)druntime_target_cpu_parsed="arm"
+   ;;
+  mips*)   druntime_target_cpu_parsed="mips"
+   ;;
+  powerpc) druntime_target_cpu_parsed="powerpc"
+   ;;
+  powerpc64)
+   druntime_target_cpu_parsed="powerpc64"
+   ;;
+  i3456786|x86_64)
+   druntime_target_cpu_parsed="x86"
+   ;;
+  esac
+   if test "$druntime_target_cpu_parsed" = "aarch64"; then
+  DRUNTIME_CPU_AARCH64_TRUE=
+  DRUNTIME_CPU_AARCH64_FALSE='#'
+else
+  DRUNTIME_CPU_AARCH64_TRUE='#'
+  DRUNTIME_CPU_AARCH64_FALSE=
+fi
+
+   if test "$druntime_target_cpu_parsed" = "arm"; then
+  DRUNTIME_CPU_ARM_TRUE=
+  DRUNTIME_CPU_ARM_FALSE='#'
+else
+  DRUNTIME_CPU_ARM_TRUE='#'
+  DRUNTIME_CPU_ARM_FALSE=
+fi
+
+   if test "$druntime_target_cpu_parsed" = "mips"; then
+  DRUNTIME_CPU_MIPS_TRUE=
+  DRUNTIME_CPU_MIPS_FALSE='#'
+else
+  DRUNTIME_CPU_MIPS_TRUE='#'
+  DRUNTIME_CPU_MIPS_FALSE=
+fi
+
+   if test "$druntime_target_cpu_parsed" = "powerpc"; then
+  DRUNTIME_CPU_POWERPC_TRUE=
+  DRUNTIME_CPU_POWERPC_FALSE='#'
+else
+  DRUNTIME_CPU_POWERPC_TRUE='#'
+  DRUNTIME_CPU_POWERPC_FALSE=
+fi
+
+   if test "$druntime_target_cpu_parsed" = "powerpc64"; then
+  DRUNTIME_CPU_POWERPC64_TRUE=
+  DRUNTIME_CPU_POWERPC64_FALSE='#'
+else
+  DRUNTIME_CPU_POWERPC64_TRUE='#'
+  DRUNTIME_CPU_POWERPC64_FALSE=
+fi
+
+   if test "$druntime_target_cpu_parsed" = "x86"; then
+  DRUNTIME_CPU_X86_TRUE=
+  DRUNTIME_CPU_X86_FALSE='#'
+else
+  DRUNTIME_CPU_X86_TRUE='#'
+  DRUNTIME_CPU_X86_FALSE=
+fi
+
+
+
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for target OS" >&5
 $as_echo_n "checking for target OS... " >&6; }
 if ${druntime_cv_target_os+:} false; then :
@@ -15413,6 +15493,30 @@ if test -z "${DRUNTIME_GC_ENABLE_TRUE}" && test -z "${DRUNTIME_GC_ENABLE_FALSE}"
   as_fn_error $? "conditional \"DRUNTIME_GC_ENABLE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${DRUNTIME_CPU_AARCH64_TRUE}" && test -z "${DRUNTIME_CPU_AARCH64_FALSE}"; then
+  as_fn_error $? "conditional \"DRUNTIME_CPU_AARCH64\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DRUNTIME_CPU_ARM_TRUE}" && test -z "${DRUNTIME_CPU_ARM_F