Re: [PATCH] libtool: preliminary support for the Cray compiler.

2016-09-27 Thread Christian Feld

Hi Eric,

On 2015-06-02 17:27, Eric Bavier wrote:

Has anyone had a chance to look this patch over?


we found one OpenMP related issue in your patch. In contrast to other
compilers, the Cray compiler enables OpenMP by default (-homp) and you
need to pass -hnoomp to disable it.

With your patch, building a non-OpenMP library adds -hnoomp to
inherited_linker_flags. Linking this non-OpenMP library to an OpenMP
program leads to undefined OpenMP symbols because the inherited linker
flag -hnoomp gets added late to the link line. Here it doesn't matter if
you explicitly specify -homp for linking or just use the default.

This is easy to fix, see below.


`~Eric

On 04/14/2015 12:46 PM, Eric Bavier wrote:

I'd like to get some additional feedback on this patch for the Cray
Compiler Environment support in libtool, now that the copyright
assignment process has (finally) gone through.


0001-libtool-preliminary-support-for-the-Cray-compiler.patch


From 533d9854c7b3c6c351f5a8d7f2f69e69fb73ad40 Mon Sep 17 00:00:00 2001
From: Eric Bavier 
Date: Tue, 18 Nov 2014 15:33:58 -0600
Subject: [PATCH] libtool: preliminary support for the Cray compiler.

This patch adds preliminary support for the Cray Compiler
Environment (CCE) to libtool.  Main issues:

  - When linking a static executable, the value of the STRIP environment
variable must be an absolute file name.

  - Symbols will be stripped from shared libraries during creation if
the STRIP environment variable is set.

  - When linking against shared libraries, or dlopening a library, a
"-dynamic" option needs to be given to the compiler that it can make
sure that linked system libraries are shared libraries.
---
 build-aux/ltmain.in | 38 +++---
 m4/libtool.m4   | 48 +++-
 2 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index d5cf07a..aee9a9b 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5159,7 +5159,7 @@ func_mode_link ()
 ;;

   -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-h*omp)


should be:
+  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-homp)


 func_append compiler_flags " $arg"
 func_append compile_command " $arg"
 func_append finalize_command " $arg"
@@ -5693,7 +5693,7 @@ func_mode_link ()
 found=false
 case $deplib in
 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)


should be:
+|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-homp)

Thanks,
Christian


+|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-h*omp)
   if test prog,link = "$linkmode,$pass"; then
 compile_deplibs="$deplib $compile_deplibs"
 finalize_deplibs="$deplib $finalize_deplibs"
@@ -6234,6 +6234,21 @@ func_mode_link ()
   esac
   # This is a shared library

+  # Cray's compiler drivers need a -dynamic flag if any linked
+  # library is a shared library.  Ensure it gets this flag.
+  case `$CC -V 2>&1 | sed 5q` in
+  *Cray*)
+  case " $compile_command " in
+  *" -dynamic ") ;;
+  *) func_append compile_command " -dynamic" ;;
+  esac
+  case " $finalize_command " in
+  *" -dynamic ") ;;
+  *) func_append finalize_command " -dynamic" ;;
+  esac
+  ;;
+  esac
+
   # Warn about portability, can't link against -module's on some
   # systems (darwin).  Don't bleat about dlopened modules though!
   dlopenmodule=
@@ -8311,7 +8326,24 @@ EOF
 finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ 
$]*\).ltframework% -framework \1%g'`
 ;;
   esac
