From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38126 invoked by alias); 1 Feb 2020 17:34:34 -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 38113 invoked by uid 89); 1 Feb 2020 17:34:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_INFOUSMEBIZ,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=teach, H*F:D*me, paying, H*M:google X-HELO: mail-pg1-f193.google.com Received: from mail-pg1-f193.google.com (HELO mail-pg1-f193.google.com) (209.85.215.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 01 Feb 2020 17:34:33 +0000 Received: by mail-pg1-f193.google.com with SMTP id u131so5349563pgc.10 for ; Sat, 01 Feb 2020 09:34:33 -0800 (PST) Return-Path: Received: from localhost (c-71-204-169-238.hsd1.ca.comcast.net. [71.204.169.238]) by smtp.gmail.com with ESMTPSA id q4sm15056923pfl.175.2020.02.01.09.34.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Feb 2020 09:34:31 -0800 (PST) Date: Sat, 01 Feb 2020 17:34:00 -0000 From: Fangrui Song To: "H.J. Lu" Cc: binutils@sourceware.org Subject: Re: [PATCH] x86: Keep __patchable_function_entries sections with --gc-sections Message-ID: <20200201173429.ep5siwkbhz5osehk@google.com> References: <20200201162613.2023476-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200201162613.2023476-1-hjl.tools@gmail.com> X-SW-Source: 2020-02/txt/msg00011.txt.bz2 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 * allow multiple sections with the same name ("unique") * 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. 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.