Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp758949ybt; Wed, 24 Jun 2020 10:28:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC77CeUxKjKfoUtJYmZ5lG0Rfu7M/HPM4Ypvgg6JvRtmc60bst3CFu8WeVFGokLWlYmEwy X-Received: by 2002:a17:906:af43:: with SMTP id ly3mr19186011ejb.381.1593019701338; Wed, 24 Jun 2020 10:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593019701; cv=none; d=google.com; s=arc-20160816; b=CMUxkIX4PPzyNeAwxj3SJXVqobK0a/U++v/hIKEMxe+or+uPITQJBbpVZI3IfZD8D0 ce6RgcBafqP3Y0+zklbOXQIOyz2EqG9dovWDwXnE0aB9kZWoCoo2szr6GXVR73MiiRRq ZL2rdpIduDHtot1/O4xnUjxfC4v1IIGveBkjmwJl3DUmGwtAqWUtVMVVunFsYZFipL6v 2XogchCvc++t/bMoUkBqOkFFZkq9FHAqUL2TPB1IY/CAK9Fx3S0ZxbUJk5yFaknZRXDF Z0k5XGYEYN4w3N5FyUd3+Rkk92lw7TvlRL+AoTOruOoR3odJ3a2IspkqmRm/6d/9/9nS gy7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=MnQWlAViaAXgR6ChKk9flTU7iy/dP/Hqi3HZ30RWfcA=; b=II7wgmAe1R+psMmErDfkmw+XrWbeob4L6WoqSDst3NBUrrD76mEGgwzZHwlB+46smr dLHG5J6B8pL6cRx5iau8UiGsIDaRquTs/ciCIZ27BVBNmO49DS4SuWXE2eppLtG8J7U0 CKA7jQ30QM/jN7hUZQiysB0ehkmglJiJHVkhqtF9nJbnMu9dDquurgH/Eg9ZuaKxCSBs y6ncqbJ30us9QBaLo5Fa24MhoItWy/avqDRv32xvJ59kM7kKfRIB0+hkEzSARC8mTnxb xwu7+WockTYVjAvyicLszNKTFD0xIGIn+xM5bG5bUhmJcXvr8F4M3Q7ge6TMhgffPqQE mlmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HHUTbvXU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du22si17685144ejc.330.2020.06.24.10.27.58; Wed, 24 Jun 2020 10:28:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HHUTbvXU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405526AbgFXR0Z (ORCPT + 99 others); Wed, 24 Jun 2020 13:26:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405521AbgFXR0Z (ORCPT ); Wed, 24 Jun 2020 13:26:25 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D60F4C061795 for ; Wed, 24 Jun 2020 10:26:24 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id n2so1293851pld.13 for ; Wed, 24 Jun 2020 10:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=MnQWlAViaAXgR6ChKk9flTU7iy/dP/Hqi3HZ30RWfcA=; b=HHUTbvXU8iaNylfrBu2tKAp6t8jvzwGxJv4iQWDRdjnhiP1bSVaMJy3y6z9hlDLo5j I3r9BcePoZxu3+e/4tWyl+hlZf6p8Dk3oi6OlIpMi2Bre5oCdOktwagNmvSvXj80p45/ qBNen7/kYI5dyPaI7TzcMXBYWgXUQStxnApBoGkLKlQUqKFCWrKmo07mBmRdo2Uq2UAY SnhyDTWHaTW4W99fdN1AYeItiGEhnJVPXK8z9+1eONtpAatxhfK1DAjRnTnibVGkHFqt SVfUg2fkin8g64ceJ6gtvnSPvBarq4d7rDD5V6XBCFnHYOlfMrs3xzt1x+d3BckHFWC3 AeRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MnQWlAViaAXgR6ChKk9flTU7iy/dP/Hqi3HZ30RWfcA=; b=cFxQDJzTdJveSZR606xaIzOQYVCOh7pYD8DPZqHe1rnvi/WRxfhxyDDpn/SQDk3LNH rBDDTJY/17oxD1mTzjUk3JaGYjndviw04AG+3CnTR2ffd0Xkds4cbymbyHb4bi69zLyV /GdMnkzXuamC0jwih8APTl8h67X66QwmWBiFV0CExQzZzFpbHg5YBEDCoe/Rmq5sCzgw fJoIG8R3rtpKJF+6uGyG18LFcAwyILcxZvD7qwLOeNqr3Uw8+vSLy7V0KG8WFXEPY5SL lV3r/pB5nrFgFZabixlCSJ8+CsJSVuDUUFGsKvxKgQWMcvaNXFPnUHJtBvTJuALoLJIf pOKQ== X-Gm-Message-State: AOAM532hVH4wmkx5L9W6+x8p5kjRWSVkd1Wbc56e5H3Ib+sfJFwP7cwp VhIWP4CU9Q6w0I5N/Y+XwgF/8g== X-Received: by 2002:a17:90a:f3d6:: with SMTP id ha22mr29151692pjb.193.1593019583946; Wed, 24 Jun 2020 10:26:23 -0700 (PDT) Received: from google.com ([2620:15c:2ce:0:9efe:9f1:9267:2b27]) by smtp.gmail.com with ESMTPSA id i191sm21217005pfe.99.2020.06.24.10.26.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 10:26:22 -0700 (PDT) Date: Wed, 24 Jun 2020 10:26:20 -0700 From: Fangrui Song To: Arvind Sankar Cc: Kees Cook , Will Deacon , Catalin Marinas , Mark Rutland , Ard Biesheuvel , Peter Collingbourne , James Morse , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Russell King , Masahiro Yamada , Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , x86@kernel.org, clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-efi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/9] vmlinux.lds.h: Add .symtab, .strtab, and .shstrtab to STABS_DEBUG Message-ID: <20200624172620.654hhjetiyzpgoxw@google.com> References: <20200624014940.1204448-1-keescook@chromium.org> <20200624014940.1204448-3-keescook@chromium.org> <20200624153930.GA1337895@rani.riverdale.lan> <20200624161643.73x6navnwryckuit@google.com> <20200624171121.GA1377921@rani.riverdale.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200624171121.GA1377921@rani.riverdale.lan> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-24, Arvind Sankar wrote: >On Wed, Jun 24, 2020 at 09:16:43AM -0700, Fangrui Song wrote: >> >> On 2020-06-24, Arvind Sankar wrote: >> >On Tue, Jun 23, 2020 at 06:49:33PM -0700, Kees Cook wrote: >> >> When linking vmlinux with LLD, the synthetic sections .symtab, .strtab, >> >> and .shstrtab are listed as orphaned. Add them to the STABS_DEBUG section >> >> so there will be no warnings when --orphan-handling=warn is used more >> >> widely. (They are added above comment as it is the more common >> > >> >Nit 1: is "after .comment" better than "above comment"? It's above in the >> >sense of higher file offset, but it's below in readelf output. >> >> I mean this order:) >> >> .comment >> .symtab >> .shstrtab >> .strtab >> >> This is the case in the absence of a linker script if at least one object file has .comment (mostly for GCC/clang version information) or the linker is LLD which adds a .comment >> >> >Nit 2: These aren't actually debugging sections, no? Is it better to add >> >a new macro for it, and is there any plan to stop LLD from warning about >> >them? >> >> https://reviews.llvm.org/D75149 "[ELF] --orphan-handling=: don't warn/error for unused synthesized sections" >> described that .symtab .shstrtab .strtab are different in GNU ld. >> Since many other GNU ld synthesized sections (.rela.dyn .plt ...) can be renamed or dropped >> via output section descriptions, I don't understand why the 3 sections >> can't be customized. > >So IIUC, lld will now warn about .rela.dyn etc only if they're non-empty? HEAD and future 11.0.0 will not warn about unused synthesized sections like .rela.dyn For most synthesized sections, empty = unused. >> >> I created a feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=26168 >> (If this is supported, it is a consistent behavior to warn for orphan >> .symtab/.strtab/.shstrtab >> >> There may be 50% chance that the maintainer decides that "LLD diverges" >> I would disagree: there is no fundamental problems with .symtab/.strtab/.shstrtab which make them special in output section descriptions or orphan handling.) >> > >.shstrtab is a little special in that it can't be discarded if the ELF >file contains any sections at all. But yeah, there's no reason they >can't be renamed or placed in a custom location in the file. https://sourceware.org/pipermail/binutils/2020-March/000179.html proposes -z nosectionheader. With this option, I believe .shstrtab is not needed. /DISCARD/ : { *(.shstrtab) } should achieve a similar effect.