public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Fangrui Song <maskray@google.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH] x86_64: Remove unneeded static PIE check for undefined weak diagnostic
Date: Thu, 8 Jul 2021 13:09:34 -0700	[thread overview]
Message-ID: <CAMe9rOq-PyTmudBofiuzgz+qTL1vo98H__1zMfsAgwL_K-Lt9A@mail.gmail.com> (raw)
In-Reply-To: <20210708195050.3915783-1-maskray@google.com>

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>

Thanks.

--
H.J.

  reply	other threads:[~2021-07-08 20:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 19:50 Fangrui Song
2021-07-08 20:09 ` H.J. Lu [this message]
2021-07-09  1:27   ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMe9rOq-PyTmudBofiuzgz+qTL1vo98H__1zMfsAgwL_K-Lt9A@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=maskray@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).