bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: build failure on sparc64-sun-solaris2.9


From: Paul Eggert
Subject: Re: build failure on sparc64-sun-solaris2.9
Date: Fri, 06 Jan 2006 18:06:01 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Aleksandar Milivojevic <address@hidden> writes:

> seems like linking of utilities isn't quite optimal.  Running
> ldd on any of them gives a long list of libs.

I looked into this some more, and discovered the -zignore option of
the Solaris linker, which will remove references to unused libraries.
I think we should use this: it will simplify some cruft in m4/*.m4 and
in src/Makefile.am.  (I'm thinking of things like cp_LDADD and mv_LDADD.)

I installed this patch so that we can use -zignore; we can remove the
cruft later.  Once this patch is installed, I don't know any reason
why we can't simply remove all the various LDADD variables, and put
everything into plain LDADD, but perhaps other linker experts can
correct me.

If you want to use this idea on coreutils 5.93 you can do this:

./configure LDFLAGS='-Xlinker -zignore'

on your platform.


2006-01-06  Paul Eggert  <address@hidden>

        * configure.ac (gl_IGNORE_UNUSED_LIBRARIES): Add.
        * m4/lib-ignore.m4: New file.

--- configure.ac        22 Nov 2005 15:32:20 -0000      1.74
+++ configure.ac        7 Jan 2006 01:55:49 -0000       1.75
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script. -*-m4-*-
 
-dnl Copyright (C) 1991, 1993-2005 Free Software Foundation, Inc.
+dnl Copyright (C) 1991, 1993-2006 Free Software Foundation, Inc.
 
 dnl This program is free software; you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
@@ -36,6 +36,7 @@ AC_PROG_CPP
 AC_PROG_GCC_TRADITIONAL
 AC_PROG_RANLIB
 AC_PROG_LN_S
+gl_IGNORE_UNUSED_LIBRARIES
 
 
 AC_CHECK_FUNCS(uname,
--- /dev/null   2005-09-24 22:00:15.000000000 -0700
+++ m4/lib-ignore.m4    2006-01-06 17:51:48.000000000 -0800
@@ -0,0 +1,43 @@
+# If possible, ignore libraries that are not depended on.
+
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Written by Paul Eggert.
+
+AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES],
+[
+  AC_CACHE_CHECK([for flag to ignore unused libraries],
+    [gl_cv_ignore_unused_libraries],
+    [gl_cv_ignore_unused_libraries=none
+     AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+       [gl_ldd_output0=`(ldd conftest$ac_exeext) 2>/dev/null` ||
+         gl_ldd_output0=])
+     if test "$gl_ldd_output0"; then
+       gl_saved_ldflags=$LDFLAGS
+       gl_saved_libs=$LIBS
+       LIBS="$LIBS -lm"
+       AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+        [gl_ldd_output1=`(ldd conftest$ac_exeext) 2>/dev/null` ||
+           gl_ldd_output1=])
+       if test "$gl_ldd_output1" && test "$gl_ldd_output0" != "$gl_ldd_output1"
+       then
+        for gl_flags in '-Xlinker -zignore' '-zignore'; do
+          LDFLAGS="$gl_flags $LDFLAGS"
+          AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+            [if gl_ldd_output2=`(ldd conftest$ac_exeext) 2>/dev/null` &&
+                test "$gl_ldd_output0" = "$gl_ldd_output2"; then
+               gl_cv_ignore_unused_libraries=$gl_flags
+             fi])
+          LDFLAGS=$gl_saved_ldflags
+          test "gl_cv_ignore_unused_libraries" != none && break
+        done
+       fi
+       LIBS=$gl_saved_LIBS
+     fi])
+
+  test "$gl_cv_ignore_unused_libraries" != none &&
+    LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries"
+])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]