* Re: [PATCH] x86_64: Remove unneeded static PIE check for undefined weak diagnostic
[not found] ` <CAMe9rOq-PyTmudBofiuzgz+qTL1vo98H__1zMfsAgwL_K-Lt9A@mail.gmail.com>
@ 2021-07-09 1:27 ` H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2021-07-09 1:27 UTC (permalink / raw)
To: Fangrui Song, Libc-stable Mailing List; +Cc: GNU C Library
On Thu, Jul 8, 2021 at 1:09 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Jul 8, 2021 at 12:51 PM Fangrui Song via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
> >
> > https://sourceware.org/bugzilla/show_bug.cgi?id=21782 dropped an ld
> > diagnostic for R_X86_64_PC32 referencing an undefined weak symbol in
> > -pie links. Arguably keeping the diagnostic like other ports is more
> > correct, since statically resolving movl foo(%rip), %eax to the
> > link-time zero address produces a corrupted output.
> >
> > It turns out that --enable-static-pie builds do not depend on the ld
> > behavior. GCC generates GOT indirection for weak declarations for
> > -fPIE/-fPIC, so what ld does with the PC-relative relocation doesn't
> > really matter. I confirmed the argument with a --enable-static-pie build
> > with trunk LLD, whose -pie mode reports an error for `.weak foo; movl
> > foo(%rip), %eax`
> > (https://sourceware.org/bugzilla/show_bug.cgi?id=21782#c6
>
> I agree that
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=21782
>
> was a false alarm for static PIE. This linker check isn't necessary.
>
> The patch is OK.
>
> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
>
Please backlport it to release branches. Otherwise binutils 2.37 can't
build them.
Thanks.
--
H.J.
^ permalink raw reply [flat|nested] only message in thread