Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1861758rwr; Fri, 28 Apr 2023 02:56:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4B8b79Xmb+pl6vBzneuC0Wu+PHVGr9w3+vToSrcPw48nMZAPk/64fZWUl5vu+mS+lp0Azt X-Received: by 2002:a05:6a00:1350:b0:63b:4313:f8c4 with SMTP id k16-20020a056a00135000b0063b4313f8c4mr7597585pfu.9.1682675787385; Fri, 28 Apr 2023 02:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682675787; cv=none; d=google.com; s=arc-20160816; b=mnd715zb0cGPhhGA5PjAmj1IawuaWv3SNG2IXSUMjgx5zb4eCaiH/Tldtr4Il5DD9Z TnY4DEmHTG23dmc3OJI7FVHc4HpZvnTV4HDsHTyLAv/A0NIV7vWwOCrG91wr+PJ2svM4 K3Jb5wrmo1SE6F5x8FV+YMJ9vPgju4THiRLtr3wo/TwtrDW3j1bsp0tWV81cxM2FbTdY Ijdib4ME3otpu4ys3HU/0Q6O0n0OXRRW1ANAFNhiJyKbhTjC9gb6x186P/rtWWpDQGAl 23I+dFVk4enDzbmbPggQTWfoqzwm/5RHTr/L5QXmF2s5ZPKuwOmYYLSSCjvIf8G26cwl 1pig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XCHtupLXJ2rBPBM5wmy9RIEtiY61kV4Rb+rfVN2Uc40=; b=D6EIngXz8P2ofmDSWqLOlRIjGcWxi0LijsB7LOz9+HC2ETK5h8iJcPH3t/GgOpnGc9 G39HaAzYmSYIuFP/Q719Pax4J53CyXKSeIVTdXkt3F2yRvnKdRGwaI3cdVcNxNimysUO Uc1osxg/b3lrQI9gw3EQb/+vGo9etYQ7ftcrcVKFGfMGwEpLUS+CdQ+jz4H2I1WKvbZP BPgoF7jTibeIAvftTd9wLByXemMiBMUiShUO6XrzlYpdFZKhhF7Lu5aA1l4OCq2fBRSS bRJoB7pj8HDwyEE1c+yMNrhDscLrZ9kg64E09hkV/dzmAAh4YWxw8rradfx5qnIU6qWW b2yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y200-20020a6264d1000000b0063b61b49a29si21240717pfb.251.2023.04.28.02.56.16; Fri, 28 Apr 2023 02:56:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345678AbjD1Jzc (ORCPT + 99 others); Fri, 28 Apr 2023 05:55:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345897AbjD1JzJ (ORCPT ); Fri, 28 Apr 2023 05:55:09 -0400 Received: from out187-6.us.a.mail.aliyun.com (out187-6.us.a.mail.aliyun.com [47.90.187.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDB935584 for ; Fri, 28 Apr 2023 02:54:47 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047212;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---.STFQGPs_1682675586; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.STFQGPs_1682675586) by smtp.aliyun-inc.com; Fri, 28 Apr 2023 17:53:07 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Thomas Garnier" , "Lai Jiangshan" , "Kees Cook" , "Hou Wenlong" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" , "Nathan Chancellor" , "Ard Biesheuvel" , "Nick Desaulniers" , "Andrew Morton" , "Alexander Potapenko" , "Xin Li" Subject: [PATCH RFC 24/43] x86/boot/compressed: Adapt sed command to generate voffset.h when PIE is enabled Date: Fri, 28 Apr 2023 17:51:04 +0800 Message-Id: <8d6bbaf66b90cf1a8fd2c5da98f5e094b9ffcb27.1682673543.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When PIE is enabled, all symbols would be set as hidden to reduce GOT references. According to generic ABI, a hidden symbol contained in a relocatable object must be either removed or converted to STB_LOCAL binding by the link-editor when the relocatable object is included in an executable file or shared object. Both gold and ld.lld change the binding of a STV_HIDDEND symbol to STB_LOCAL. But For GNU ld, it will keep global hidden. However, sed command to generate voffset.h only captures global symbol, then empty voffset.h would be generated when PIE is enabled with lld. So capture local symbol too in sed command. Signed-off-by: Hou Wenlong Cc: Thomas Garnier Cc: Lai Jiangshan Cc: Kees Cook --- arch/x86/boot/compressed/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 6b6cfe607bdb..678881496c44 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -79,7 +79,7 @@ LDFLAGS_vmlinux += -T hostprogs := mkpiggy HOST_EXTRACFLAGS += -I$(srctree)/tools/include -sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVW] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p' +sed-voffset := -e 's/^\([0-9a-fA-F]*\) [ABCDGRSTVWabcdgrstvw] \(_text\|__bss_start\|_end\)$$/\#define VO_\2 _AC(0x\1,UL)/p' quiet_cmd_voffset = VOFFSET $@ cmd_voffset = $(NM) $< | sed -n $(sed-voffset) > $@ -- 2.31.1