From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mAUS8-0007RT-B0 for mharc-grub-devel@gnu.org; Mon, 02 Aug 2021 05:41:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAUS7-0007Pl-8G for grub-devel@gnu.org; Mon, 02 Aug 2021 05:41:43 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:39123) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mAUS3-0003AZ-JT for grub-devel@gnu.org; Mon, 02 Aug 2021 05:41:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1627897298; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ja9O0KUJkWqMvFmZW/j9Gtc3Ee1GrSXw8RWErp4q3eE=; b=EY9XdfEzdozeM9TAqiw1CRcdp2nJeMaVhPBxE/UnfWvz/skDHG7KdCetbB7ogpTWJIRp7s EKFsBobD8rYrRUFpaQsB1serSzFISri9eMZO8wH7FoK3NpBRg+pGbFdeJOnhn8zBiDdzg0 VD6oMHgDLTeuhk+NHkYgcN4AbAOhkXM= Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2174.outbound.protection.outlook.com [104.47.17.174]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-27-SzkZUI-xOGKR_1-qSjMtGA-1; Mon, 02 Aug 2021 11:41:33 +0200 X-MC-Unique: SzkZUI-xOGKR_1-qSjMtGA-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fpZ3ik+mB48Zj4T1ek2S/0P+hDLC+4wg6PJjTEpTRf43Vsak2QpDUYgu7zU2UQervktTrZ0vA3suUYZu0gQwymJqGGWNxxy7VALe0fO/QvPnUPEjKJIEjTRA++rKSAzSFB9DITPa47C+vTYlNt/IE8DlcSpT4gYR1JiagdykNrhfZoRLVhYfF1zZQkd+vko+iqEPh9a3lklUrHgr21NIzE4xNjU4OhQb4npWUPicUAZTEOtl1Kcazz+V86nKsmTl0epPwTtGrbIUyZ0EIGWnww36DYty6TWHC1+si8NlnC3qyg9HQuME3TEgFApHw+TToCxZhjzgMHoXXSALILXa2w== 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-SenderADCheck; bh=gHKXYADWBQT96QsBo1gPapkiGXVnJFsngCP+GHXB/cg=; b=Oiq5RPjn7J50zjaUg2g+pYqauP6jVs0Z1bTsOw+DvQ3vqaMcLKAmD8sJhmkQqMvAQ2sJKZemHxgRTm1LQM+yrrtKQOeqMifZ6GKFO7TbyNLcQiZpiPadX/pw7li9Z+WpJSu6eZG8KlhpXXwUUHj5UbcGcZ08ndI2/wuw2tFN3I41UkqnpPlJ2QwDWooz7WDlHaOnsyNDq6a+ICId7dYu9xVb30VGl21LJRfNApdkq6M6WOhGwZEqUk8qq5z50Sb6uId45skIxROYjLPhshNXCr1pg8vAybE1Wg7OYI4oFwrIFH3Pq+bGbWb++FmvF2d3GojEcnFEFJpEb30CkFLVhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none;gnu.org; dmarc=none action=none header.from=suse.com; Received: from DU2PR04MB8648.eurprd04.prod.outlook.com (2603:10a6:10:2df::21) by DU2PR04MB8903.eurprd04.prod.outlook.com (2603:10a6:10:2e2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.21; Mon, 2 Aug 2021 09:41:32 +0000 Received: from DU2PR04MB8648.eurprd04.prod.outlook.com ([fe80::245b:a7da:fcc:25a1]) by DU2PR04MB8648.eurprd04.prod.outlook.com ([fe80::245b:a7da:fcc:25a1%5]) with mapi id 15.20.4373.026; Mon, 2 Aug 2021 09:41:32 +0000 From: Michael Chang To: The development of GNU GRUB Subject: [PATCH] Fix build error in binutils 2.36 Date: Mon, 2 Aug 2021 17:41:15 +0800 Message-ID: <20210802094115.19377-1-mchang@suse.com> X-Mailer: git-send-email 2.31.1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-ClientProxiedBy: HK0PR03CA0108.apcprd03.prod.outlook.com (2603:1096:203:b0::24) To DU2PR04MB8648.eurprd04.prod.outlook.com (2603:10a6:10:2df::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost (114.44.49.216) by HK0PR03CA0108.apcprd03.prod.outlook.com (2603:1096:203:b0::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.18 via Frontend Transport; Mon, 2 Aug 2021 09:41:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f32e29d5-5d4f-4286-5b66-08d95599b65b X-MS-TrafficTypeDiagnostic: DU2PR04MB8903: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4joclwlmQdoEks0lcYESkj5in8x8Xcp7FJiqWAgbPca9tZFH0Ye+915uL98vXg398X5c/IpiaWSqAApi2/RACA1dXUQqbADxlXuuoqpeKieQacCn4t+OxNvA4WE3hwLIDQ3x0FIyNRD4mcubuIyYDfgd3bz0i9Mv9DYwM1Wl4D5Czf1pFfkhKm+N1kkgpVEJhdOT1UwzB6PmIKRWwWqT0grI2kxZCXUSOpS2ABuiw7usn7I06/RZRuU3+pfcw7cmQvGk9HG9Xwy2iKp8MAirHfokeTbNVp54Up1VZcKSM0facxd/1pCLBcjtSQb+PU/gSd7xY2pyM5Ddc1oks22/ywHinUAtvfEwPnVs46HqRULNlS6ao4IocXRr2ZhCNKS03x48YOlNZw7n7lqmc39a+AlVHfKRNMH6P35opiaTv64RpraXFvuY/ay+dzQ5D8lC4A9QbpEXoAuk78dTzdvEckcAT+hLyLIUuiTAooA38p/AiMJRmIDeRoFQVl+SS0RDvfNsik+n4VhU1oUqZbpStAPIdNkEwMUei3l86al/gu4wEcR7O355wrA3JrxYczPPttGlu+ZKqMxjORQSeq16uWz3+INYPO9LrqtqbRSsnR0Qne7FaldDWg/j66smTJcG6xy5iM8xPIWTdaqlP8jiHNAxre1EWL7mb1tLgHj1o84pvChpf3Bbh3M26RDSo2ij X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8648.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(136003)(39850400004)(396003)(366004)(346002)(956004)(2616005)(26005)(66946007)(2906002)(5660300002)(6666004)(316002)(83380400001)(478600001)(6916009)(1076003)(6496006)(186003)(8936002)(6486002)(36756003)(8676002)(66556008)(86362001)(38100700002)(66476007)(11716005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?z2Cykw78rJWLdEAfbF1fgc8NpCwsXBYDDsdeB0EpYoRrtjQEtDYXCRP/c+Wu?= =?us-ascii?Q?7e1InbxwUrcZP31JYI+9vXFLrRlTDMPO7fyovEpehN/5KtDYyqpFKS2nT53H?= =?us-ascii?Q?C/xSb1xg9oC2h9+6KeVmn1qL8bujrA8x+EIsJCyW0/W9OV+kyqlKYT8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Kd57GXz9bbqcYHjzLVzIhXbdN5lGz+stN?= =?us-ascii?Q?GrwfkdB34qW6PZYwqoQABm+HrPWL0QsZZtiCAUf4DxxfBJfYxARmH1TrxF+F?= =?us-ascii?Q?1qbLEIagA3evPzQpbJE/0GAWQ8jgVM+iL/SpwgBXHR3aUqc9LTkjRILkRCoV?= =?us-ascii?Q?gpEnc0jAyyvUIEA6URC9LPjwpKi9xqckwb4Fl69I8HvUgHW7GfvHPh7c00QA?= =?us-ascii?Q?aMC0P0ch5z+XfnlF8t0Z/mAcvWfMWfHImtrdZ82Ki1hr50Q3tzcyp3McTdTe?= =?us-ascii?Q?CBXN2pMzVHUv3WigDgKQCsUl?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f32e29d5-5d4f-4286-5b66-08d95599b65b X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8648.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2021 09:41:32.8369 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LLfFSisQbWJk+OOr7ukE8wJt1NHjxmltuYb7p/tnvTFrCGcYIVsIcokHrfDEpdGR X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8903 Received-SPF: pass client-ip=194.104.109.102; envelope-from=mchang@suse.com; helo=de-smtp-delivery-102.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Aug 2021 09:41:43 -0000 The xen build fails on binutils 2.36 with the following error. /usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: section .note.gnu.property VMA [0000000000400158,0000000000400187] overlaps section .bss VMA [000000000000f000,000000000041e1af] The most significant factor is that new assembler (gnu as) generates the .note.gnu.property section as default. This note section overlaps with .bss because it doesn't reposition with -Wl,-Ttext,0 with which the base address of .text section is set, rather the address of .note.gnu.property is calculated for some reason from 0x400000 where the elf executable defaults to start. Using -Ttext-segment doesn't help either, though it is said to set the address of the first byte of the text segment according to "man ld". What it actually does is to override the default 0x400000, aka the image base address, to something else. The entire process can be observed in the default linker script used by gcc [1]. Therefore we can't expect it to achieve the same thing as -Ttext given that the first segment where .text resides is offset by SIZEOF_HEADERS plus some sections may be preceding it within the first segment. The end result is .text always has to start with non-zero address with -Wl,-Ttext-segment,0 if using default linker script. As long as grub didn't use ISA information encoded in .note.gnu.property, we can safely drop it via -Wa,-mx86-used-note=3Dno assembler option to fix the linker error here. [1] In /usr/lib64/ldscripts/elf_x86_64.x or use 'gcc -Wl,--verbose ...' PROVIDE (__executable_start =3D SEGMENT_START("text-segment", 0x400000)); . =3D SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS; Signed-off-by: Michael Chang --- configure.ac | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/configure.ac b/configure.ac index bee28dbeb..cf0a64378 100644 --- a/configure.ac +++ b/configure.ac @@ -836,6 +836,20 @@ if ( test "x$target_cpu" =3D xi386 || test "x$target_c= pu" =3D xx86_64 ) && test "x$p TARGET_CFLAGS=3D"$TARGET_CFLAGS -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -m= no-3dnow" fi =20 +if ( test "x$target_cpu" =3D xi386 || test "x$target_cpu" =3D xx86_64 ); t= hen + AC_CACHE_CHECK([whether -Wa,-mx86-used-note works], [grub_cv_cc_mx86_use= d_note], [ + CFLAGS=3D"$TARGET_CFLAGS -Wa,-mx86-used-note=3Dno -Werror" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], + [grub_cv_cc_mx86_used_note=3Dyes], + [grub_cv_cc_mx86_used_note=3Dno]) + ]) + + if test "x$grub_cv_cc_mx86_used_note" =3D xyes; then + TARGET_CFLAGS=3D"$TARGET_CFLAGS -Wa,-mx86-used-note=3Dno" + TARGET_CCASFLAGS=3D"$TARGET_CCASFLAGS -Wa,-mx86-used-note=3Dno" + fi +fi + # GRUB doesn't use float or doubles at all. Yet some toolchains may decide # that floats are a good fit to run instead of what's written in the code. # Given that floating point unit is disabled (if present to begin with) --=20 2.31.1