This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove --as-needed configure test


As discussed lately, we'd like to avoid the glibc build depending on
libgcc_s (or more generally on any bit of libgcc that requires
anything from glibc to be installed in order to build) in order to
make bootstraps easier.

One dependency is that the configure test for ld --as-needed uses
-lgcc_s, and there isn't really anything else it could use; testing
--as-needed requires a shared library to link with using that option.
But --as-needed was added to ld in 2004, long before any version now
supported for building glibc, so this configure test is unnecessary
(and we don't need to use a more complicated process involving
building a shared library just to link with it with --as-needed).

I propose this patch to remove this configure test and unconditionally
assume that --as-needed support is present.  Tested x86_64.

2012-04-25  Joseph Myers  <joseph@codesourcery.com>

	* configure.in (libc_cv_as_needed): Remove test.
	* configure: Regenerated.
	* Makeconfig [$(have-as-needed) != yes] (as-needed): Remove
	conditional definition.
	[$(have-as-needed) != yes] (no-as-needed): Likewise.
	[$(have-as-needed) != yes] (libgcc_eh): Likewise.
	* config.make.in (have-as-needed): Remove variable.

diff --git a/Makeconfig b/Makeconfig
index 4364296..148db6e 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -388,13 +388,8 @@ ifndef asm-CPPFLAGS
 asm-CPPFLAGS =
 endif
 
-ifeq ($(have-as-needed),yes)
 as-needed := -Wl,--as-needed
 no-as-needed := -Wl,--no-as-needed
-else
-as-needed :=
-no-as-needed :=
-endif
 
 # Must be supported by the linker.
 no-whole-archive = -Wl,--no-whole-archive
@@ -534,11 +529,7 @@ ifneq ($(have-cc-with-libunwind),yes)
 else
   libunwind = -lunwind
 endif
-ifneq ($(have-as-needed),yes)
- libgcc_eh := -lgcc_eh $(libunwind)
-else
- libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
-endif
+libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed
 gnulib := -lgcc $(libgcc_eh)
 static-gnulib := -lgcc -lgcc_eh $(libunwind)
 libc.so-gnulib := -lgcc
diff --git a/config.make.in b/config.make.in
index 0cea3a4..9aff468 100644
--- a/config.make.in
+++ b/config.make.in
@@ -49,7 +49,6 @@ all-warnings = @all_warnings@
 have-z-combreloc = @libc_cv_z_combreloc@
 have-z-execstack = @libc_cv_z_execstack@
 have-Bgroup = @libc_cv_Bgroup@
-have-as-needed = @libc_cv_as_needed@
 with-fp = @with_fp@
 old-glibc-headers = @old_glibc_headers@
 unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
diff --git a/configure.in b/configure.in
index 442f8eb..42d521f 100644
--- a/configure.in
+++ b/configure.in
@@ -1519,23 +1519,6 @@ fi
 rm -f conftest*])
 AC_SUBST(libc_cv_Bgroup)
 
-AC_CACHE_CHECK(for --as-needed option,
-	       libc_cv_as_needed, [dnl
-cat > conftest.c <<EOF
-int main (void) { return 0; }
-EOF
-if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
-			      -fPIC -shared -o conftest.so conftest.c
-			      -lgcc_s -Wl,--as-needed
-			      -nostdlib 1>&AS_MESSAGE_LOG_FD])
-then
-  libc_cv_as_needed=yes
-else
-  libc_cv_as_needed=no
-fi
-rm -f conftest*])
-AC_SUBST(libc_cv_as_needed)
-
 ASFLAGS_config=
 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
 	       libc_cv_as_noexecstack, [dnl

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]