From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by sourceware.org (Postfix) with ESMTPS id 2BE733858D28 for ; Thu, 26 Jan 2023 15:42:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2BE733858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-x235.google.com with SMTP id s124so1725210oif.1 for ; Thu, 26 Jan 2023 07:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=453PtomZNzEgF6GMUTB96/kOyu6t85e69Fe+DsH48Cw=; b=IATwqHCmciLkSsy7rPCJKTPs+YJWTGM5zpjiYfkg8iQhw1HKxUmk6sZHnZ8dLQBdvz Hz49QAgDRW+xBH88CKS/m9VbGU72ifU1M8fLBWB/woBP+grk1AR/j09Ml0RIhzY+RfqM PDtOWnUjPiuTqfq4GMz4L6V2XvdPKsmOnMFXdORghzYR6DQTZ4uE1i7mmhJgCYGbSz0G pebVrQu4WCeuR8fKXqehTik4a5czvXLtu6obp/muhpjT4P8JL5+rEYUUaVsSCcu3dsjU 4qP1K5S3Mm3HS6mspO5iZUip4lTAHDRGu/CaE+59D1xP609kuNxHA/awd9Cb5cfxTnlv tAWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=453PtomZNzEgF6GMUTB96/kOyu6t85e69Fe+DsH48Cw=; b=8FZ8uVYY2i/ov4kHq9HBKUlXMmIrBsmPrDQK7VEd6TCaTaA0stYDu31cowFp64jom0 iXVmPboljv/JeSZeK1GyLeMDva+IQxwRxdECS19tVZUNl4VuTRC/y6LobFP9VqY1mHxS 3bDkV4/Aq4Vjxnsj0W4N9+tjfTP5JWVdQIiTZyTM974FWuaXlikOZC3ui1GvyEEkxES3 xLuXPc3GUTXcCwIYb/OSNGcwnTfh/28HuShCIzXWJpUCkJn5iILBKiLBVMh19qm0uE6g U4r1XBL+7Met4I1JqJXImuvYDbXnRFIwyTw0F3kb/Cpuj39CQV6hmlbBEzGW8DoTMBoa q2Rw== X-Gm-Message-State: AFqh2kr4PvnJGpmaefQeJnBX7vMyAE4oU0jwr4iC4wu3xAagqcvk67wo IWZT0HQkBmpgMZKVfg+aFke7ZNXCPmaTMql/Qfc= X-Google-Smtp-Source: AMrXdXs3RPIbr0itcqu2e9MagLfnK8hTanzMpfFI6tC5pS2CwTLZtbfRHEcN9YRY87qI+GawjdrT8gBYCfOmIsQbp4Q= X-Received: by 2002:aca:ac12:0:b0:364:a686:4444 with SMTP id v18-20020acaac12000000b00364a6864444mr2717814oie.298.1674747739420; Thu, 26 Jan 2023 07:42:19 -0800 (PST) MIME-Version: 1.0 References: <20230125170725.386430-1-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Thu, 26 Jan 2023 07:41:43 -0800 Message-ID: Subject: Re: [PATCH] i386: Pass -Wl,--no-as-needed to compiler as needed To: Jan Beulich Cc: binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3017.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jan 25, 2023 at 11:41 PM Jan Beulich wrote: > > On 25.01.2023 18:07, H.J. Lu via Binutils wrote: > > Pass -Wl,--no-as-needed to linker tests to fix > > > > FAIL: Run pr19031 > > FAIL: Run got1 These 2 failed to link when --as-needed is passed to linker by compiler. The shared library is ignored by linker since it is placed before the .o files. > > FAIL: Undefined weak symbol (-fPIE -no-pie) > > FAIL: Undefined weak symbol (-fPIE -pie) These 2 failed at run-time when --as-needed is passed to linker by compiler. The shared library is ignored by linker since it is placed before the .o files. > How come these four don't match (even in count) ... > > > --- a/ld/testsuite/ld-i386/i386.exp > > +++ b/ld/testsuite/ld-i386/i386.exp > > @@ -577,7 +577,8 @@ proc undefined_weak {cflags ldflags} { > > run_ld_link_exec_tests [list \ > > [list \ > > "Run pr19704" \ > > - "$ldflags tmpdir/libpr19704.so -Wl,-R,tmpdir" \ > > + "$ldflags -Wl,--no-as-needed tmpdir/libpr19704.so \ > > + -Wl,-R,tmpdir" \ > > "-Wa,-mrelax-relocations=yes" \ > > { pr19704a.c } \ > > "pr19704" \ > > @@ -1078,7 +1079,7 @@ if { [isnative] > > ] \ > > [list \ > > "Run pr19031" \ > > - "$NOPIE_LDFLAGS tmpdir/pr19031.so" \ > > + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr19031.so" \ > > "-Wa,-mx86-used-note=yes" \ > > { pr19031b.S pr19031c.c } \ > > "pr19031" \ > > @@ -1087,7 +1088,7 @@ if { [isnative] > > ] \ > > [list \ > > "Run got1" \ > > - "$NOPIE_LDFLAGS tmpdir/got1d.so" \ > > + "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/got1d.so" \ > > "-Wa,-mx86-used-note=yes" \ > > { got1a.S got1b.c got1c.c } \ > > "got1" \ > > ... the three tests (with the "Run ..." even visible in context)? Also > it would have helped if you said a word on what it is that breaks with > --as-needed. After all there might also be the option of adjusting > overly strict expectations. (It is always somewhat questionable to > "fight" compiler defaults by further command line overrides. That's not > to say it's always the extra override which is wrong; sometimes it's > also the compiler default which is to be put under question.) > > Jan -- H.J.