From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id 445D83858D3C; Fri, 9 Jul 2021 01:28:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 445D83858D3C Received: by mail-pj1-x1031.google.com with SMTP id oj11-20020a17090b4d8bb029017338c124dcso2465029pjb.0; Thu, 08 Jul 2021 18:28:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iU2fpmyweyAopfBIsFiXRno4ZVFQTkLx6l0LM/A2KI0=; b=UAXz6S0t3SP4LtdDNAunmoHonXmfneSwT6GSeARZQ8MlrdLUX7Gfm6NxXoT3JdHUDH FMt9lf4EgwTT+MeOgUyGqyIH4x8c4F000SJN8uvoykNQYGRE3d6YjNubrKi6IyhZPxhR zvpe8RuXOt502ceUb9EwK2OvBY5cttCKP/QUZfxKCTMALxdEX6mIp1BBH/dQ8LkO57Da HF353piUWvcGZ3EPKHWtUa36dwoetlYe1nJiP5of8kS4EeJ+Y2iRw2UxvxLN61V6A4bx Z6vEW86QkdwsE5AUbskNSWmRPx3DWZ6LdwNrjvQf/4l129Jv6I1iVbVAvh/8JNIwaQuS dF+w== X-Gm-Message-State: AOAM531WDOASBUSKW4hqbOXzurL0S6L9rDSy3f3+TSpQSVGUItWjT7Uj CW35Id+cfkxV2KF1x+aojJ7UdV2x6neaNFYtL3E= X-Google-Smtp-Source: ABdhPJyzC3c8g7TL+AClgMJQrW2hoEJWwJzmO6+6wIUp3DjMaijFzhqa4RxfV7UjlwE+08Sa9iIOWuysWoLyACUy7RU= X-Received: by 2002:a17:90b:3607:: with SMTP id ml7mr7836964pjb.153.1625794097431; Thu, 08 Jul 2021 18:28:17 -0700 (PDT) MIME-Version: 1.0 References: <20210708195050.3915783-1-maskray@google.com> In-Reply-To: From: "H.J. Lu" Date: Thu, 8 Jul 2021 18:27:41 -0700 Message-ID: Subject: Re: [PATCH] x86_64: Remove unneeded static PIE check for undefined weak diagnostic To: Fangrui Song , Libc-stable Mailing List Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3025.6 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 01:28:20 -0000 On Thu, Jul 8, 2021 at 1:09 PM H.J. Lu wrote: > > On Thu, Jul 8, 2021 at 12:51 PM Fangrui Song via Libc-alpha > 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 > Please backlport it to release branches. Otherwise binutils 2.37 can't build them. Thanks. -- H.J.