diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2012-09-24 17:31:36 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2012-09-24 17:31:36 -0700 |
commit | 94b32c39127967ea58adac3d737a1e5d6116fb77 (patch) | |
tree | 2265e2bd2c5ce6def39f5a7c80ba32e932ac955f /Makeconfig | |
parent | 15055a1cd7e2c249093a5f6d57eca817767d8b85 (diff) | |
download | glibc-94b32c39127967ea58adac3d737a1e5d6116fb77.zip glibc-94b32c39127967ea58adac3d737a1e5d6116fb77.tar.gz glibc-94b32c39127967ea58adac3d737a1e5d6116fb77.tar.bz2 |
Use static link by default for --disable-shared
Diffstat (limited to 'Makeconfig')
-rw-r--r-- | Makeconfig | 44 |
1 files changed, 28 insertions, 16 deletions
@@ -411,22 +411,6 @@ LDFLAGS.so += $(hashstyle-LDFLAGS) LDFLAGS-rtld += $(hashstyle-LDFLAGS) endif -# Commands for linking programs with the C library. -ifndef +link -+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)) \ - $(+preinit) $(+prector) \ - $(filter-out $(addprefix $(csu-objpfx),start.o \ - $(start-installed-name))\ - $(+preinit) $(link-extra-libs) \ - $(common-objpfx)libc% $(+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 +link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \ @@ -457,6 +441,27 @@ ifndef +link-static +link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \ $(+link-static-after-libc) endif +# Commands for linking programs with the C library. +ifndef +link +ifeq (yes,$(build-shared)) ++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)) \ + $(+preinit) $(+prector) \ + $(filter-out $(addprefix $(csu-objpfx),start.o \ + $(start-installed-name))\ + $(+preinit) $(link-extra-libs) \ + $(common-objpfx)libc% $(+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) +else ++link = $(+link-static) ++link-tests = $(+link-static-tests) +endif +endif # Command for statically linking bounded-pointer programs with the C library. ifndef +link-bounded +link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \ @@ -568,7 +573,14 @@ gnulib-arch = gnulib = -lgcc $(gnulib-arch) gnulib-tests := -lgcc $(libgcc_eh) static-gnulib-arch = +# By default, elf/static-stubs.o, instead of -lgcc_eh, is used to +# statically link programs. When --disable-shared is used, we use +# -lgcc_eh since elf/static-stubs.o isn't sufficient. +ifeq (yes,$(build-shared)) static-gnulib = -lgcc $(static-gnulib-arch) +else +static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch) +endif static-gnulib-tests := -lgcc -lgcc_eh $(libunwind) libc.so-gnulib := -lgcc endif |