-
+  if test -n "$dlfiles" ||
+ test "$dlself" = "yes" ||
+ test "$export_dynamic" = "yes"; then
+# Cray's compiler drivers need a -dynamic flag if the program
+# is going to be dlopening itself or any libraries.
+case `$CC -V 2>&1 | sed 5q` in
+*Cray*)
+case " $compile_command " in
+*" -dynamic ") ;;
+*) func_append compile_command " -dynamic" ;;
+esac
+case " $finalize_command " in
+*" -dynamic ") ;;
+*) func_append finalize_command " -dynamic" ;;
+esac
+;;
+esac
+  fi

   # move library search paths that coincide with paths to not yet
   # installed libraries to the beginning of the library search list
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index a3bc337..5467b5d 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1530,7 +1530,9 @@ _LT_DECL([], [archiver_list_spec], [1],
 m4_defun([_LT_CMD_OLD_ARCHIVE],
 

Re: [PATCH] libtool: preliminary support for the Cray compiler.

2016-05-04 Thread Sean Byland
I didn’t notice that the archive reference was missing:
http://lists.gnu.org/archive/html/libtool/2015-04/msg3.html

and here’s the patch:
http://lists.gnu.org/archive/html/libtool/2015-04/txtaYIR4rrTPk.txt

Thanks,
Sean B.

From: Sean Byland <se...@cray.com<mailto:se...@cray.com>>
Date: Wednesday, May 4, 2016 at 2:41 PM
To: "libtool@gnu.org<mailto:libtool@gnu.org>" 
<libtool@gnu.org<mailto:libtool@gnu.org>>, 
"libtool-patc...@gnu.org<mailto:libtool-patc...@gnu.org>" 
<libtool-patc...@gnu.org<mailto:libtool-patc...@gnu.org>>
Cc: Eric Bavier <bav...@cray.com<mailto:bav...@cray.com>>
Subject: Re: [PATCH] libtool: preliminary support for the Cray compiler.

Did anyone get a chance to look at this patch that Eric created last year? Is 
there any chance it could be merged in with the libtool source? In order for 
people to build shared libraries with CCE, I have to tell them to download the 
libtool source and then apply this patch. It would be greatly appreciated if we 
could eliminate the patching step and at some point have the ltmain.sh that 
ships with most packages generate appropriate flags.

Thanks,
Sean B.
___
https://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] libtool: preliminary support for the Cray compiler.

2016-05-04 Thread Sean Byland
I didn’t notice that the archive reference was missing:
http://lists.gnu.org/archive/html/libtool/2015-04/msg3.html

and here’s the patch:
http://lists.gnu.org/archive/html/libtool/2015-04/txtaYIR4rrTPk.txt

Thanks,
Sean B.

From: Sean Byland <se...@cray.com<mailto:se...@cray.com>>
Date: Wednesday, May 4, 2016 at 2:41 PM
To: "libt...@gnu.org<mailto:libt...@gnu.org>" 
<libt...@gnu.org<mailto:libt...@gnu.org>>, 
"libtool-patches@gnu.org<mailto:libtool-patches@gnu.org>" 
<libtool-patches@gnu.org<mailto:libtool-patches@gnu.org>>
Cc: Eric Bavier <bav...@cray.com<mailto:bav...@cray.com>>
Subject: Re: [PATCH] libtool: preliminary support for the Cray compiler.

Did anyone get a chance to look at this patch that Eric created last year? Is 
there any chance it could be merged in with the libtool source? In order for 
people to build shared libraries with CCE, I have to tell them to download the 
libtool source and then apply this patch. It would be greatly appreciated if we 
could eliminate the patching step and at some point have the ltmain.sh that 
ships with most packages generate appropriate flags.

Thanks,
Sean B.


Re: [PATCH] libtool: preliminary support for the Cray compiler.

2016-05-04 Thread Sean Byland
Did anyone get a chance to look at this patch that Eric created last year? Is 
there any chance it could be merged in with the libtool source? In order for 
people to build shared libraries with CCE, I have to tell them to download the 
libtool source and then apply this patch. It would be greatly appreciated if we 
could eliminate the patching step and at some point have the ltmain.sh that 
ships with most packages generate appropriate flags.

Thanks,
Sean B.


Re: [PATCH] libtool: preliminary support for the Cray compiler.

2016-05-04 Thread Sean Byland
Did anyone get a chance to look at this patch that Eric created last year? Is 
there any chance it could be merged in with the libtool source? In order for 
people to build shared libraries with CCE, I have to tell them to download the 
libtool source and then apply this patch. It would be greatly appreciated if we 
could eliminate the patching step and at some point have the ltmain.sh that 
ships with most packages generate appropriate flags.

Thanks,
Sean B.
___
https://lists.gnu.org/mailman/listinfo/libtool


Re: [PATCH] libtool: preliminary support for the Cray compiler.

2015-06-02 Thread Eric Bavier

Has anyone had a chance to look this patch over?

`~Eric

On 04/14/2015 12:46 PM, Eric Bavier wrote:

I'd like to get some additional feedback on this patch for the Cray
Compiler Environment support in libtool, now that the copyright
assignment process has (finally) gone through.


0001-libtool-preliminary-support-for-the-Cray-compiler.patch


 From 533d9854c7b3c6c351f5a8d7f2f69e69fb73ad40 Mon Sep 17 00:00:00 2001
From: Eric Bavierbav...@cray.com
Date: Tue, 18 Nov 2014 15:33:58 -0600
Subject: [PATCH] libtool: preliminary support for the Cray compiler.

This patch adds preliminary support for the Cray Compiler
Environment (CCE) to libtool.  Main issues:

   - When linking a static executable, the value of the STRIP environment
 variable must be an absolute file name.

   - Symbols will be stripped from shared libraries during creation if
 the STRIP environment variable is set.

   - When linking against shared libraries, or dlopening a library, a
 -dynamic option needs to be given to the compiler that it can make
 sure that linked system libraries are shared libraries.
---
  build-aux/ltmain.in | 38 +++---
  m4/libtool.m4   | 48 +++-
  2 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index d5cf07a..aee9a9b 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5159,7 +5159,7 @@ func_mode_link ()
;;
  
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \

-  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-h*omp)
func_append compiler_flags  $arg
func_append compile_command  $arg
func_append finalize_command  $arg
@@ -5693,7 +5693,7 @@ func_mode_link ()
found=false
case $deplib in
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-h*omp)
  if test prog,link = $linkmode,$pass; then
compile_deplibs=$deplib $compile_deplibs
finalize_deplibs=$deplib $finalize_deplibs
@@ -6234,6 +6234,21 @@ func_mode_link ()
  esac
  # This is a shared library
  
+	  # Cray's compiler drivers need a -dynamic flag if any linked

+ # library is a shared library.  Ensure it gets this flag.
+ case `$CC -V 21 | sed 5q` in
+   *Cray*)
+ case  $compile_command  in
+ * -dynamic ) ;;
+ *) func_append compile_command  -dynamic ;;
+ esac
+ case  $finalize_command  in
+ * -dynamic ) ;;
+ *) func_append finalize_command  -dynamic ;;
+ esac
+ ;;
+ esac
+
  # Warn about portability, can't link against -module's on some
  # systems (darwin).  Don't bleat about dlopened modules though!
  dlopenmodule=
@@ -8311,7 +8326,24 @@ EOF
finalize_deplibs=`$ECHO  $finalize_deplibs | $SED 's% \([^ 
$]*\).ltframework% -framework \1%g'`
;;
esac
-
+  if test -n $dlfiles ||
+test $dlself = yes ||
+test $export_dynamic = yes; then
+   # Cray's compiler drivers need a -dynamic flag if the program
+   # is going to be dlopening itself or any libraries.
+   case `$CC -V 21 | sed 5q` in
+   *Cray*)
+   case  $compile_command  in
+   * -dynamic ) ;;
+   *) func_append compile_command  -dynamic ;;
+   esac
+   case  $finalize_command  in
+   * -dynamic ) ;;
+   *) func_append finalize_command  -dynamic ;;
+   esac
+   ;;
+   esac
+  fi
  
# move library search paths that coincide with paths to not yet

# installed libraries to the beginning of the library search list
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index a3bc337..5467b5d 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1530,7 +1530,9 @@ _LT_DECL([], [archiver_list_spec], [1],
  m4_defun([_LT_CMD_OLD_ARCHIVE],
  [_LT_PROG_AR
  
-AC_CHECK_TOOL(STRIP, strip,:)

+# Cray's compiler drivers need STRIP to be an absolute file name when
+# static linking.
+AC_PATH_TOOL(STRIP, strip,:)
  test -z $STRIP  STRIP=:
  _LT_DECL([], [STRIP], [1], [A symbol stripping program])
  
@@ -4407,6 +4409,12 @@ m4_if([$1], [CXX], [

  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
  ;;
+   *Cray\ C*)
+ # Cray C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-hpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
 

Re: [PATCH] libtool: preliminary support for the Cray compiler.

2015-04-14 Thread Eric Bavier
I'd like to get some additional feedback on this patch for the Cray
Compiler Environment support in libtool, now that the copyright
assignment process has (finally) gone through.

From 533d9854c7b3c6c351f5a8d7f2f69e69fb73ad40 Mon Sep 17 00:00:00 2001
From: Eric Bavier bav...@cray.com
Date: Tue, 18 Nov 2014 15:33:58 -0600
Subject: [PATCH] libtool: preliminary support for the Cray compiler.

This patch adds preliminary support for the Cray Compiler
Environment (CCE) to libtool.  Main issues:

  - When linking a static executable, the value of the STRIP environment
variable must be an absolute file name.

  - Symbols will be stripped from shared libraries during creation if
the STRIP environment variable is set.

  - When linking against shared libraries, or dlopening a library, a
-dynamic option needs to be given to the compiler that it can make
sure that linked system libraries are shared libraries.
---
 build-aux/ltmain.in | 38 +++---
 m4/libtool.m4   | 48 +++-
 2 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index d5cf07a..aee9a9b 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5159,7 +5159,7 @@ func_mode_link ()
 	;;
 
   -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+  |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-h*omp)
 	func_append compiler_flags  $arg
 	func_append compile_command  $arg
 	func_append finalize_command  $arg
@@ -5693,7 +5693,7 @@ func_mode_link ()
 	found=false
 	case $deplib in
 	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
-|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+|-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*|-h*omp)
 	  if test prog,link = $linkmode,$pass; then
 	compile_deplibs=$deplib $compile_deplibs
 	finalize_deplibs=$deplib $finalize_deplibs
@@ -6234,6 +6234,21 @@ func_mode_link ()
 	  esac
 	  # This is a shared library
 
+	  # Cray's compiler drivers need a -dynamic flag if any linked
+	  # library is a shared library.  Ensure it gets this flag.
+	  case `$CC -V 21 | sed 5q` in
+	  *Cray*)
+		  case  $compile_command  in
+		  * -dynamic ) ;;
+		  *) func_append compile_command  -dynamic ;;
+		  esac
+		  case  $finalize_command  in
+		  * -dynamic ) ;;
+		  *) func_append finalize_command  -dynamic ;;
+		  esac
+		  ;;
+	  esac
+
 	  # Warn about portability, can't link against -module's on some
 	  # systems (darwin).  Don't bleat about dlopened modules though!
 	  dlopenmodule=
