Re: Bug#485421: With icc, libtool tries -KPIC (removed option) instead of -fPIC

2008-06-18 Thread Vincent Lefevre
Hi Ralf,

On 2008-06-18 22:31:49 +0200, Ralf Wildenhues wrote:
> diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
> index a2a4534..4a8d3e5 100644
> --- a/libltdl/m4/libtool.m4
> +++ b/libltdl/m4/libtool.m4
> @@ -3703,8 +3703,15 @@ m4_if([$1], [CXX], [
>   _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
>   _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
>   ;;
> -   icpc* | ecpc* )
> - # Intel C++
> +   ecpc* )
> + # old Intel C++ for x86_64 which still supported -KPIC.
> + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
> + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
> + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
> + ;;
> +   icpc* )
> + # Intel C++, used to be incompatible with GCC.
> + # ICC 10 doesn't accept -KPIC any more.
>   _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
>   _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
  ^
Shouldn't it be '-fPIC'?

Unfortunately I can't try the patch on the same machine because the
icc license has expired a few days ago (it was just an evaluation
version). However I have access to another machine with icc installed;
this is a different version, but it's also a version that doesn't
accept -KPIC, so I assume the test will be significant.

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)




Re: Bug#485421: With icc, libtool tries -KPIC (removed option) instead of -fPIC

2008-06-18 Thread Ralf Wildenhues
[  ]

Hello Vincent, and sorry for the slow reply,

* Vincent Lefevre wrote on Mon, Jun 09, 2008 at 02:45:11PM CEST:
> On 2008-06-09 14:24:00 +0200, Ralf Wildenhues wrote:
> > Sigh.  They can't even keep compatibility with their own compiler.
> > (IIRC at the point this code was introduced, -KPIC worked and -fPIC
> > didn't.)
> 
> Didn't they mark it as deprecated before being removed?

They did.  So?  What's the cost of Just Supporting It Indefinitely?
In this case, my guess is: close to zero.

If they didn't like -KPIC, why didn't they use -fPIC right from the
start?  (No need to answer, it's a long story, buying KCC and so on...)

See, even with them marking it as deprecated, and adding a warning
option and all, here, there's really no point in introducing
incompatible command line API changes.  I mean heck, ICC for years just
worked to emulate GCC's command line API, using such despicable
strategies such as ignoring unknown options matching '-f*' without an
error return:

> icpc: command line warning #10006: ignoring unknown option '-frpath'

but when it comes to their own, documented options, they introduce hard
failures.  That's just inconsistent in the extreme.

> icpc: error #10014: problem during multi-file optimization compilation
> (code 4)

That looks like you have a broken icpc installation.

Anyway, this is the patch I'd like to apply, plus put you in THANKS.
Please give it a whirl.

Thanks,
Ralf

2008-06-18  Ralf Wildenhues  <[EMAIL PROTECTED]>

* libltdl/m4/libtool.m4 (_LT_COMPILER_PIC) [linux] :
Use -fPIC, newer Intel compilers (icc 10, ifort 9) reject -KPIC.
* tests/localization.at: Skip test if the compiler fails merely
due to the locale setting.
* THANKS: Update.
Report by Vincent Lefevre.

diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index a2a4534..4a8d3e5 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -3703,8 +3703,15 @@ m4_if([$1], [CXX], [
_LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
- icpc* | ecpc* )
-   # Intel C++
+ ecpc* )
+   # old Intel C++ for x86_64 which still supported -KPIC.
+   _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+   _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+   _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+   ;;
+ icpc* )
+   # Intel C++, used to be incompatible with GCC.
+   # ICC 10 doesn't accept -KPIC any more.
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
@@ -3974,12 +3981,15 @@ m4_if([$1], [CXX], [
 
 linux* | k*bsd*-gnu)
   case $cc_basename in
-  icc* | ecc*)
+  # old Intel for x86_64 which still supported -KPIC.
+  ecc*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
 ;;
-  ifort*)
+  # icc used to be incompatible with GCC.
+  # ICC 10 doesn't accept -KPIC any more.
+  icc* | ifort*)
_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
diff --git a/tests/localization.at b/tests/localization.at
index 311aca7..d489fef 100644
--- a/tests/localization.at
+++ b/tests/localization.at
@@ -38,6 +38,10 @@ AT_DATA([b.c],
 [[int y;
 ]])
 
+# First see if setting a locale is accepted at all.
+AT_CHECK([$CC $CPPFLAGS $CFLAGS -c b.c || exit 77], [], [stdout], [stderr])
+
+# Find out about expected output.
 AT_CHECK([$CC $CPPFLAGS $CFLAGS -c a.c || exit 1], [1], [stdout], [stderr])
 mv -f stdout expected-stdout
 mv -f stderr expected-stderr




Re: [PATCH 370 bis] Implement lt_dlopening of only preloaded modules.

2008-06-18 Thread Bob Friesenhahn

On Wed, 18 Jun 2008, Gary V. Vaughan wrote:


Ping?

I'll push in a day or two unless someone asks me not to...


