[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/build: Fix build failure from LDFLAGS mismatch
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- Date: Tue, 26 Apr 2022 10:20:21 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; 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=tscUQdUglwfema12OFYVNsKYu0QcYLEJLvV9gkBCL6I=; b=AUl0ZpR9tnOpiYuW6PWUDJvwu1TDa3q14wgCDV2RFcuNrM4j3HHxiblDRXJHzuUVKKwpHa6wteY04IHw1DgxMShpRvwZsEGaBp4HvONyuF+dJu+8SH+BoRUGQUvENl0HAImNX1iUTp556pRyoSvrG2KNfsO61reO9amEVQF9FkiJ6deNA9tTh3elM4ezkSb1ztO1G0NZMKSES58A5EfJm8w6uHyNBccBBVqB0hCbdEFP/4qboZMZwVdfXMIL+GkZo0O57WEXpad1j8JUZd3JZqaDMjX7omAh5Oco+Vz+NExM1/GZ4nMsEQpx7xKWXqhqSEDEntvOM8mZTb1RUFQ/7g==
- 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=tscUQdUglwfema12OFYVNsKYu0QcYLEJLvV9gkBCL6I=; b=Dp3NHjnelROHGOMPncnjjDet8Aa527ZLuhq37ODiYAIblUTxmsanRg/6nlZB4RmxoRsda/rNroJZxVaKEOfOJxLlNAO0PmYhQQgDwMMsDRAJZYsN0yvcNK/iW2J4F2igjbE8Z/YkA4YAaGP7eLlewh1x4JLMrqv8+FKq+buKUOny9ftKd3+oxj6UAo6eZgPMHuqCMUPIHD2GVUquCfAEBPQBDQPIGH/u3b3uIYSeIgJlckvqrIffiFV9KEE+uDo4B0CZU3UBMGX7DRWbQ/cCtZYApoKTE9fIW3XFKPNePn0uxcrFH31AyAzzlAvosPwIHaixDbVoW4lAlwUAY2CoPw==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Kdg9zGBmcvBqjhfHXhjdyLyAVYZajORcqlZhqe8DMrlpyHkxxNKTlvON3/beSsXOVW6H8q8UVoCh97wvROlefyIIln1HLI1yLUvLh7f3z1nHfhaqIyf6wkIRox7m6bAkXlhawEwvdd38xqi/u0DHsrsXjL4MXYDKSxYdlKwEAatywdQtIvezQm8RxJQcJHisqeyF7d/Zvw2gfXE6otalwCM/dPIdjfan8vaoAIYJBiezQ1QWN1pPmvgScbLpqPi1u8GZLXaqlDcfYuACYwlmWGT13YCOQd0LlJ/CicwTKRyg3dzp7rGGbE/EKAbepV848gr5rOhGSQVadPJ3vZ77FQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U6a9kgC55y1eKvUZJi3XTAUDo9HFHASGMGhoPCuHKGXgqUflV5SJZG0UXEtZs/Xq0RD0IKS6nezFniyHp0ghicVElVqzAQcE2dslrIhEyp2Rw2sGgXJtSAY0X8dBJGC4Zkbfxi3ZSCokNg2KqWxRtk/CVLb/uoKr42zU+8wSubRkcG+C1bukIo1vN6C2mvc0o1yddqs1xseBLicylW/Z2J2bGDRbXuMupwsMBWGfzKg7C4oT6AD73ganafbMUUYz9Vwp2xZ0H3zPAxNWJELfudyVHXn0QL19bGran6iQn9M7OjRbWISOp4idQ6p3+klKf75n9xsnhpGLD3WpOc0Dww==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Tue, 26 Apr 2022 10:20:46 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHYWPk+OteSOJ5lX0epW57I3+JqnK0B/IQA
- Thread-topic: [PATCH] xen/build: Fix build failure from LDFLAGS mismatch
Hi Andrew,
> On 26 Apr 2022, at 00:06, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
>
> In a GNU compatbile makefile, $(LDFLAGS) are passed to $(CC), not $(LD).
You mean because CC is used for linking or even when compiling object files ?
If not, what is the expected way to pass linker flags ?
>
> In a default CentOS 7 build environment, $(LDFLAGS) is set to -Wl,-z,relro,
> which causes the Xen build to explode with:
>
> ld: unrecognized option '-Wl,-z,relro'
> ld: use the --help option for usage information
>
> It turns out that many downstreams identify this as a breakage in Xen's build
> system and bodge around it in various ways, mostly by unsetting all of
> $(CFLAGS), $(AFLAGS) and $(LDFLAGS).
>
> However, that is a security issue because it means that tools/ is not built
> with the distro-wide hardening flags that are otherwise expected of
> packages (relro, _FORTIFY_SOURCE, stack-protector, etc).
>
> tools/ specifically should honour the packaging environment's choice of flags,
> while xen/ must not pass $(LDFLAGS) to $(LD), and should not be influenced by
> the others either.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>
> CC: Bertrand Marquis <bertrand.marquis@xxxxxxx>
> CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
> CC: Jan Beulich <JBeulich@xxxxxxxx>
> CC: Juergen Gross <jgross@xxxxxxxx>
> CC: Julien Grall <julien@xxxxxxx>
> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> CC: Wei Liu <wl@xxxxxxx>
>
> RFC, because CFLAGS/AFLAGS need nuking too, and they're rather more entangled.
> I expect this to cause some disgreement, but Xen is behaving in a very
> nonstandard way even among embedded projects and all downstreams are suffering
> security problems as a consequence.
> ---
> xen/Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/xen/Makefile b/xen/Makefile
> index ec34524ed21d..a8e1de54823b 100644
> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -254,6 +254,8 @@ export KBUILD_DEFCONFIG := $(ARCH)_defconfig
> # reparsing Config.mk by e.g. arch/x86/boot/.
> export XEN_TREEWIDE_CFLAGS := $(CFLAGS)
>
> +LDFLAGS :=
> +
This would require a comment in the Makefile to explain why this is done.
Also how could anybody specify linker specific flags if this is done ?
Regards
Bertrand
> # CLANG_FLAGS needs to be calculated before calling Kconfig
> ifneq ($(shell $(CC) --version 2>&1 | head -n 1 | grep clang),)
> CLANG_FLAGS :=
> --
> 2.11.0
>
|