@@ -8311,7 +8326,24 @@ EOF
 	finalize_deplibs=`$ECHO  $finalize_deplibs | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	;;
   esac
-
+  if test -n $dlfiles ||
+	 test $dlself = yes ||
+	 test $export_dynamic = yes; then
+	# Cray's compiler drivers need a -dynamic flag if the program
+	# is going to be dlopening itself or any libraries.
+	case `$CC -V 21 | sed 5q` in
+	*Cray*)
+		case  $compile_command  in
+		* -dynamic ) ;;
+		*) func_append compile_command  -dynamic ;;
+		esac
+		case  $finalize_command  in
+		* -dynamic ) ;;
+		*) func_append finalize_command  -dynamic ;;
+		esac
+		;;
+	esac
+  fi
 
   # move library search paths that coincide with paths to not yet
   # installed libraries to the beginning of the library search list
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index a3bc337..5467b5d 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1530,7 +1530,9 @@ _LT_DECL([], [archiver_list_spec], [1],
 m4_defun([_LT_CMD_OLD_ARCHIVE],
 [_LT_PROG_AR
 
-AC_CHECK_TOOL(STRIP, strip, :)
+# Cray's compiler drivers need STRIP to be an absolute file name when
+# static linking.
+AC_PATH_TOOL(STRIP, strip, :)
 test -z $STRIP  STRIP=:
 _LT_DECL([], [STRIP], [1], [A symbol stripping program])
 
@@ -4407,6 +4409,12 @@ m4_if([$1], [CXX], [
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
 	  ;;
+	*Cray\ C*)
+	  # Cray C++ compiler
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-hpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
 	esac
 	;;
 	esac
@@ -4764,6 +4772,11 @@ m4_if([$1], [CXX], [
 	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	  ;;
+	*Cray\ Fortran* | *Cray\ C*)
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-hpic'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	  ;;
 	esac
 	;;
   esac
@@ -5247,6 +5260,14 @@ _LT_EOF
 	  fi
 	  ;;
 	esac
+	case `$CC -V 21 | sed 5q` in
+	*Cray\ C* | *Cray\ Fortran*)# Cray C/C++/Fortran
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\\; do