From patchwork Tue Dec 3 10:54:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 36460 Received: (qmail 49762 invoked by alias); 3 Dec 2019 10:54:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 49750 invoked by uid 89); 3 Dec 2019 10:54:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=forcing X-HELO: us-smtp-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575370468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j4Qva4AQpFyaqD4ylQgPrtb+cQrogs8ErYY1FGAw5WI=; b=QvOtxgn1GVm2PVMvMjQcNybr7Wr4gsxdVFkYmYN/6ckTq/VztM1YQ4fbqtOhOfFgqoUHid tH//0dItonl/dJbrFx8Zc+giP7+qch9HEynYWuygMOQ0RIR82Fo5DuxuOIkQTn86GO9i+e 7kfDJ9M2IQAJOs5SkVEJBI+ecV/T8/s= From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] Expand $(as-needed) and $(no-as-needed) throughout the build system Date: Tue, 03 Dec 2019 11:54:23 +0100 Message-ID: <87lfrtsmqo.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 Since commit a3cc4f48e94f32c9532ee36982ac00eb1e5719b0 ("Remove --as-needed configure test."), --as-needed support is no longer optional. The macros are not much shorter and do not provide documentary value, either, so this commit removes them. ----- Tested on x86_64-linux-gnu, i686-linux-gnu, powerpc64le-linux-gnu. Makeconfig | 7 ++--- Makerules | 2 +- elf/Makefile | 48 +++++++++++++++++------------------ nptl/Makefile | 4 +-- stdlib/Makefile | 2 +- sysdeps/powerpc/powerpc64/le/Makefile | 2 +- 6 files changed, 31 insertions(+), 34 deletions(-) Reviewed-by: Carlos O'Donell diff --git a/Makeconfig b/Makeconfig index 44b5f3a4d0..6d8e24fcc3 100644 --- a/Makeconfig +++ b/Makeconfig @@ -336,9 +336,6 @@ ifndef asm-CPPFLAGS asm-CPPFLAGS = endif -as-needed := -Wl,--as-needed -no-as-needed := -Wl,--no-as-needed - # Must be supported by the linker. no-whole-archive = -Wl,--no-whole-archive whole-archive = -Wl,--whole-archive @@ -569,8 +566,8 @@ endif # build-hardcoded-path-in-tests link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \ $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ - $(as-needed) $(elf-objpfx)ld.so \ - $(no-as-needed) + -Wl,--as-needed $(elf-objpfx)ld.so \ + -Wl,--no-as-needed link-libc = $(link-libc-before-gnulib) $(gnulib) link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) $(gnulib-tests) diff --git a/Makerules b/Makerules index f5134586fa..23fb5dbf0f 100644 --- a/Makerules +++ b/Makerules @@ -513,7 +513,7 @@ endif link-libc-args = -Wl,--start-group \ $(libc-for-link) \ $(common-objpfx)libc_nonshared.a \ - $(as-needed) $(elf-objpfx)ld.so $(no-as-needed) \ + -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed \ -Wl,--end-group # The corresponding shared libc to use. This may be modified for a diff --git a/elf/Makefile b/elf/Makefile index 0debea7759..b2b3be203f 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -690,20 +690,20 @@ $(objpfx)tst-tlsalign-extern: $(objpfx)tst-tlsalign-vars.o $(objpfx)tst-tlsalign-extern-static: $(objpfx)tst-tlsalign-vars.o tst-null-argv-ENV = LD_DEBUG=all LD_DEBUG_OUTPUT=$(objpfx)tst-null-argv.debug.out -LDFLAGS-nodel2mod3.so = $(no-as-needed) -LDFLAGS-reldepmod5.so = $(no-as-needed) -LDFLAGS-reldep6mod1.so = $(no-as-needed) -LDFLAGS-reldep6mod4.so = $(no-as-needed) -LDFLAGS-reldep8mod3.so = $(no-as-needed) -LDFLAGS-unload4mod1.so = $(no-as-needed) -LDFLAGS-unload4mod2.so = $(no-as-needed) -LDFLAGS-tst-initorder = $(no-as-needed) -LDFLAGS-tst-initordera2.so = $(no-as-needed) -LDFLAGS-tst-initordera3.so = $(no-as-needed) -LDFLAGS-tst-initordera4.so = $(no-as-needed) -LDFLAGS-tst-initorderb2.so = $(no-as-needed) -LDFLAGS-tst-tlsmod5.so = -nostdlib $(no-as-needed) -LDFLAGS-tst-tlsmod6.so = -nostdlib $(no-as-needed) +LDFLAGS-nodel2mod3.so = -Wl,--no-as-needed +LDFLAGS-reldepmod5.so = -Wl,--no-as-needed +LDFLAGS-reldep6mod1.so = -Wl,--no-as-needed +LDFLAGS-reldep6mod4.so = -Wl,--no-as-needed +LDFLAGS-reldep8mod3.so = -Wl,--no-as-needed +LDFLAGS-unload4mod1.so = -Wl,--no-as-needed +LDFLAGS-unload4mod2.so = -Wl,--no-as-needed +LDFLAGS-tst-initorder = -Wl,--no-as-needed +LDFLAGS-tst-initordera2.so = -Wl,--no-as-needed +LDFLAGS-tst-initordera3.so = -Wl,--no-as-needed +LDFLAGS-tst-initordera4.so = -Wl,--no-as-needed +LDFLAGS-tst-initorderb2.so = -Wl,--no-as-needed +LDFLAGS-tst-tlsmod5.so = -nostdlib -Wl,--no-as-needed +LDFLAGS-tst-tlsmod6.so = -nostdlib -Wl,--no-as-needed testobj1.so-no-z-defs = yes testobj3.so-no-z-defs = yes @@ -838,7 +838,7 @@ $(objpfx)vismain.out: $(addprefix $(objpfx),vismod3.so) vismain-ENV = LD_PRELOAD=$(addprefix $(objpfx),vismod3.so) $(objpfx)noload: $(objpfx)testobj1.so $(libdl) -LDFLAGS-noload = -rdynamic $(no-as-needed) +LDFLAGS-noload = -rdynamic -Wl,--no-as-needed $(objpfx)noload.out: $(objpfx)testobj5.so $(objpfx)noload-mem.out: $(objpfx)noload.out @@ -887,7 +887,7 @@ $(objpfx)reldep4: $(libdl) $(objpfx)reldep4.out: $(objpfx)reldep4mod1.so $(objpfx)reldep4mod2.so $(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl) -LDFLAGS-next = $(no-as-needed) +LDFLAGS-next = -Wl,--no-as-needed $(objpfx)unload2: $(libdl) $(objpfx)unload2.out: $(objpfx)unload2mod.so $(objpfx)unload2dep.so @@ -1055,8 +1055,8 @@ CFLAGS-tst-execstack-prog.c += -Wno-trampolines CFLAGS-tst-execstack-mod.c += -Wno-trampolines endif -LDFLAGS-tst-array2 = $(no-as-needed) -LDFLAGS-tst-array5 = $(no-as-needed) +LDFLAGS-tst-array2 = -Wl,--no-as-needed +LDFLAGS-tst-array5 = -Wl,--no-as-needed $(objpfx)tst-array1-cmp.out: tst-array1.exp $(objpfx)tst-array1.out cmp $^ > $@; \ @@ -1254,8 +1254,8 @@ $(objpfx)order2mod1.so: $(objpfx)order2mod4.so $(objpfx)order2mod4.so: $(objpfx)order2mod3.so $(objpfx)order2mod2.so: $(objpfx)order2mod3.so order2mod2.so-no-z-defs = yes -LDFLAGS-order2mod1.so = $(no-as-needed) -LDFLAGS-order2mod2.so = $(no-as-needed) +LDFLAGS-order2mod1.so = -Wl,--no-as-needed +LDFLAGS-order2mod2.so = -Wl,--no-as-needed tst-stackguard1-ARGS = --command "$(host-test-program-cmd) --child" tst-stackguard1-static-ARGS = --command "$(objpfx)tst-stackguard1-static --child" @@ -1403,10 +1403,10 @@ $(objpfx)tst-initorder2: $(objpfx)tst-initorder2a.so $(objpfx)tst-initorder2d.so $(objpfx)tst-initorder2a.so: $(objpfx)tst-initorder2b.so $(objpfx)tst-initorder2b.so: $(objpfx)tst-initorder2c.so $(objpfx)tst-initorder2c.so: $(objpfx)tst-initorder2d.so -LDFLAGS-tst-initorder2 = $(no-as-needed) -LDFLAGS-tst-initorder2a.so = $(no-as-needed) -LDFLAGS-tst-initorder2b.so = $(no-as-needed) -LDFLAGS-tst-initorder2c.so = $(no-as-needed) +LDFLAGS-tst-initorder2 = -Wl,--no-as-needed +LDFLAGS-tst-initorder2a.so = -Wl,--no-as-needed +LDFLAGS-tst-initorder2b.so = -Wl,--no-as-needed +LDFLAGS-tst-initorder2c.so = -Wl,--no-as-needed define o-iterator-doit $(objpfx)tst-initorder2$o.os: tst-initorder2.c; \ $$(compile-command.c) -DNAME=\"$o\" diff --git a/nptl/Makefile b/nptl/Makefile index bcf97ec0bd..fffd9462ff 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -591,7 +591,7 @@ $(objpfx)tst-tls4: $(libdl) $(shared-thread-library) $(objpfx)tst-tls4.out: $(objpfx)tst-tls4moda.so $(objpfx)tst-tls4modb.so $(objpfx)tst-tls5: $(objpfx)tst-tls5mod.so $(shared-thread-library) -LDFLAGS-tst-tls5 = $(no-as-needed) +LDFLAGS-tst-tls5 = -Wl,--no-as-needed LDFLAGS-tst-tls5mod.so = -Wl,-soname,tst-tls5mod.so ifeq ($(build-shared),yes) @@ -631,7 +631,7 @@ LDFLAGS-tst-_res1mod2.so = -Wl,-soname,tst-_res1mod2.so $(objpfx)tst-_res1: $(objpfx)tst-_res1mod1.so $(objpfx)tst-_res1mod2.so \ $(shared-thread-library) -LDLIBS-tst-cancel24 = $(no-as-needed) -lstdc++ +LDLIBS-tst-cancel24 = -Wl,--no-as-needed -lstdc++ LDLIBS-tst-cancel24-static = $(LDLIBS-tst-cancel24) extra-B-pthread.so = -B$(common-objpfx)nptl/ diff --git a/stdlib/Makefile b/stdlib/Makefile index 8ca82f83da..c8520285f4 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -211,7 +211,7 @@ $(objpfx)tst-fmtmsg.out: tst-fmtmsg.sh $(objpfx)tst-fmtmsg $(evaluate-test) $(objpfx)tst-putenv: $(objpfx)tst-putenvmod.so -LDFLAGS-tst-putenv = $(no-as-needed) +LDFLAGS-tst-putenv = -Wl,--no-as-needed $(objpfx)tst-putenvmod.so: $(objpfx)tst-putenvmod.os $(link-libc-deps) $(build-module) diff --git a/sysdeps/powerpc/powerpc64/le/Makefile b/sysdeps/powerpc/powerpc64/le/Makefile index f59db1ca3c..0ce3868c3c 100644 --- a/sysdeps/powerpc/powerpc64/le/Makefile +++ b/sysdeps/powerpc/powerpc64/le/Makefile @@ -4,7 +4,7 @@ # libgcc requires __tcb_parse_hwcap_and_convert_at_platform when built with # a binary128 type. That symbol is provided by the loader on dynamically # linked executables, forcing to link the loader after libgcc link. -f128-loader-link = $(as-needed) $(elf-objpfx)ld.so $(no-as-needed) +f128-loader-link = -Wl,--as-needed $(elf-objpfx)ld.so -Wl,--no-as-needed ifeq ($(subdir),math) # sqrtf128 requires emulation before POWER9.