Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp628066ybv; Sat, 22 Feb 2020 10:58:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyXRA3jh7MHT/KI9PZaLsFTEiJEbku8G8XmJLGqVEN4bER/bDMLFACeIYTXt3q6ik4KXFYY X-Received: by 2002:aca:b703:: with SMTP id h3mr7036744oif.148.1582397938579; Sat, 22 Feb 2020 10:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582397938; cv=none; d=google.com; s=arc-20160816; b=iNiDxpN6LpMTLJA7mjgno/2mxb5zCg7fUdtdWVGD/516BWunuXFjk0I6y/VQ2/kPCW asHo1I3lSfv6fgfpvKoCwjX9BOTjnB3Bf87moXLUjAyEPpMBh3Fm+uPQ1Aoy6Ilq1l0b Kk+9wLU60i1roJrMUatjnlcsVPa76yr65e+vb0ChNFirlHYw6CElncXRzwTVq+vEmTAp BjwkcWcyB2tQjxOIquRMUJa/tZlDCFwHHYyPpbSJ9/FfpJ/W5F8B7Wq9lqz2FpCbOzUU TdpcA8zfR/fJwTEz7w6iECI3C5PMh8eO7VrTuyJ6dFsEVi+JDDHo8j29AYo992iB89wD j8cA== 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=euAwmf9ZhKSh37U9bkj0mMT6F/SgMII2G3vEqdzGF+E=; b=gAFM+fuj+ECkQ7xBg4lwdXs+zQYjS3C2MPkygyadCidsubZiwCJRgsNNR5OTPJHH5q RCiEgPmyHnmVIu4dpU+2GwXZlLfoI9KwnEMsfKFXe1kAajC7Qmog84nMDEJNOLxXFDMF aDkB0tUsWPxaMj7Z2aDo8XnWqNIf19vY0xyeAIeiTidkvhdr31wTPKzyzifiX6PiECFG An454uzmujGNDHpeclOL/v4Nvi/e0R9guoZS9hGb/Kyo+w7+BBqXFzgjbdObgtaZycz9 9P5fCwkN4cuDuCrBXjymyVBYFyKKA+L7VsOurs8XobVW53AlNxdUw4FqHlAyJvsSkHMM JFEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LOr6ninH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id j17si3363216otl.278.2020.02.22.10.58.46; Sat, 22 Feb 2020 10:58:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LOr6ninH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726945AbgBVS6N (ORCPT + 99 others); Sat, 22 Feb 2020 13:58:13 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:47056 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbgBVS6M (ORCPT ); Sat, 22 Feb 2020 13:58:12 -0500 Received: by mail-pf1-f196.google.com with SMTP id k29so3050884pfp.13 for ; Sat, 22 Feb 2020 10:58:12 -0800 (PST) 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=euAwmf9ZhKSh37U9bkj0mMT6F/SgMII2G3vEqdzGF+E=; b=LOr6ninHef6EqwLrCnhGqXf8avbYzlLKURAE+lq3h/R9/U2FLomgbcvSelltYM8q20 6YE4sduH4cyP8TaFXw0doD0t8Xxi+TEQQFdwu40eGlND0v3d/dK6G4Y+wsz9Dp3B+sUL MKnIQ1P/hOE2jopPzo0y5vM7UlULyBIqKltSwfK13JqAnMXWsyZ05GUjr6OpmH3/3aX/ BlC8MuWnUj8ADf3aV8bY43/LVNXL74o4RXSI9LgJt5DuEt11zu0lKDlmw5lmnMTmRQvn YvkwCHhbBBzC4EHP/gsjzo9uTukADuV+PHNC06ndCo/SVuu15d7HgjFkIggeyO467QKX 3NuQ== 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=euAwmf9ZhKSh37U9bkj0mMT6F/SgMII2G3vEqdzGF+E=; b=ulGGaW8C3XaWBQqNpAgDxx4z4ZJS5vjr+hgcS9BW9hAE1kr2SOoWf6hVHc8ZCQ3frk u8hR8S02+FbrKrZsVR8cFnO/pitTngNQL27i/B3eTlffXJBiP0uQCdjEqd6yV4/O9Ofp uP7cV8bY5p+jHj+ffzqcTgT1kBprw5mUdM5KepPt0HsbrL+xHG0xiWQdYETRfTkfsyrP 9ly+ysdB1j0U4bEB6kISdQ7FqjWYZSSjquTEjkOfzfeHeJFMes0CRMbWEuR0q/xbcaaR lcPx5UKoe2dU4CF5X8WgEtDSJVutyDbPoakGwdcIrtmVhKNZllPROiQHYcLj4HwUmWl3 f8lw== X-Gm-Message-State: APjAAAUokJeoGRXAqjdDdLaNy9j9dzTpKIB41KpQB68NuCvBC35jMWax NP4wLEXOanz1T4hCXB3J+0xNMA== X-Received: by 2002:a63:7453:: with SMTP id e19mr16713707pgn.50.1582397891896; Sat, 22 Feb 2020 10:58:11 -0800 (PST) Received: from google.com ([2620:15c:2ce:0:9efe:9f1:9267:2b27]) by smtp.gmail.com with ESMTPSA id f43sm6640138pje.23.2020.02.22.10.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Feb 2020 10:58:10 -0800 (PST) Date: Sat, 22 Feb 2020 10:58:06 -0800 From: Fangrui Song To: Arvind Sankar Cc: Borislav Petkov , Nathan Chancellor , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Michael Matz Subject: Re: [PATCH] x86/boot/compressed: Fix compressed kernel linking with lld Message-ID: <20200222185806.ywnqhfqmy67akfsa@google.com> References: <20200222164419.GB3326744@rani.riverdale.lan> <20200222171859.3594058-1-nivedita@alum.mit.edu> <20200222181413.GA22627@ubuntu-m2-xlarge-x86> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200222181413.GA22627@ubuntu-m2-xlarge-x86> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-02-22, Nathan Chancellor wrote: >On Sat, Feb 22, 2020 at 12:18:59PM -0500, Arvind Sankar wrote: >> Commit TBD ("x86/boot/compressed: Remove unnecessary sections from >> bzImage") discarded unnecessary sections with *(*). While this works >> fine with the bfd linker, lld tries to also discard essential sections >> like .shstrtab, .symtab and .strtab, which results in the link failing >> since .shstrtab is required by the ELF specification. .symtab and >> .strtab are also necessary to generate the zoffset.h file for the >> bzImage header. >> >> Since the only sizeable section that can be discarded is .eh_frame, >> restrict the discard to only .eh_frame to be safe. >> >> Signed-off-by: Arvind Sankar >> --- >> Sending as a fix on top of tip/x86/boot. >> >> arch/x86/boot/compressed/vmlinux.lds.S | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S >> index 12a20603d92e..469dcf800a2c 100644 >> --- a/arch/x86/boot/compressed/vmlinux.lds.S >> +++ b/arch/x86/boot/compressed/vmlinux.lds.S >> @@ -74,8 +74,8 @@ SECTIONS >> . = ALIGN(PAGE_SIZE); /* keep ZO size page aligned */ >> _end = .; >> >> - /* Discard all remaining sections */ >> + /* Discard .eh_frame to save some space */ >> /DISCARD/ : { >> - *(*) >> + *(.eh_frame) >> } >> } >> -- >> 2.24.1 >> > >FWIW: > >Tested-by: Nathan Chancellor I am puzzled. Doesn't -fno-asynchronous-unwind-tables suppress .eh_frame in the object files? Why are there still .eh_frame? Though, there is prior art: arch/s390/boot/compressed/vmlinux.lds.S also discards .eh_frame