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] |
Hi! On Wed, 30 May 2012 10:59:46 +0000 (UTC), "Joseph S. Myers" <joseph@codesourcery.com> wrote: > 2012-05-30 Joseph Myers <joseph@codesourcery.com> > > * Makeconfig [!+link] (+link-before-libc): New variable. > [!+link] (+link-after-libc): Likewise. > [!+link] (+link-tests): Likewise. > [!+link] (+link): Define in terms of $(+link-before-libc) and > $(+link-after-libc). > [!+link-static] (+link-static-before-libc): New variable. > [!+link-static] (+link-static-after-libc): Likewise. > [!+link-static] (+link-static-tests): Likewise. > [!+link-static] (+link-static): Define in terms of > $(+link-static-before-libc) and $(+link-static-after-libc). > [build-shared] (link-libc-before-gnulib): New variable. > [build-shared] (link-libc-tests): Likewise. > [build-shared] (link-libc): Define in terms of > $(link-libc-before-gnulib). > [!build-shared] (link-libc-tests): New variable. > (link-libc-static-tests): New variable. > [!gnulib] (gnulib-arch): New variable. > [!gnulib] (gnulib-tests): Likewise. > [!gnulib] (static-gnulib-arch): Likewise. > [!gnulib] (static-gnulib-tests): Likewise. > [!gnulib] (gnulib): Use $(gnulib-arch). Do not use $(libgcc_eh). > Define with "=" instead of ":=". > [!gnulib] (static-gnulib): Use $(static-gnulib-arch). Do not use > -lgcc_eh $(libunwind). Define with "=" instead of ":=". > * Rules (binaries-all-notests): New variable. > (binaries-all-tests): Likewise. > (binaries-static-notests): Likewise. > (binaries-static-tests): Likewise. > (binaries-all): Define using $(binaries-all-notests) and > $(binaries-all-tests). > (binaries-static): Define using $(binaries-static-notests) and > $(binaries-static-tests). > (binaries-shared-tests): New variable. > (binaries-shared-notests): Likewise. > (binaries-shared): Remove variable. > ($(addprefix $(objpfx),$(binaries-shared-notests))): New rule. > ($(addprefix $(objpfx),$(binaries-shared-tests))): Likewise. > ($(addprefix $(objpfx),$(binaries-shared))): Remove rule. > ($(addprefix $(objpfx),$(binaries-static-notests))): New rule. > ($(addprefix $(objpfx),$(binaries-static-tests))): Likewise. > ($(addprefix $(objpfx),$(binaries-static))): Remove rule. > * elf/Makefile (sln-modules): New variable. > (extra-objs): Add $(sln-modules:=.o). > (ldconfig-modules): Add static-stubs. > ($(objpfx)sln): Depend on $(sln-modules:%=$(objpfx)%.o). > * elf/static-stubs.c: New file. This became commit 95f5a9a866695da4e038aa4e6ccbbfd5d9cf63b7 (2012-07-03). > --- a/Makeconfig > +++ b/Makeconfig > @@ -415,9 +415,9 @@ LDFLAGS.so += $(hashstyle-LDFLAGS) > LDFLAGS-rtld += $(hashstyle-LDFLAGS) > endif > > -# Command for linking programs with the C library. > +# Commands for linking programs with the C library. > ifndef +link > -+link = $(CC) -nostdlib -nostartfiles -o $@ \ > ++link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ > $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ > $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ > $(addprefix $(csu-objpfx),$(start-installed-name)) \ > @@ -426,7 +426,10 @@ ifndef +link > $(start-installed-name))\ > $(+preinit) $(link-extra-libs) \ > $(common-objpfx)libc% $(+postinit),$^) \ > - $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) > + $(link-extra-libs) > ++link-after-libc = $(+postctor) $(+postinit) > ++link = $(+link-before-libc) $(link-libc) $(+link-after-libc) > ++link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc) > endif > # Command for linking PIE programs with the C library. > ifndef +link-pie > @@ -443,7 +446,7 @@ ifndef +link-pie > endif > # Command for statically linking programs with the C library. > ifndef +link-static > -+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \ > ++link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ > $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ > $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ > $(+preinit) $(+prector) \ > @@ -451,7 +454,12 @@ ifndef +link-static > $(start-installed-name))\ > $(+preinit) $(link-extra-libs-static) \ > $(common-objpfx)libc% $(+postinit),$^) \ > - $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) > + $(link-extra-libs-static) $(link-libc-static) > ++link-static-after-libc = $(+postctor) $(+postinit) > ++link-static = $(+link-static-before-libc) $(link-libc-static) \ > + $(+link-static-after-libc) > ++link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \ > + $(+link-static-after-libc) > endif > # Command for statically linking bounded-pointer programs with the C library. > ifndef +link-bounded > @@ -475,10 +483,12 @@ ifeq (yes,$(build-shared)) > # We need the versioned name of libc.so in the deps of $(others) et al > # so that the symlink to libc.so is created before anything tries to > # run the linked programs. > -link-libc = -Wl,-rpath-link=$(rpath-link) \ > +link-libc-before-gnulib = -Wl,-rpath-link=$(rpath-link) \ > $(common-objpfx)libc.so$(libc.so-version) \ > $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ > - $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib) > + $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) > +link-libc = $(link-libc-before-gnulib) $(gnulib) > +link-libc-tests = $(link-libc-before-gnulib) $(gnulib-tests) > # This is how to find at build-time things that will be installed there. > rpath-dirs = math elf dlfcn nss nis rt resolv crypt > rpath-link = \ > @@ -488,6 +498,7 @@ else > nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) > resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) > link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) > +link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) > endif > endif > > @@ -513,8 +524,43 @@ endif > > # The static libraries. > link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group > +link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group > link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a As made apparent with Joseph's recent (and appropriate) commit d173d12e77c2ba9c46717353891f817333ce4995 ÂDon't include link-libc-static in +link-static-before-libc. (see <http://news.gmane.org/find-root.php?message_id=%3CPine.LNX.4.64.1210102027320.26853@digraph.polyomino.org.uk%3E>), we need to override link-libc-static-tests for GNU Hurd as done with link-libc-static in sysdeps/mach/hurd/Makefile. For example, for csu/tst-empty until recently we had: gcc-4.6 -nostdlib -nostartfiles -static [-o tst-empty crt0 crti crtbegin tst-empty.o] -Wl,-\( [...]/libc.a [...]/mach/libmachuser.a [...]/hurd/libhurduser.a -lgcc -Wl,-\) -Wl,--start-group [...]/libc.a -lgcc -lgcc_eh -Wl,--end-group [crtend crtn] After d173d12e77c2ba9c46717353891f817333ce4995, we got: gcc-4.6 -nostdlib -nostartfiles -static [-o tst-empty crt0 crti crtbegin tst-empty.o] -Wl,--start-group [...]/libc.a -lgcc -lgcc_eh -Wl,--end-group [crtend crtn] [...]/libc.a(check_fds.o): In function `_hurd_critical_section_unlock': [...]/csu/../hurd/hurd/signal.h:242: undefined reference to `__msg_sig_post' [...]/libc.a(dl-load.o): In function `_hurd_tls_init': [...]/elf/../sysdeps/mach/hurd/i386/tls.h:73: undefined reference to `__i386_set_gdt' [...] With the following patch, we againt get: gcc-4.6 -nostdlib -nostartfiles -static [-o tst-empty crt0 crti crtbegin tst-empty.o] -Wl,--start-group [...]/libc.a [...]/mach/libmachuser.a [...]/hurd/libhurduser.a -lgcc -lgcc_eh -Wl,--end-group [crtend crtn] ..., which does link and seems reasonable to me (final tests still running), but I'd like Joseph/Roland to confirm this is the correct approach. diff --git sysdeps/mach/hurd/Makefile sysdeps/mach/hurd/Makefile index 107eaaf..ed77903 100644 --- sysdeps/mach/hurd/Makefile +++ sysdeps/mach/hurd/Makefile @@ -167,11 +167,15 @@ $(objpfx)librtld.map: $(rpcuserlibs:.so=_pic.a) CFLAGS-dl-load.c = -DEXTERNAL_MAP_FROM_FD endif -# We need these libs to link static programs in the libc source tree, too. -link-libc-static := -Wl,-\( \ +# Override the generic Makeconfig values so we link against the RPC libs. +link-libc-static := -Wl,--start-group \ $(patsubst %,$(common-objpfx)%.a,\ libc mach/libmachuser hurd/libhurduser) \ - $(static-gnulib) -Wl,-\) + $(static-gnulib) -Wl,--end-group +link-libc-static-tests := -Wl,--start-group \ + $(patsubst %,$(common-objpfx)%.a,\ + libc mach/libmachuser hurd/libhurduser) \ + $(static-gnulib-tests) -Wl,--end-group ifeq ($(subdir),csu) The new comment, by the way, is verbatim from Roland's 1998-08-18 ;-) ChangeLog snippet when sysdeps/mach/hurd/Makefile:link-libc-static was added, and I consider it to better describe what these overrides are needed for. GrÃÃe, Thomas
Attachment:
pgp00000.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |