Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp560568ybv; Sat, 22 Feb 2020 09:19:35 -0800 (PST) X-Google-Smtp-Source: APXvYqycKBGbXddrKzymzOqnDi7It1bpmi1dsWbpeSo86gj0dcFFnxL+YkUCC/0ME6M1gATInMkR X-Received: by 2002:a05:6808:48b:: with SMTP id z11mr6513318oid.38.1582391975381; Sat, 22 Feb 2020 09:19:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582391975; cv=none; d=google.com; s=arc-20160816; b=XEUuRMKKEyQ5Zcsg8J1jzrj6/0Crmb25vVdyj1KAUk73a76jPz1I8i3g/n2AAWVBSi ECJmV+Kh74bwPbPfr63ZWl5fviELPuvaK0TX5uZ309zA1uMlMMVDnaZHcRlMpjAHD2Ol /zgacR08ho1Q3GAQUdk6Tnf5G4vQbQZKtsm6liTlWj0tIqhzW9fQud4zzpQdfbpUXu5c tmvaQ1xQWKRLq0eVz520GWnaTneDpbyq8cQnrkxgkxT1t5wSIvG+GxErY7LnAms8PW9o AAi3cZLG/g+MGTYMYMR1Ixpv58YFQ0UMnBBwa7RY4zhoeZiOvg375LHmkA3A/bQltsyo 6q5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=usc74mrAn4ovUQS3g/Tme8E1bBKJwqNVRzgsDrqLwAk=; b=GCYnZup63+m9221xXxX5NcpHxRQodv9CE2tZP5x+0zYeRoo23EJ3kbOK9SGo9GL9Vl dTTIw/OcXlk54qW5N4jBIHTrhB8RA4rVjgpVbxL4VFLm+HbJ36mW0gBiS5SM+jakZYlT gF/5K4N/tbVhQV6dA1jV0aaz6yBGFD9VO7g6VSVk/SqE3rrYzDgDgpx6aelckfDZEJbn JVa2PbuV2ArddzO30Rm8t0sjMlTSST9jF8yLrCozGFv8XJMTy+zXTNHIG1firakosUr7 NGHPzA6F6r/9pkY5NMgu6OAj4OPkz4UOLISx92nojugL1p2mHaYIFqWaUKIpKXmz3EKE 3r1Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si3374118oti.291.2020.02.22.09.19.23; Sat, 22 Feb 2020 09:19:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726733AbgBVRTC (ORCPT + 99 others); Sat, 22 Feb 2020 12:19:02 -0500 Received: from mail-qv1-f67.google.com ([209.85.219.67]:45426 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgBVRTB (ORCPT ); Sat, 22 Feb 2020 12:19:01 -0500 Received: by mail-qv1-f67.google.com with SMTP id l14so2396172qvu.12 for ; Sat, 22 Feb 2020 09:19:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=usc74mrAn4ovUQS3g/Tme8E1bBKJwqNVRzgsDrqLwAk=; b=MRpbE0hV4BpFcEVA7PHJwYHuWfG7kX1+dynoqCp83RY7rJrknrlg+yjNoIJyFB6lJG PgtKVBqeqL7Lug/Ndc2C60zkV1/Hfnlbnxc0uE1ZUaHxSA8wkrmTQRXEbZXBwxUU65ad Sdi/UQJ074fI+jBRH9OnYG291VYBAP+4V8xF5EpUq2uxe9yL5OvwUbSl6JrxMuUKhX1D 65n8fqPGhULgy49lQeHAmpDz/2ivFsTO4vxG68z0+H1H3VRlUOhI8y1oL9JvXvT3htFc Vqi9qyt0L6aot9leBSQNXYgHXkxw/8JBsYPH35pc+seBWT/mjBTkle60+b9f6lWC8xmb WLag== X-Gm-Message-State: APjAAAUgF8aqzAF2RnKF/qTUDQWFIRQH1X18ACnQKm+ZyxsI7+LVpFSh xJVR/uLXhtJLX9bjFxHTBWs= X-Received: by 2002:a05:6214:1933:: with SMTP id es19mr35351103qvb.14.1582391940880; Sat, 22 Feb 2020 09:19:00 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id a128sm1169350qkc.44.2020.02.22.09.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Feb 2020 09:19:00 -0800 (PST) From: Arvind Sankar To: Arvind Sankar Cc: Nathan Chancellor , Fangrui Song , Borislav Petkov , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Michael Matz Subject: [PATCH] x86/boot/compressed: Fix compressed kernel linking with lld Date: Sat, 22 Feb 2020 12:18:59 -0500 Message-Id: <20200222171859.3594058-1-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200222164419.GB3326744@rani.riverdale.lan> References: <20200222164419.GB3326744@rani.riverdale.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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