* [PATCH] i386: Pass -Wl,--no-as-needed to compiler as needed
@ 2023-01-25 17:07 H.J. Lu
2023-01-26 7:41 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2023-01-25 17:07 UTC (permalink / raw)
To: binutils
Pass -Wl,--no-as-needed to linker tests to fix
FAIL: Run pr19031
FAIL: Run got1
FAIL: Undefined weak symbol (-fPIE -no-pie)
FAIL: Undefined weak symbol (-fPIE -pie)
when --as-needed is passed to linker by compiler.
PR ld/30050
* testsuite/ld-i386/i386.exp: Pass -Wl,--no-as-needed to compiler
as needed.
---
ld/testsuite/ld-i386/i386.exp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index 89e8aee237c..5f53bcf29bc 100644
--- 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" \
--
2.39.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i386: Pass -Wl,--no-as-needed to compiler as needed
2023-01-25 17:07 [PATCH] i386: Pass -Wl,--no-as-needed to compiler as needed H.J. Lu
@ 2023-01-26 7:41 ` Jan Beulich
2023-01-26 15:41 ` H.J. Lu
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2023-01-26 7:41 UTC (permalink / raw)
To: H.J. Lu; +Cc: binutils
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
> FAIL: Undefined weak symbol (-fPIE -no-pie)
> FAIL: Undefined weak symbol (-fPIE -pie)
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i386: Pass -Wl,--no-as-needed to compiler as needed
2023-01-26 7:41 ` Jan Beulich
@ 2023-01-26 15:41 ` H.J. Lu
0 siblings, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2023-01-26 15:41 UTC (permalink / raw)
To: Jan Beulich; +Cc: binutils
On Wed, Jan 25, 2023 at 11:41 PM Jan Beulich <jbeulich@suse.com> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-26 15:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 17:07 [PATCH] i386: Pass -Wl,--no-as-needed to compiler as needed H.J. Lu
2023-01-26 7:41 ` Jan Beulich
2023-01-26 15:41 ` H.J. Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).