I am not seeing a problem with this patch.

Bob



On 7 May 2008, at 21:32, Gary V. Vaughan wrote:


* libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
provides lt_dladvise_preopen when deciding if installed libltdl
is 'new enough'.
* libltdl/libltdl/lt__private.h (lt__advise): Add a new
is_preload flag.
* libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
(try_dlopen): If it is set, and the search of preloaded modules
didn't return a match, don't bother searching the filesystem.
* libltdl/ltdl.h (lt_dladvise_preload): Declare it.
* doc/libtool.texi (Libltdl Interface): Document it.
* tests/lt_dladvise.at: Test it (and incidentally add some test
coverage for `libtool -dlpreopen').
* NEWS: Announce it.
---

With (most) nits corrected... see my earlier post for details.

Okay to push?

ChangeLog |   17 +++
NEWS  |5 ++-
doc/libtool.texi  |7 +
libltdl/libltdl/lt__private.h |1 +
libltdl/ltdl.c|   26 -
libltdl/ltdl.h|1 +
libltdl/m4/ltdl.m4|2 +-
tests/lt_dladvise.at  |   61 
+---

8 files changed, 104 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 15ffae1..2a1c843 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-05-06  Gary V. Vaughan  <[EMAIL PROTECTED]>
+
+   Implement lt_dlopening of only preloaded modules.
+   * libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
+   provides lt_dladvise_preopen when deciding if installed libltdl
+   is 'new enough'.
+   * libltdl/libltdl/lt__private.h (lt__advise): Add a new
+   is_preload flag.
+   * libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
+   (try_dlopen): If it is set, and the search of preloaded modules
+   didn't return a match, don't bother searching the filesystem.
+   * libltdl/ltdl.h (lt_dladvise_preload): Declare it.
+   * doc/libtool.texi (Libltdl Interface): Document it.
+   * tests/lt_dladvise.at: Test it (and incidentally add some test
+   coverage for `libtool -dlpreopen').
+   * NEWS: Announce it.
+
2008-05-05  Gary V. Vaughan  <[EMAIL PROTECTED]>

Fix libtoolize test failure with aclocal < 1.10.1
diff --git a/NEWS b/NEWS
index 2b113fb..3354e6c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,10 @@ NEWS - list of user-visible changes between releases of 
GNU Libtool


New in 2.2.??: 2008-06-??: git version 2.2.5a, Libtool team:

-* Bug fixes:
+* New features:

-  - None yet
+  - New lt_dloadvise_preload() call to set a hint that only preloadeded
+modules can be opened.

New in 2.2.4: 2008-05-04: git version 2.2.3a, Libtool team:

diff --git a/doc/libtool.texi b/doc/libtool.texi
index 31ba0c7..21a3695 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -3816,6 +3816,13 @@ On failure, @code{lt_dladvise_resident} returns 
non-zero and sets an error

message that can be retrieved with @code{lt_dlerror}.
@end deftypefun

[EMAIL PROTECTED] int lt_dladvise_preload (lt_dladvise [EMAIL PROTECTED])
+Set the @code{preload} hint on @var{advise}.  Passing an @var{advise}
+parameter to @code{lt_dlopenadvise} with this hint set causes it to
+load only preloaded modules, so that if a suitable preloaded module is
+not found, @code{lt_dlopenadvise} will return @code{NULL}.
[EMAIL PROTECTED] deftypefun
+
@deftypefun int lt_dlclose (lt_dlhandle @var{handle})
Decrement the reference count on the module @var{handle}.
If it drops to zero and no other module depends on this module,
diff --git a/libltdl/libltdl/lt__private.h b/libltdl/libltdl/lt__private.h
index 4ce936d..f4c4a3d 100644
--- a/libltdl/libltdl/lt__private.h
+++ b/libltdl/libltdl/lt__private.h
@@ -126,6 +126,7 @@ struct lt__advise {
   subsequently loaded modules.  */
 unsigned int   is_symlocal:1;  /* module symbols are only available
   locally. */
+  unsigned int	try_preload_only:1;/* only preloaded modules will be 
tried. */

};

/* --- ERROR HANDLING --- */
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index a89c6bb..5a26565 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -1129,6 +1129,7 @@ try_dlopen (lt_dlhandle *phandle, const char 
*filename, const char *ext,

lt_dladvise advise)
{
 const char *   saved_error = 0;
+  char *   archive_name= 0;
 char * canonical   = 0;
 char * base_name   = 0;
 char * dir = 0;
@@ -1257,16 +1258,21 @@ try_dlopen (lt_dlhandle *phandle, const char 
*filename, const char *ext,


 if (vtable)
{
+ archive_name = MALLOC (char, LT_STRLEN (name) + 3);
  *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));

- if (*phandle == NULL)
+ if ((*phandle == NULL) || (archive_name == NULL

Re: [PATCH 370 bis] Implement lt_dlopening of only preloaded modules.

2008-06-18 Thread Gary V. Vaughan

Ping?

I'll push in a day or two unless someone asks me not to...

On 7 May 2008, at 21:32, Gary V. Vaughan wrote:


* libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
provides lt_dladvise_preopen when deciding if installed libltdl
is 'new enough'.
* libltdl/libltdl/lt__private.h (lt__advise): Add a new
is_preload flag.
* libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
(try_dlopen): If it is set, and the search of preloaded modules
didn't return a match, don't bother searching the filesystem.
* libltdl/ltdl.h (lt_dladvise_preload): Declare it.
* doc/libtool.texi (Libltdl Interface): Document it.
* tests/lt_dladvise.at: Test it (and incidentally add some test
coverage for `libtool -dlpreopen').
* NEWS: Announce it.
---

With (most) nits corrected... see my earlier post for details.

Okay to push?

ChangeLog |   17 +++
NEWS  |5 ++-
doc/libtool.texi  |7 +
libltdl/libltdl/lt__private.h |1 +
libltdl/ltdl.c|   26 -
libltdl/ltdl.h|1 +
libltdl/m4/ltdl.m4|2 +-
tests/lt_dladvise.at  |   61  
+---

8 files changed, 104 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 15ffae1..2a1c843 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-05-06  Gary V. Vaughan  <[EMAIL PROTECTED]>
+
+   Implement lt_dlopening of only preloaded modules.
+   * libltdl/m4/ltdl.m4 (LTDL_INIT): Check for a libltdl that
+   provides lt_dladvise_preopen when deciding if installed libltdl
+   is 'new enough'.
+   * libltdl/libltdl/lt__private.h (lt__advise): Add a new
+   is_preload flag.
+   * libltdl/ltdl.c (lt_dladvise_preload): New api call to set it.
+   (try_dlopen): If it is set, and the search of preloaded modules
+   didn't return a match, don't bother searching the filesystem.
+   * libltdl/ltdl.h (lt_dladvise_preload): Declare it.
+   * doc/libtool.texi (Libltdl Interface): Document it.
+   * tests/lt_dladvise.at: Test it (and incidentally add some test
+   coverage for `libtool -dlpreopen').
+   * NEWS: Announce it.
+
2008-05-05  Gary V. Vaughan  <[EMAIL PROTECTED]>

Fix libtoolize test failure with aclocal < 1.10.1
diff --git a/NEWS b/NEWS
index 2b113fb..3354e6c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,10 @@ NEWS - list of user-visible changes between  
releases of GNU Libtool


New in 2.2.??: 2008-06-??: git version 2.2.5a, Libtool team:

-* Bug fixes:
+* New features:

-  - None yet
+  - New lt_dloadvise_preload() call to set a hint that only  
preloadeded

+modules can be opened.

New in 2.2.4: 2008-05-04: git version 2.2.3a, Libtool team:

diff --git a/doc/libtool.texi b/doc/libtool.texi
index 31ba0c7..21a3695 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -3816,6 +3816,13 @@ On failure, @code{lt_dladvise_resident}  
returns non-zero and sets an error

message that can be retrieved with @code{lt_dlerror}.
@end deftypefun

[EMAIL PROTECTED] int lt_dladvise_preload (lt_dladvise [EMAIL PROTECTED])
+Set the @code{preload} hint on @var{advise}.  Passing an @var{advise}
+parameter to @code{lt_dlopenadvise} with this hint set causes it to
+load only preloaded modules, so that if a suitable preloaded module  
is

+not found, @code{lt_dlopenadvise} will return @code{NULL}.
[EMAIL PROTECTED] deftypefun
+
@deftypefun int lt_dlclose (lt_dlhandle @var{handle})
Decrement the reference count on the module @var{handle}.
If it drops to zero and no other module depends on this module,
diff --git a/libltdl/libltdl/lt__private.h b/libltdl/libltdl/ 
lt__private.h

index 4ce936d..f4c4a3d 100644
--- a/libltdl/libltdl/lt__private.h
+++ b/libltdl/libltdl/lt__private.h
@@ -126,6 +126,7 @@ struct lt__advise {
   subsequently loaded modules.  */
  unsigned int  is_symlocal:1;  /* module symbols are only available
   locally. */
+  unsigned int	try_preload_only:1;/* only preloaded modules will be  
tried. */

};

/* --- ERROR HANDLING --- */
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index a89c6bb..5a26565 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -1129,6 +1129,7 @@ try_dlopen (lt_dlhandle *phandle, const char  
*filename, const char *ext,

lt_dladvise advise)
{
  const char *  saved_error = 0;
+  char *   archive_name= 0;
  char *canonical   = 0;
  char *base_name   = 0;
  char *dir = 0;
@@ -1257,16 +1258,21 @@ try_dlopen (lt_dlhandle *phandle, const char  
*filename, const char *ext,


  if (vtable)
{
+ archive_name = MALLOC (char, LT_STRLEN (name) + 3);
  *phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));

- if (*phandle == NULL)
+ if ((*phandle == NULL) || (archive_name == NULL))
{
  ++errors;
  got