From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 45738 invoked by alias); 1 Feb 2020 17:43:19 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 45728 invoked by uid 89); 1 Feb 2020 17:43:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=teach, abusing, paying, SHF_LINK_ORDER X-HELO: mail-ot1-f67.google.com Received: from mail-ot1-f67.google.com (HELO mail-ot1-f67.google.com) (209.85.210.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 01 Feb 2020 17:43:18 +0000 Received: by mail-ot1-f67.google.com with SMTP id b18so9768028otp.0 for ; Sat, 01 Feb 2020 09:43:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nmPgqqI5KhVuZRgWV3HqMdY4SXBJPL9qPPxIqNoLfAg=; b=id/lthBICqB3h5KFRQVP4SBeDlnpVbWmhM7xi/XUaQhCJrNnX97/AwZMbbfZFV3sst bIQ4uTLfVSc1/GlZn8CsfFtb3HmcMEAITA1DIskiosMmtWc9N11mJAeU6hYrVaT3ReNP 6Ggk2qyVWsuPAmbmKNX2kBhgyZ0jmKeeLgLH1FuCn+amaGglgRNq7OOedrDvCYI1WQks yZFG7dPwKJv71Pn7Ez9596BnhaKmGufUxbncVcVXSam9fTnQR8Unyj5ECCqFrBSehMus K7vRxClvxFPhwUKvVM1GFLpS6gj7UIlmWH/rByWAjHFc5iE4WfnDgXl785MNqABeCgbl kkpw== MIME-Version: 1.0 References: <20200201162613.2023476-1-hjl.tools@gmail.com> <20200201173429.ep5siwkbhz5osehk@google.com> In-Reply-To: <20200201173429.ep5siwkbhz5osehk@google.com> From: "H.J. Lu" Date: Sat, 01 Feb 2020 17:43:00 -0000 Message-ID: Subject: Re: [PATCH] x86: Keep __patchable_function_entries sections with --gc-sections To: Fangrui Song Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00012.txt.bz2 On Sat, Feb 1, 2020 at 9:34 AM Fangrui Song wrote: > > On 2020-02-01, H.J. Lu wrote: > >After all text sections have been garbage collected, if a > >__patchable_function_entries section references a section which > >wasn't marked, mark it with SEC_EXCLUDE and return NULL. Otherwise, > >keep it. > > > >Should it be handled in _bfd_elf_gc_mark_extra_sections? > > Thanks for paying attention to these feature requests. > > I referenced GNU as and ld requests at > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93492#c2 > If we > > * implement SHF_LINK_ORDER I am not sure if overloading (abusing?) SHF_LINK_ORDER is a good idea. > * allow multiple sections with the same name ("unique") This is orthogonal to this. I have a question on assembly syntax: https://sourceware.org/bugzilla/show_bug.cgi?id=25380#c1 > * teach GCC to use SHF_LINK_ORDER and "unique" (see https://gcc.gnu.org/ml/gcc/2020-01/msg00067.html) > > An ad-hoc gc marking will be unnecessary. We need to scan relocations in _patchable_function_entries section for references to garbage collected sections. We can either check section name or a SHF_XXX. But I don't know if SHF_LINK_ORDER is a good approach. > SHF_LINK_ORDER has been used in a few sanitizers. Now we know > __patchable_function_entries can benefit from it. In the future, they > may be instances. We really need a general solution. -- H.J.