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 C72E6D3B7E2 for ; Mon, 8 Dec 2025 23:01:14 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1181157.1504250 (Exim 4.92) (envelope-from ) id 1vSkDp-0003re-SO; Mon, 08 Dec 2025 23:00:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1181157.1504250; Mon, 08 Dec 2025 23:00:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vSkDp-0003rX-Pi; Mon, 08 Dec 2025 23:00:49 +0000 Received: by outflank-mailman (input) for mailman id 1181157; Mon, 08 Dec 2025 23:00:48 +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 1vSkDo-0003rR-EK for xen-devel@lists.xenproject.org; Mon, 08 Dec 2025 23:00:48 +0000 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azlp170100005.outbound.protection.outlook.com [2a01:111:f403:c005::5]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ba735f2b-d489-11f0-b15b-2bf370ae4941; Tue, 09 Dec 2025 00:00:46 +0100 (CET) Received: from CH3P220CA0011.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:1e8::26) by DM6PR12MB4387.namprd12.prod.outlook.com (2603:10b6:5:2ac::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9388.14; Mon, 8 Dec 2025 23:00:39 +0000 Received: from DS2PEPF00003445.namprd04.prod.outlook.com (2603:10b6:610:1e8:cafe::aa) by CH3P220CA0011.outlook.office365.com (2603:10b6:610:1e8::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9388.14 via Frontend Transport; Mon, 8 Dec 2025 23:00:35 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by DS2PEPF00003445.mail.protection.outlook.com (10.167.17.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9412.4 via Frontend Transport; Mon, 8 Dec 2025 23:00:39 +0000 Received: from satlexmb08.amd.com (10.181.42.217) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Mon, 8 Dec 2025 17:00:38 -0600 Received: from [172.29.90.244] (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.17 via Frontend Transport; Mon, 8 Dec 2025 15:00:37 -0800 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: ba735f2b-d489-11f0-b15b-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nVHoineSCpGhZmWYIj7Z+zT0TeRHQ3EapA7kWEkli3LbEt/YgeE2yVCXUKJNJYk8RqTsGOx6OiZd7Iif39y79ubeuaKwVQSKNd1lMxpRFiMr2JhGOgk8ttoIFCENaOiDmT7wmpok9MGEz78ZnnP0NoN/2g5cCMAH7aA0/CYVTvxNIX/UF1cG0ITmkx81cIcFEF7hK6773bzJKcHZrjYEO2BUS4oZVuSg6NMJ11mnn9GIvVoqtxo7ICe6iZiYC8hKN1wP3GlTvKvVSbq896AzX2vZO4lI78yVn5+WeYph3rpbJq+vV5fw7xLJZefAgkOczkfGDXUdq9HbYD/WXIJLGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1n+5BTEIBK43FX2PyPfouKdwJV5ikhIWV/5npraqfv4=; b=GFY0w9pqCqyy3m4PA2BCB9ZOu5cPAjXjxcDmQ/MvNZzlqOgDM5V1rfDjPHvqDNI1MivECpIQwMRUEzLgt2VldsNemesTO0un+jBcEVt/5LlTGlSyrd2j9m7LyJr/gXzjaSJNy1ov9G4od4MgkZ/JJuO3ArgWnMwLWo7Lpbazl6EYNmG3hDFDUmCVi7nRCwNmEiJkjZpJVyLqxndYuw4SRqYvFAfxHQImptxO2UfrjvBoK+7u0vFJwqf9ahVknGP6DcNi9J6LBQt734VYPVwexBhJcqBcWOj/JHvlGDF01uPx/SlyBWV3GPVM8QvEWBLB75QTRtstzUcVLTIJMUc7hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1n+5BTEIBK43FX2PyPfouKdwJV5ikhIWV/5npraqfv4=; b=R+Jz0FbEqgaSKfebY+U7fcUn9e6C75L9s7MbGtMW6T9LsiOxT7zZQqQOML2h1yPO+o2AAVC0yHWkscIXKMK3EtOwf1RARpQc+RPPGHVbbSzhmgI3TvKWEVu2IBQw8RdPGc1if7MEz9QiZoo5M9yWW4ZPozfNsis4R/QtTLpLTuo= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Message-ID: <1675a966-1095-4aba-af74-828e4c68e6b4@amd.com> Date: Mon, 8 Dec 2025 18:00:35 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] RFC: xen/x86: Enable --gc-sections To: Jan Beulich CC: Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Grygorii Strashko" , References: <20251205222813.277164-1-jason.andryuk@amd.com> <6c10dbc4-3247-4a0d-9953-858d09df08a9@suse.com> Content-Language: en-US From: Jason Andryuk In-Reply-To: <6c10dbc4-3247-4a0d-9953-858d09df08a9@suse.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS2PEPF00003445:EE_|DM6PR12MB4387:EE_ X-MS-Office365-Filtering-Correlation-Id: 0442488e-7c53-4fec-62ae-08de36ad9b11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MEJ2cVZaeW5aTWN4YmdhNG5YMkcyNWg4aVZScVQrRmVoQlFvVXpPY2tQWWhD?= =?utf-8?B?amV2QzgzemVna1FrdjVwbFVsazk1SWE1V1RkM091Sk1VdXJmSVFqY1h1bzBH?= =?utf-8?B?TzU1c0JsN2RDWDlkWjUxZ3pFWXoxZ2ZHMXR6eFR0K1NLUXR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bEdxZkpaeCtMT0xHWnIyR1ZncnBKb3Vz?= =?utf-8?B?UTlnV2hPL2x4OEEvOHlibU1oU1NEeXRSMldKaTl5bmtNY08zQ3RiVEVEV3lL?= =?utf-8?B?UGJVa2hqbzhEeWFaam9EOGliWjB6cnVOaW0xU2dJaWlGakJFWmlUTTM3TzBw?= =?utf-8?Q?CKd4=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2025 23:00:39.1237 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0442488e-7c53-4fec-62ae-08de36ad9b11 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS2PEPF00003445.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4387 On 2025-12-08 03:56, Jan Beulich wrote: > On 05.12.2025 23:28, Jason Andryuk wrote: >> When linking to create xen-syms, add --gc-sections to garbage collect >> unused stuff. > > What about xen.efi? I tried briefly and it fails to link. The GCC manual says it is considered experimental for PE and COFF. I just added into EFI_LDFLAGS: CC .xen.efi.0s.o ld -mi386pep --no-warn-rwx-segments --subsystem=10 --enable-long-section-names --disable-high-entropy-va --dynamicbase --image-base=0xffff82d040000000 --stack=0,0 --heap=0,0 --section-alignment=0x200000 --file-alignment=0x20 --major-image-version=4 --minor-image-version=22 --major-os-version=2 --minor-os-version=0 --major-subsystem-version=2 --minor-subsystem-version=0 --gc-sections --print-gc-sections --build-id=sha1 -T arch/x86/efi.lds prelink.o ./.xen.efi.0s.o -b pe-x86-64 arch/x86/efi/buildid.o -o ./.xen.efi.0xffff82d040000000.0 && : ld: kexec_reloc is too large ld: kexec_reloc is too large ld: prelink.o:/home/jandryuk/xen/xen/arch/x86/boot/head.S:60:(.text.header+0x48): undefined reference to `start' >> Relies on CONFIG_CC_SPLIT_SECTIONS > > Yet still ... > >> --- a/xen/arch/x86/Makefile >> +++ b/xen/arch/x86/Makefile >> @@ -137,18 +137,21 @@ $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds >> $(objtree)/tools/symbols $(all_symbols) --empty > $(dot-target).0.S >> $(MAKE) $(build)=$(@D) $(dot-target).0.o >> $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ >> + --gc-sections \ > > ... you pass the option unconditionally. Which may be fine from a functional > perspective (little if anything will be saved), but besides being a little > inconsistent with the description I also wonder whether the option won't have > unwanted side effects (longer linking time, bigger working set). > >> $(dot-target).0.o -o $(dot-target).0 >> $(NM) -pa --format=sysv $(dot-target).0 \ >> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort \ >> > $(dot-target).1.S >> $(MAKE) $(build)=$(@D) $(dot-target).1.o >> $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ >> + --gc-sections \ >> $(dot-target).1.o -o $(dot-target).1 >> $(NM) -pa --format=sysv $(dot-target).1 \ >> | $(objtree)/tools/symbols $(all_symbols) --sysv --sort $(syms-warn-dup-y) \ >> > $(dot-target).2.S >> $(MAKE) $(build)=$(@D) $(dot-target).2.o >> $(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds $< $(build_id_linker) \ >> + --gc-sections \ >> $(orphan-handling-y) $(dot-target).2.o -o $@ >> $(NM) -pa --format=sysv $@ \ > > Rather than having to alter three locations (plus another three for xen.efi, > plus another three for every other architecture that would want to follow > suit), should we perhaps introduce $(XEN_FINAL_LDFLAGS) or some such? That > could then have --gc-sections conditionally upon CONFIG_CC_SPLIT_SECTIONS. Yes, I thought something like thiat would be better after posting. > I further wonder whether the use of the option wouldn't want gating by its > own Kconfig control (dependent upon CC_SPLIT_SECTIONS). If nothing else than > to have an easy workaround if either we had a usage bug (e.g. a missing > KEEP() somewhere in a linker script) or there was a related bug in the > linker that we end up being affected by. Makes sense. Thanks, Jason