From patchwork Wed Jul 12 03:30:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Wenlong X-Patchwork-Id: 118799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp890541vqm; Tue, 11 Jul 2023 20:45:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGeGvGXelGbBq1DlDS5346i6UL638Bgumfeobysl72R/N92wc+YD+41Sm5fbcgbF5lHhpu/ X-Received: by 2002:a17:906:109c:b0:994:8e9:67fe with SMTP id u28-20020a170906109c00b0099408e967femr7163936eju.35.1689133527031; Tue, 11 Jul 2023 20:45:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689133527; cv=none; d=google.com; s=arc-20160816; b=fAp28pL9zR5CTaMce1HlF2I3JCWjBb4jvKUMG1HaMzK6DpWJYkCwuBKjjbFin/Jl1e 9METjrXEpKFrigaAAFu+1JaSol1LAA0eLhO+TIcrVDIFQUEVF2H6HTzrlACspp8hx1yh QX13gMRFmXtsWbUjnjzv6KbNFzdJqPokkCb1ajDeLDWM9XFQEZjSgdT14P9VW5Yt6F/x Nt1yp5UH5+rDX5sa/NuKkZ352Ggsa00cEq993m8//uNAtbFhJ1QFLauh7Nh5xFwx9Dd3 jkxgpV/TxMsffR9Y6768FnZ40VAHBcpoVGxrzc9AjmGMDpLmUAwBbeWmsVMJVSMZ+G8S Jnng== 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=HzQcwkYZczVd1WZ9LYoiNZFwcf6IYCdYCbv73gqL4tI=; fh=6kcROGYttX7oh1tPSR92G4/yiyin+OdDTUaLuypjG00=; b=dMlj+gz5luxPDEllG7HSrqCc2XMDfP3kQLx1aw7i3FMsIty6onBEVdzZMA+xCY0fRu UhuFNRcKq+MEklN8LFCEg46s8h3eg7hz+4m0BzkbFuEZED9RaU45pta2jTGymSKD/rkY bLM5zZxL9EJX8o+1bKMcEhanLfP/9OWHI9Cb+81F/PFxW0Fyl6TduoFE1K/iD4FVj1EI +GwF/T0SzLjpRjeqA/ZVnSLyAlOxLWm/Dym5hbXXhTedo+bHzCYEojTCR5EfUgB9y4/O NlXfD19S4vj0FufcD/7TYMf8b68QAFvWBjYGjzW8dskqSMjIisoBYgLA3R7rps/y6fFZ U/Tw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lg15-20020a170906f88f00b00992a9bdb0e4si3825647ejb.309.2023.07.11.20.45.04; Tue, 11 Jul 2023 20:45: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 S231767AbjGLDb7 (ORCPT + 99 others); Tue, 11 Jul 2023 23:31:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231716AbjGLDbs (ORCPT ); Tue, 11 Jul 2023 23:31:48 -0400 Received: from out0-194.mail.aliyun.com (out0-194.mail.aliyun.com [140.205.0.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599F610EF for ; Tue, 11 Jul 2023 20:31:41 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R741e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047208;MF=houwenlong.hwl@antgroup.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---.TrdHwxy_1689132693; Received: from localhost(mailfrom:houwenlong.hwl@antgroup.com fp:SMTPD_---.TrdHwxy_1689132693) by smtp.aliyun-inc.com; Wed, 12 Jul 2023 11:31:34 +0800 From: "Hou Wenlong" To: linux-kernel@vger.kernel.org Cc: "Lai Jiangshan" , "Hou Wenlong" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , " =?utf-8?q?maintainer=3AX86_A?= =?utf-8?q?RCHITECTURE_32-BIT_AND_64-BIT?= " , "H. Peter Anvin" , "Nathan Chancellor" , "Ard Biesheuvel" , "Kirill A. Shutemov" , "Nick Desaulniers" , "Petr Pavlu" , "Xin Li" Subject: [PATCH RFC 4/7] x86/boot/compressed: Adapt sed command if head code is built as PIE Date: Wed, 12 Jul 2023 11:30:08 +0800 Message-Id: <0856eaae3439581fdcb7143389ee4cc00859cc9d.1689130310.git.houwenlong.hwl@antgroup.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771184877068279421 X-GMAIL-MSGID: 1771184877068279421 When x86/head64_identity.c is built as PIE, all symbols would be set as hidden to omit GOT references. According to the 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. However, for GNU ld, it will keep the global hidden. The sed command to generate voffset.h only captures global symbols, so an empty voffset.h would be generated with ld.lld. Therefore, local symbols should also be captured in the sed command. Signed-off-by: Hou Wenlong --- 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 40d2ff503079..ca57ad0d2d22 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) > $@