bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH,HURD] Fix link with gold


From: Thomas Schwinge
Subject: Re: [PATCH,HURD] Fix link with gold
Date: Wed, 04 Apr 2012 22:46:34 +0200
User-agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu)

Hi!

On Wed, 30 Mar 2011 00:20:00 +0200, Samuel Thibault <samuel.thibault@gnu.org> 
wrote:
> Roland McGrath, le Tue 29 Mar 2011 15:11:59 -0700, a écrit :
> > That's the --no-add-needed default.  Some systems have gone to passing that
> > in the standard ld command from gcc, even using BFD ld (i.e. Fedora has).
> 
> Debian has too, that's why the patch :)

(As of binutils 2.21, it's called --no-copy-dt-needed-entries.)  As of
2.22, --no-copy-dt-needed-entries is the default even for ``standard''
ld.

> > I actually think that it's arguably a feature and that Hurd-specific
> > programs that are using direct RPCs should probably start using -lhurduser
> > and/or -lmachuser as appropriate.
> 
> Ah.

That'd be my preference, too.

> > I'm still open to being convinced otherwise.
> 
> Well, the thing is: we need to patch a fair number of applications
> then (Xorg, gdb, ...)

But that's already mostly it, isn't it?

> since the dependency used to be brought in
> automatically (even explicitly, in the case of libc.a), so it looked
> like it was a libc-provided feature.
> 
> > But expressing your actual dependencies is a good thing, and
> > IMHO it makes sense to have "average" programs just using POSIXy interfaces
> > depend only on -lc and Hurdish programs explicitly depend on what they use.

What is a clean way so that we could remove it from the static libc.a's
``GROUP ( libcrt.a libmachuser.a libhurduser.a )''?  libcrt.a does need
it itself after all.  So I guess in the -static case we'll (have to)
continue to link it in, unless we'd apply some medium-sized surgery?


A patch that I just used to build Hurd in the new setting (the *.static
case just for uniformity, as just discussed):

diff --git a/Makeconf b/Makeconf
index b6134ef..fd19303 100644
--- a/Makeconf
+++ b/Makeconf
@@ -310,6 +310,10 @@ _libsubst=${libsubst$(patsubst 
%,-override,${libsubst-override})}
 # dependencies of other shared objects it encounters.
 rpath := -Wl,-rpath-link=.:$(subst $. ,:,$(dir $(wildcard ../lib*/lib*.so)))
 
+# It is to be expected that the Hurd libraries and servers will be using RPCs.
+maybe-link-hurduser-and-machuser := \
+       -Wl,--as-needed -lhurduser -lmachuser -Wl,--no-as-needed
+
 # Main rule to link executables
 #
 # (prof-depend is a special kind of run not normally used; see the rules
@@ -323,14 +327,16 @@ $(CC) $(rpath) $(CFLAGS) $($*-CFLAGS) $(LDFLAGS) 
$($*-LDFLAGS) \
 endef
 $(progtarg): %$(target-suffix): $(BUGADDR)
        $(link-executable) \
-              $(filter %.o,$^) \
+             $(filter %.o,$^) $(maybe-link-hurduser-and-machuser) \
              '-Wl,-(' $(foreach lib,$(filter-out %.o,$^),${_libsubst}) \
                       $($*-LDLIBS) $(LDLIBS) \
              '-Wl,-)'
 
 $(addsuffix .static,$(progtarg)): %$(target-suffix).static: $(BUGADDR)
        $(link-executable) -static \
-             '-Wl,-(' $(patsubst %.so,%.a,$^) $($*-LDLIBS) $(LDLIBS) \
+             $(filter %.o,$^) $(maybe-link-hurduser-and-machuser) \
+             '-Wl,-(' $(patsubst %.so,%.a,$(filter-out %.o,$^)) \
+                      $($*-LDLIBS) $(LDLIBS) \
              '-Wl,-)' \
              $(and $(filter %/libstore_part.a,$^), $(PARTED_LIBS))
 endif
@@ -369,7 +375,7 @@ $(libname).so.$(hurd-version): $(patsubst 
%.o,%_pic.o,$(OBJS)) $(library_deps)
              $(rpath) $(CFLAGS) $(LDFLAGS) $($(libname).so-LDFLAGS) \
              '-Wl,-(' $(filter-out %.map,$^) \
                       $($(libname).so-LDLIBS) $(LDLIBS) \
-             '-Wl,-)' $(filter %.map,$^)
+             '-Wl,-)' $(maybe-link-hurduser-and-machuser) $(filter %.map,$^)
 
 $(libname).so: $(libname).so.$(hurd-version)
        ln -f -s $< $@


Grüße,
 Thomas

Attachment: pgpUDZUDVLDFL.pgp
Description: PGP signature


reply via email to

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