From patchwork Wed Mar 9 12:28:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12775021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43012C433FE for ; Wed, 9 Mar 2022 12:30:56 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.287794.488013 (Exim 4.92) (envelope-from ) id 1nRvSl-0003jv-TT; Wed, 09 Mar 2022 12:30:43 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 287794.488013; Wed, 09 Mar 2022 12:30:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nRvSl-0003jh-P9; Wed, 09 Mar 2022 12:30:43 +0000 Received: by outflank-mailman (input) for mailman id 287794; Wed, 09 Mar 2022 12:30:41 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nRvSj-00039g-Jb for xen-devel@lists.xenproject.org; Wed, 09 Mar 2022 12:30:41 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b9c62885-9fa4-11ec-8eba-a37418f5ba1a; Wed, 09 Mar 2022 13:30:39 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b9c62885-9fa4-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1646829039; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=9n5J/SLlazG5OkZb6XiFpdMz0tZKAWZaKoaZX6MjJqU=; b=GUMTuAtdaO4rGxTGrN55r/Pav/tELktoEnL00v5VEZDdD0zsu6ZDhD2I iQhKZX6tuG6AH5m2koz8fWJ660Ut0HsvWygc8c0b1hqNMR91N7J29vo5w N7sXpDjazdDLG4H9yP6gIUh03zAS56fOs37M7ZEc8yTdLLZlIMNxh6Znl 8=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com X-SBRS: 5.1 X-MesageID: 65807411 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:cX6ByqufSQXZVZWYaU8iuyRAmufnVNdeMUV32f8akzHdYApBsoF/q tZmKWuFMq6NNjbweowgaNm+90wBu57WmtQwHgo4pC9jEn8Q+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQyw4bVvqYy2YLjW1jV6 IuoyyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi94J43emOkcdCBGAiJVZfFe877sPFKw5Jn7I03uKxMAwt1rBUAye4YZ5vx2ESdF8 vlwxDIlN07ZwbjsmfTiF7cq1p9LwMrDZevzvll6yj7UF7A+SI3rSKTW/95Imjw3g6iiGN6AO ppBNmY2NXwsZTVxJggLGZgBmtv0qV3wLhFCkVeTtbset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2F mAtza8yrSosvm9xBOZ/2jP765OkN+k7tdYHsSDhuUcNz2poAe1Y4ZKXaGEoVkO0aqSwWdvtO OJjwYrPsx15X+UVmapoSH10w2l6zoq42+K8y7uvVLT5ejCAB4qActIgoxUNjHD7VA7gd162K VXm0qEqpt+F3r77WvAzumNcysvulu/oHIkn+JWpWdYS5EiZLhYqpFa1F9JEa0HADnx5OkcYa VT5fnnlbdrmG6hHjDkVjEF+q3uYp1zJGbKfqE6gL3a79AM90oJjXfxx6Qk7wM9HdwGOtx5Dt //Q9dVfYF1P78rhJ1GdZU8qLOMexTwqDL3QRSvyAfcZeg600ykke+D3Fxy3pDvRKA1 X-IronPort-AV: E=Sophos;i="5.90,167,1643691600"; d="scan'208";a="65807411" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YAGMM5H9N2vt2BURr1GKfuyHuNEVnI76fRYF23v8whSwtazgy9ZjgDgxqZ/hKllupgHdwBdmvYVSbL4J42UqEqv3MtB5lhO2QxyEJpmN/0OVkLBOVetHjfb21UEYrd1spcBUtGvXjvc31oJJBkYUZJ8poJ0292Z38V4AEKzP6oKxg2wak/gotHttIJouzTHm4eW4zmUEKHSQLynznCRFOo4dlGlwgTDKwq32HuQtUxyMpDTXViORswFidiNvRDCX6MILybhwCr/8Am0A7gU510HqsnL8Gix8fVw2upSpJtQ7cUAhqFRzzbwcZpt2FB/Oj/L/o+Z69wYyX3zvDNlXWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jfLEQnh7siEH8oE4+sQ6IzMnA97R6ZK1oefy+4uZXVI=; b=EdRkYGHBU1JIOBcgotvFDUVRvn+MBy/9Mtg6SajhV1OYg2K0rL50qNYfRcPn/V00u5aHvyVdGOxmBt5tGtl070a55ysxJMl3/0vc+vtWnQ5YRzGl5PA6jKpNbvX9pXm71I0jX9xWnYQ25jasljCJNJOlcGLrYx/0NB/2DTFURuG63GIe3f/H+phiHgNzst+S1lcrN/W6v/z2ohfYxbcYFyeuCN03DQ6ygxV5Jm39gHVu3V4m1gIrCgMuoxhRyK89Vx4TI+ibJ3spbjposiApCBf3FH22wPmGdnfSL2RchN0Qo4dgYrBRqMTU4CCwa7QV19qf60Knivx6wBYe11m0iQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jfLEQnh7siEH8oE4+sQ6IzMnA97R6ZK1oefy+4uZXVI=; b=HVT362XLc3xn2RNNHoYaLKrJcOy1Eapht6iMPQUDpqYZK6k8iDMHP2abN6GJEU8Oz3a7ac1QQ/Jv+wPyBKtcw09L+2F2NCH4X9pUEAi9g8MdDYwmdpmvfanVbD4eRMRO3/A/3HiwXeu+4di6tDkC5cwGUPrkNcPXfprLGyThNls= From: Roger Pau Monne To: CC: Roger Pau Monne , Stefano Stabellini , Julien Grall , Bertrand Marquis , Volodymyr Babchuk , Jan Beulich , Andrew Cooper , Wei Liu , Julien Grall Subject: [PATCH v4 1/2] xen/build: put image header into a separate section Date: Wed, 9 Mar 2022 13:28:45 +0100 Message-ID: <20220309122846.89696-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220309122846.89696-1-roger.pau@citrix.com> References: <20220309122846.89696-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0029.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::16) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 92357126-b1c5-49fc-377e-08da01c897b1 X-MS-TrafficTypeDiagnostic: BYAPR03MB4359:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DJI9bbypEy1YzBYVl9NYq5Bt17/7veoSOzg/+J70XYVRXgRGnMa2DCxwbY86y/Qu0lMZM/IzJj8s04d0nPhBSR5v3yjzJ3eQLbRYofdILOFFg7pYYiLDTgOyJUJp22d0VPygYsi8x/scCBNnVStIROzz+dEh2cfFDumd69pwLTI5Wbsmm6ccKyS451zPAQfMx4JO+qmKtZDmOt5OGmunf/43Eq2TX9aXh7RqR93YtAeJGG3HIutpEeY7DvTrEGRWMremr+ac1Ui44BAtx/PzU32McqgV5awx4Sjwyec/3Bm8TYWCiFqlvtJY/wUSdXgRSnsV+jQecayrlPh1l8czEF6PHSwQtAx64GQx0mNHuVnHEPN/YNqNnknaOD51bv+mT2Tc9KNxnOgC2U/tHajHcP4J0iHFQWkKv5D4XkYFPYjjoPCLurDeXZfjH5hBD3+H7QjMzvfVb5sovDKDOrniML5Sf3GKVuk4dLWpwmZL+imOaL5GwQUqPm+S7ynpoqdpDFVolBPTo6WUyyfNj92N50T9uVgYxZyB8+A8LCopVWmMdQUaQjz3hE0+DGLjyThDSV3c1Kk/u2Ddp4C/yWxttjGFNcNhABncwHYjQ6+Ksoogi/Qr0ryEL9SRvhgitvAZILr0ml6sx0p3ff3coy2kFw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(66556008)(4326008)(66946007)(1076003)(8676002)(6666004)(86362001)(83380400001)(2906002)(38100700002)(66476007)(82960400001)(5660300002)(8936002)(6486002)(6916009)(6506007)(36756003)(54906003)(508600001)(2616005)(316002)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?XGuCq2QYJ62u/XJy0rEm+XH+R0P9?= =?utf-8?q?bbUNSWwFR8oxVlcBdPjQ6G8e+rIOTBslEpiCqIQ2tPnI9zixsDu3Z/3mucQKyK+EE?= =?utf-8?q?uHuKBfNnWMkGr+W+tuepUueJLFfhQeX8Z2hIqu7dYG10Q1cv1RZap8nFDHtPGPZMp?= =?utf-8?q?ATt5ppTCX+mIUbqFZVi3scEvbatxHf9L26kTRsWycCJCI/svLKzTMKP2oLs/GADnq?= =?utf-8?q?xJjskoST25Z3IwGchsY/mtQDF5QPGAIlQIuvV4Y5ooBQgJKP98UcwvMTk6k4ue0nS?= =?utf-8?q?76psZcEyc4LbnuoC96oP0BPCWRdECh4ol4ICBkqHHf2YQrx7g7JhfApvteYq2Bvnf?= =?utf-8?q?gB8XQFIWlbLurO+rxXXWLoNKN31hd/q6GGL2gHiGc2xy2oZVHpW7YbO+7jjGs1MpP?= =?utf-8?q?j7ygaFS25Sp4nwfhVGlr2tpy0nqAZAi4L5MLuByXnYf4W5wqkj4cOlYL7zIRW3TSG?= =?utf-8?q?x0sTrFD65pp94EevHtTUXcXkhnT//OHkBYpZXJ8WSfoaQHJsE4ZDF3wqi1Ny9dz+o?= =?utf-8?q?JkXXl0NoU065MFduztsJUTXQXXOEp4hVZW7hzyWRQa2+GO0f9XJ21OwHX6dE3l2vn?= =?utf-8?q?Yw2Sm3s+exSjdsyRKGOJT64Tmw+QMbK4GB8oZT6+ovbMNEPRnevf9dGb5Tp/GSriO?= =?utf-8?q?oyF+wgfSEiM+XyCd6FmWVyd0WLIY2rONvbqdpn1wgTOYuiBdgo0SRUOsOLf0wk6Tz?= =?utf-8?q?Qudowwo4JJep6LILK7f8R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377e-08da01c897b1 X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 12:30:27.7982 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: lrnMYLF+lruE/J5u7p+kRph3ujArnCghrlRc0vXw1U1nqPtScn7M7TRVFRQHZFIsq53PmRKhPUApBz6/vjBHug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4359 X-OriginatorOrg: citrix.com So it can be explicitly placed ahead of the rest of the .text content in the linker script (and thus the resulting image). This is a prerequisite for further work that will add a catch-all to the text section (.text.*). Note that placement of the sections inside of .text is also slightly adjusted to be more similar to the position found in the default GNU ld linker script. The special handling of the object file containing the header data as the first object file passed to the linker command line can also be removed. While there also remove the special handling of efi/ on x86. There's no need for the resulting object file to be passed in any special order to the linker. Signed-off-by: Roger Pau Monné Reviewed-by: Jan Beulich Acked-by: Julien Grall # xen/arm --- Changes since v3: - Drop .text.cold.* handling. Changes since v2: - New in this version (split from patch 2). --- xen/arch/arm/arch.mk | 2 -- xen/arch/arm/arm32/Makefile | 3 +-- xen/arch/arm/arm32/head.S | 1 + xen/arch/arm/arm64/Makefile | 3 +-- xen/arch/arm/arm64/head.S | 1 + xen/arch/arm/xen.lds.S | 8 ++++++-- xen/arch/x86/Makefile | 5 ++--- xen/arch/x86/arch.mk | 2 -- xen/arch/x86/boot/head.S | 2 +- xen/arch/x86/xen.lds.S | 11 +++++++---- 10 files changed, 20 insertions(+), 18 deletions(-) diff --git a/xen/arch/arm/arch.mk b/xen/arch/arm/arch.mk index 094b670723..58db76c4e1 100644 --- a/xen/arch/arm/arch.mk +++ b/xen/arch/arm/arch.mk @@ -23,5 +23,3 @@ ifeq ($(CONFIG_ARM64_ERRATUM_843419),y) LDFLAGS += --fix-cortex-a53-843419 endif endif - -ALL_OBJS-y := arch/arm/$(TARGET_SUBARCH)/head.o $(ALL_OBJS-y) diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile index 3040eabce3..520fb42054 100644 --- a/xen/arch/arm/arm32/Makefile +++ b/xen/arch/arm/arm32/Makefile @@ -4,11 +4,10 @@ obj-$(CONFIG_EARLY_PRINTK) += debug.o obj-y += domctl.o obj-y += domain.o obj-y += entry.o +obj-y += head.o obj-y += insn.o obj-$(CONFIG_LIVEPATCH) += livepatch.o obj-y += proc-v7.o proc-caxx.o obj-y += smpboot.o obj-y += traps.o obj-y += vfp.o - -extra-y += head.o diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S index 7a906167ef..c837d3054c 100644 --- a/xen/arch/arm/arm32/head.S +++ b/xen/arch/arm/arm32/head.S @@ -120,6 +120,7 @@ #endif /* !CONFIG_EARLY_PRINTK */ + .section .text.header, "ax", %progbits .arm /* diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile index baa87655fa..6d507da0d4 100644 --- a/xen/arch/arm/arm64/Makefile +++ b/xen/arch/arm/arm64/Makefile @@ -7,6 +7,7 @@ obj-$(CONFIG_EARLY_PRINTK) += debug.o obj-y += domctl.o obj-y += domain.o obj-y += entry.o +obj-y += head.o obj-y += insn.o obj-$(CONFIG_LIVEPATCH) += livepatch.o obj-y += smc.o @@ -14,5 +15,3 @@ obj-y += smpboot.o obj-y += traps.o obj-y += vfp.o obj-y += vsysreg.o - -extra-y += head.o diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 66d862fc81..e62c48ec1c 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -133,6 +133,7 @@ add \xb, \xb, x20 .endm + .section .text.header, "ax", %progbits /*.aarch64*/ /* diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 08016948ab..743455a5f9 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -30,9 +30,13 @@ SECTIONS _start = .; .text : { _stext = .; /* Text section */ - *(.text) + *(.text.header) + *(.text.cold) - *(.text.unlikely) + *(.text.unlikely .text.*_unlikely .text.unlikely.*) + + *(.text) + *(.fixup) *(.gnu.warning) _etext = .; /* End of text section */ diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 9c40e0b4d7..04065a7310 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -1,5 +1,7 @@ obj-y += acpi/ +obj-y += boot/ obj-y += cpu/ +obj-y += efi/ obj-y += genapic/ obj-$(CONFIG_GUEST) += guest/ obj-$(CONFIG_HVM) += hvm/ @@ -77,9 +79,6 @@ obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o obj-y += sysctl.o endif -# Allows "clean" to descend into boot/ -subdir- += boot - extra-y += asm-macros.i extra-y += xen.lds diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index 8e57476d65..c90e56aeab 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -117,5 +117,3 @@ endif # Set up the assembler include path properly for older toolchains. CFLAGS += -Wa,-I$(srctree)/include - -ALL_OBJS-y := arch/x86/boot/built_in.o arch/x86/efi/built_in.o $(ALL_OBJS-y) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index dd1bea0d10..92d73345f0 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -9,7 +9,7 @@ #include #include - .text + .section .text.header, "ax", @progbits .code32 #define sym_offs(sym) ((sym) - __XEN_VIRT_START) diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 506bc8e404..960c51eb4c 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -73,9 +73,7 @@ SECTIONS _start = .; DECL_SECTION(.text) { _stext = .; /* Text and read-only data */ - *(.text) - *(.text.__x86_indirect_thunk_*) - *(.text.page_aligned) + *(.text.header) . = ALIGN(PAGE_SIZE); _stextentry = .; @@ -87,7 +85,12 @@ SECTIONS kexec_reloc_end = .; *(.text.cold) - *(.text.unlikely) + *(.text.unlikely .text.*_unlikely .text.unlikely.*) + + *(.text) + *(.text.__x86_indirect_thunk_*) + *(.text.page_aligned) + *(.fixup) *(.gnu.warning) _etext = .; /* End of text section */ From patchwork Wed Mar 9 12:28:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12775020 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ACE96C433EF for ; Wed, 9 Mar 2022 12:30:53 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.287793.488002 (Exim 4.92) (envelope-from ) id 1nRvSk-0003TP-JD; Wed, 09 Mar 2022 12:30:42 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 287793.488002; Wed, 09 Mar 2022 12:30:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nRvSk-0003TI-Fs; Wed, 09 Mar 2022 12:30:42 +0000 Received: by outflank-mailman (input) for mailman id 287793; Wed, 09 Mar 2022 12:30:40 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nRvSi-00039g-JK for xen-devel@lists.xenproject.org; Wed, 09 Mar 2022 12:30:40 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b989fbf1-9fa4-11ec-8eba-a37418f5ba1a; Wed, 09 Mar 2022 13:30:39 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: b989fbf1-9fa4-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1646829039; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=vpZWRX4Vwa+gsM2ifVy160bm35BDOYv4eSobTOLsP8U=; b=f3nGzjo/WzrVWpS8Gx5BFVxL8wWQyBL5UnTOBr5oLaWkRsazJucX9vOz 33lANU7LC6EY9se+h3j+uoNkQwIIqcu7cmZ7bQaLwyUsYTSdsSekKbOax q1c2Ln52kjCkg3sBSnKD7ywdcDXU+WyQGGxaPjAjHPTPxh7shqc/dc1M1 I=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com X-SBRS: 5.1 X-MesageID: 68162922 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:rwXmzqjjSkjHXWgEMdDsGpXbX1614RAKZh0ujC45NGQN5FlHY01je htvW2+EOPzeYzahKI13bYvgoE1V6p7SyN5jQQRuqHxkEHgb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M78wIFqtQw24LhWFvc4 YmaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wF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Ynb1 IronPort-HdrOrdr: A9a23:Hhu2GK/Wql77SkLLbStuk+E8db1zdoMgy1knxilNoENuHPBwxv rAoB1E73PJYVYqOE3Jmbi7Sc69qBTnhOFICOgqTMuftWzd2VdAQ7sSlLcKrweQfhEWs9Qtr5 uIEJIOeOEYb2IK9foSiTPQe71LrajlgcKVbKXlvgpQpGlRGtBdBmxCe2Cm+yNNNW177c1TLu vj2iMLnUvqRV0nKuCAQlUVVenKoNPG0LrgfB49HhYirC2Dlymh5rLWGwWRmk52aUID/Z4StU z+1yDp7KSqtP+2jjfaym/o9pxT3P/s0MFKCsCggtUcbh/slgGrToJ8XKDqhkF+nMifrHIR1P XcqRYpOMp+r1vXY2GOuBPonzLt1T4/gkWSv2OwsD/Gm4jUVTg6A81OicZyaR3C8Xctu9l6ze Ziw3+Zn4A/N2KPoA3No/zzEz16nEu9pnQv1cQJiWZEbIcYYLhN6aQC4UJuFosaFi6S0vFpLA BXNrCd2B9qSyLYU5iA1VMfguBEH05DUitue3Jy+/B8iFNt7TVEJ0hx/r1pop5PzuN4d3B+3Z W3Dk1ZrsA8ciYoV9MJOA54e7rNNoXse2OEDIvAGyWuKEk4U0i936Ifpo9Fo92XRA== X-IronPort-AV: E=Sophos;i="5.90,167,1643691600"; d="scan'208";a="68162922" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V59PGV6k7gOSgG1VMNV1lmwnIm7jyKh1M22cgkpKvzU5PiIQYK6sE4MpF8Ohw5PJxXCfdUsxmwMYmQyctovxc2GT71Y1cGs8qZKVCdLu09UAnak/+StVttd5ITd4APvP3WXQS9OZTDVXBp0AWnDibnVKs1hZyomuSnPnXsm7mwMz/gtgke0fMniEw8gE9KdQPEX1+SPDa8lonIPMTv84GfZpzOeXp3f4/nrGwfpqFl45UvtAE9s4fMDGN8Z6uMAaO5vgT0Vu9ZyeUgWCK9fUG1T8ISDXiIAVYAxqsl3m+u0Bp6nkttQ1tkSFzVc9PqwnGgEY2jqBSGrth1NabxFqhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FuSbsghuNb3YWyNl9xxHsiwvDb+ewABgs4/F+WArUBg=; b=iNUMATBLPCuEHesSEFX0BL4QRSv6B349hn6Ri4cbLRBVyiqVTeq5Anl15FvXD9mdYzPcQk093EqAypYsTGeEC94kg0bz+k/aQElX4AYGIdAH/JdghSpsAOiwkvCgaE4to8kt6GEzDwJ1/sKTdtzZ+yCqf1OBWsvsVVWcsir71e6qBLs9vjl5fRRRVD/JxArmlWeoKAUo0UgjRd0XaRViqigtpKsPfhtHkn/U/Zn9gW56embIiABV9TWapA4seh55apOlD78yrn+h8Xl7fCFLuscEXriTdRvpsi3gs8J/wxg+KWG5H9dduFAKsj50p3klmA2y88VUiE7AEJOUD6vdIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FuSbsghuNb3YWyNl9xxHsiwvDb+ewABgs4/F+WArUBg=; b=ViI2bgUo5UzelbtN2TfxJ2yOc1iU3nPeQMSTt7OC00Ij7AAMmkPewTxSSK/U65swsQlRwGTCZO7bpFXCbdHxTIrS76SMISn2RJFk5w8bU2DqTjd70U6k9m9ccVAg+/iNDxlzAIhiA4umIMUdg2r7DpOhZc6rLwbg+3lf73xZJ2M= From: Roger Pau Monne To: CC: Roger Pau Monne , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu , Bertrand Marquis , Volodymyr Babchuk , Julien Grall Subject: [PATCH v4 2/2] livepatch: set -f{function,data}-sections compiler option Date: Wed, 9 Mar 2022 13:28:46 +0100 Message-ID: <20220309122846.89696-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220309122846.89696-1-roger.pau@citrix.com> References: <20220309122846.89696-1-roger.pau@citrix.com> X-ClientProxiedBy: LO2P265CA0099.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::15) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5a89d11-db37-493f-be11-08da01c89aba X-MS-TrafficTypeDiagnostic: BYAPR03MB4359:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xtyRz2w9IA+CtcaLqjCLLPe3OLYIY8FF/GD7bGtHwYK1aUyyg6e2IP1OJEHP6aTi7qY/wWiqU2d3r8fknJY4DLi8yUnXRzpAF6OvoNDxw/JLjqL5LwVUFM4/JuABdj/jKx0pNfkVUe5M5gxEUxD/gY6ADqJNlYrWhwpzT5wRWJgBuFwmyZE0Elpdg9KNAiBDr3+E20XdTFtwqWFDkPnjFSzSOzjeZBPikbI30x7nMdvtUadsVhKLl/P1vnfBcb1SFntLeC/qcqIXHJQfYDt/mMKO4O3b9Fzh2OeuulwKT5ctT81TorxP5SrAPuFd9s3IkxrHzvPHus0+XxzydkmfklZqeTg9bJ2ErQee20zOOFdq8gD19plPX6r/WdEP1CqTZittE2FSUGU0nQKX1Lstn6owRDQ5/1L8IrYDugtLGlJow3Kt5l2+i7PEcK/LW/IDXEOl7pho2jBAXQ/YlQE3WKj46g+xgKp/iYEEfa8SVKP6Ny3Hc4YK8UQUHFORB/HVWpe/wZLZbxV1RoBPXnUUSeDD/qhrLjFhIJVNFq8xPtf4d4pMruizFzDHLbOSSKViWDlFH0cbtIyzW/EFF/vNJqkVmrIB1Rqj1DHh6TqslmnKc1QmVSUYov/ex9ZEX9G+hb4Fer5QbrDbUqqImY3Gqw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(26005)(66556008)(4326008)(66946007)(1076003)(8676002)(6666004)(86362001)(83380400001)(2906002)(38100700002)(66476007)(82960400001)(5660300002)(8936002)(6486002)(6916009)(6506007)(36756003)(54906003)(508600001)(2616005)(316002)(6512007)(186003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?xzpO4542gnU0WssdX9/fhamhlPfH?= =?utf-8?q?0FFbYbRsGrHJKIcvz0O2VSPxkearejFEAUIfT+1iQRV6wMMyFskjaQdFpPNeF2PX0?= =?utf-8?q?kaMErig2v/L8/PeANkUwA1eeveQV6+EB6qi18Olxue1d6EeMq9JyHhOpdIBJqVZ+c?= =?utf-8?q?Mj7neveqD84GiiSo8QTgpK079CidYOlapKadketw5Ek+zRrrNQB8hEzOh+eMRO7aj?= =?utf-8?q?ljKQoILXXbiXOLvTugIBSStikdoq80QogVNDvbON6o3RrEnabITDBlVIdkTxDSOB1?= =?utf-8?q?IHeGWtcxIfmonqekM2skGAPB4cvWtokgkG4tGyY8DPsvaU4Jc79WGAJR4ckbxaVBr?= =?utf-8?q?FHlwgHweQDG11DntMkJ7vyGymeelxv7qAui6OyK0x/0GZXmRt6B1UZn76Qg9wexbf?= =?utf-8?q?+OozsqZ+VDJlXKwCaWNVIT26QDL4x0YPqkCfCQgSdo5+pT9R+znsdp5m/clOuZfVb?= =?utf-8?q?l8MHOQ+SbTOSK71iNnpai8azg8TN/EM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kB8EoKrcm3bKRWUZDGfvhPkQiRg8wj+sjft?= =?utf-8?q?86p9kQ5hVlWnzBG7hZDp1nd7gHW0jyQkOf+6JPGxdADG/rtw6+aLTGVRew5NpGb1B?= =?utf-8?q?El8rjLFa42MLiHe5RSJCbM9CRpKeUpX0zrOp+jCJV5a4WwPeTkRFMiEq8x6lBuINC?= =?utf-8?q?Jgsoaqigcu6dRONd9w36MyiU/cUpWYHHZJ1XZH+jIWa8D4W2LvCt8eA=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: b5a89d11-db37-493f-be11-08da01c89aba X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2022 12:30:32.8769 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: J5gerJdVjPo/Rqd8NPfXul54Zyu8/jC8XJxBMZvYFJ6gETCGfbsXsYrWIqB/FKGhwoyjjWRol9XC8MGQ3gL1SQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4359 X-OriginatorOrg: citrix.com If livepatching support is enabled build the hypervisor with -f{function,data}-sections compiler options, which is required by the livepatching tools to detect changes and create livepatches. This shouldn't result in any functional change on the hypervisor binary image, but does however require some changes in the linker script in order to handle that each function and data item will now be placed into its own section in object files. As a result add catch-all for .text, .data and .bss in order to merge each individual item section into the final image. The main difference will be that .text.startup will end up being part of .text rather than .init, and thus won't be freed. .text.exit will also be part of .text rather than dropped. Overall this could make the image bigger, and package some .text code in a sub-optimal way. On Arm the .data.read_mostly needs to be moved ahead of the .data section like it's already done on x86, so the .data.* catch-all doesn't also include .data.read_mostly. The alignment of .data.read_mostly also needs to be set to PAGE_SIZE so it doesn't end up being placed at the tail of a read-only page from the previous section. While there move the alignment of the .data section ahead of the section declaration, like it's done for other sections. The benefit of having CONFIG_LIVEPATCH enable those compiler option is that the livepatch build tools no longer need to fiddle with the build system in order to enable them. Note the current livepatch tools are broken after the recent build changes due to the way they attempt to set -f{function,data}-sections. Signed-off-by: Roger Pau Monné Acked-by: Julien Grall # xen/arm Reviewed-by: Jan Beulich --- Changes since v3: - Place .text.page_aligned ahead of the .text.* catch-all. Changes since v2: - Split the placing of the header code in a separate section to a pre-patch. - Move Kconfig option to xen/Kconfig. - Expand reasoning why .data.read_mostly needs to be moved on Arm. Changes since v1: - Introduce CC_SPLIT_SECTIONS for selecting the compiler options. - Drop check for compiler options, all supported versions have them. - Re-arrange section placement in .text, to match the default linker script. - Introduce .text.header to contain the headers bits that must appear first in the final binary. --- It seems on Arm the schedulers and hypfs .data sections should be moved into read_mostly. --- Tested by gitlab in order to assert I didn't introduce any regression on Arm specially. --- xen/Kconfig | 4 ++++ xen/Makefile | 2 ++ xen/arch/arm/xen.lds.S | 41 +++++++++++++++++++++-------------------- xen/arch/x86/xen.lds.S | 11 ++++++----- xen/common/Kconfig | 1 + 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/xen/Kconfig b/xen/Kconfig index bcbd2758e5..d134397a0b 100644 --- a/xen/Kconfig +++ b/xen/Kconfig @@ -27,6 +27,10 @@ config CLANG_VERSION config CC_HAS_VISIBILITY_ATTRIBUTE def_bool $(cc-option,-fvisibility=hidden) +# Use -f{function,data}-sections compiler parameters +config CC_SPLIT_SECTIONS + bool + source "arch/$(SRCARCH)/Kconfig" config DEFCONFIG_LIST diff --git a/xen/Makefile b/xen/Makefile index 5c21492d6f..18a4f7e101 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -273,6 +273,8 @@ else CFLAGS += -fomit-frame-pointer endif +CFLAGS-$(CONFIG_CC_SPLIT_SECTIONS) += -ffunction-sections -fdata-sections + CFLAGS += -nostdinc -fno-builtin -fno-common CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith $(call cc-option-add,CFLAGS,CC,-Wvla) diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S index 743455a5f9..7921d8fa28 100644 --- a/xen/arch/arm/xen.lds.S +++ b/xen/arch/arm/xen.lds.S @@ -36,6 +36,9 @@ SECTIONS *(.text.unlikely .text.*_unlikely .text.unlikely.*) *(.text) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.text.*) +#endif *(.fixup) *(.gnu.warning) @@ -82,10 +85,24 @@ SECTIONS #endif _erodata = .; /* End of read-only data */ + . = ALIGN(PAGE_SIZE); + .data.read_mostly : { + /* Exception table */ + __start___ex_table = .; + *(.ex_table) + __stop___ex_table = .; + + /* Pre-exception table */ + __start___pre_ex_table = .; + *(.ex_table.pre) + __stop___pre_ex_table = .; + + *(.data.read_mostly) + } :text + + . = ALIGN(SMP_CACHE_BYTES); .data : { /* Data */ - . = ALIGN(PAGE_SIZE); *(.data.page_aligned) - *(.data) . = ALIGN(8); __start_schedulers_array = .; *(.data.schedulers) @@ -98,26 +115,10 @@ SECTIONS __paramhypfs_end = .; #endif - *(.data.rel) - *(.data.rel.*) + *(.data .data.*) CONSTRUCTORS } :text - . = ALIGN(SMP_CACHE_BYTES); - .data.read_mostly : { - /* Exception table */ - __start___ex_table = .; - *(.ex_table) - __stop___ex_table = .; - - /* Pre-exception table */ - __start___pre_ex_table = .; - *(.ex_table.pre) - __stop___pre_ex_table = .; - - *(.data.read_mostly) - } :text - . = ALIGN(8); .arch.info : { _splatform = .; @@ -211,7 +212,7 @@ SECTIONS *(.bss.percpu.read_mostly) . = ALIGN(SMP_CACHE_BYTES); __per_cpu_data_end = .; - *(.bss) + *(.bss .bss.*) . = ALIGN(POINTER_ALIGN); __bss_end = .; } :text diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S index 960c51eb4c..4103763f63 100644 --- a/xen/arch/x86/xen.lds.S +++ b/xen/arch/x86/xen.lds.S @@ -87,9 +87,12 @@ SECTIONS *(.text.cold) *(.text.unlikely .text.*_unlikely .text.unlikely.*) + *(.text.page_aligned) *(.text) +#ifdef CONFIG_CC_SPLIT_SECTIONS + *(.text.*) +#endif *(.text.__x86_indirect_thunk_*) - *(.text.page_aligned) *(.fixup) *(.gnu.warning) @@ -292,9 +295,7 @@ SECTIONS DECL_SECTION(.data) { *(.data.page_aligned) - *(.data) - *(.data.rel) - *(.data.rel.*) + *(.data .data.*) } PHDR(text) DECL_SECTION(.bss) { @@ -309,7 +310,7 @@ SECTIONS *(.bss.percpu.read_mostly) . = ALIGN(SMP_CACHE_BYTES); __per_cpu_data_end = .; - *(.bss) + *(.bss .bss.*) . = ALIGN(POINTER_ALIGN); __bss_end = .; } PHDR(text) diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 6443943889..d921c74d61 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -354,6 +354,7 @@ config LIVEPATCH bool "Live patching support" default X86 depends on "$(XEN_HAS_BUILD_ID)" = "y" + select CC_SPLIT_SECTIONS ---help--- Allows a running Xen hypervisor to be dynamically patched using binary patches without rebooting. This is primarily used to binarily