From patchwork Wed Dec 6 10:59:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13481535 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 22B87C10DC1 for ; Wed, 6 Dec 2023 11:00:08 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.649087.1013422 (Exim 4.92) (envelope-from ) id 1rApd8-0005gc-I0; Wed, 06 Dec 2023 10:59:50 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 649087.1013422; Wed, 06 Dec 2023 10:59:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rApd8-0005gV-FO; Wed, 06 Dec 2023 10:59:50 +0000 Received: by outflank-mailman (input) for mailman id 649087; Wed, 06 Dec 2023 10:59:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rApd6-0005P8-IU for xen-devel@lists.xenproject.org; Wed, 06 Dec 2023 10:59:48 +0000 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [2a00:1450:4864:20::441]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 917a1df6-9426-11ee-9b0f-b553b5be7939; Wed, 06 Dec 2023 11:59:46 +0100 (CET) Received: by mail-wr1-x441.google.com with SMTP id ffacd0b85a97d-3316a4bc37dso583898f8f.2 for ; Wed, 06 Dec 2023 02:59:46 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id e14-20020a5d500e000000b003335e67e574sm3128483wrt.78.2023.12.06.02.59.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Dec 2023 02:59:45 -0800 (PST) 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: 917a1df6-9426-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1701860386; x=1702465186; darn=lists.xenproject.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=kQzh/kxGUddWCVZoEBZkMTbc+8tsnObi8hKwzMBGVLs=; b=M6460PYJoWbrheQolC4RFoN9P/v4QcSoG8DBQAsigZKwSX6Xr8nB4UaIgopIRK6ork +3RLQETBYatavG+MiWZdPPjZaofGE/X/8TQAnh79Gr0mFxf1nN1QyPEZOnd91CQZeRJR cBQY1v22XMeuhKZEAAvzzgl901IE21dKm/q08PXIAqAFSgxhxFFyXUhCySJHVlqWeNC4 fDVQuPcUm0v9kglbEhr4peLmA2X+uKCbvfeWK4hceXVeBkwSpiDJNGlj+GINT/KkclfI PNZJ/Z2LAlTgylwp5wqU/+jCEwjTG13wKG60Lkj8gokVormah8x9cMcPg2yjV5tT255h bHlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701860386; x=1702465186; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kQzh/kxGUddWCVZoEBZkMTbc+8tsnObi8hKwzMBGVLs=; b=o2rM5VBoMYAbchiAVnHnIlLzWGamAbOteLgKUNrhtGOWP81VIx0n+qK9xk3ZBH91Sq JKTDQDlp8td7IP+sZH8RablEmfRD/Qckrq6Oig/FTa1ftDLBPVIIlzMByS8+FTOR42su BunnP6jlkkbzXl5MRqIS97jSh1FJ8AjEpdoMWE2Yx1C2KcHN/jgkfVjBmI+1K0TpKvV6 iFhIn2LgEdHPnN+4pFSU6b6untsZMXpzM3HEznX8mTEgdogK2PaN8jp/i2iCTYu1mb9L uasstHedHqdw0xclrm+eB3HC5wcl/om1e2Q/TW9fXTDUKRv8CY856215sWVmTuImBZd1 YckQ== X-Gm-Message-State: AOJu0Yx4B6u1Fnzxb84okttdHtYSa3C0w08YeToCmH4axVvJfJ9y8F3n 1pfoDBDphFrHy+ji637uP8RI X-Google-Smtp-Source: AGHT+IGyZ33jlUkPxViD/67EWyw7B79AGxXiIPkSRaqEpOnr3iUC6WneacxN69W15RRxjfEvtQuyEg== X-Received: by 2002:adf:fe8a:0:b0:333:2fd2:4aff with SMTP id l10-20020adffe8a000000b003332fd24affmr292524wrr.123.1701860386139; Wed, 06 Dec 2023 02:59:46 -0800 (PST) Message-ID: <8ec8031a-65bb-4b1b-8964-8c457e04b4b4@suse.com> Date: Wed, 6 Dec 2023 11:59:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Minios-devel Cc: Samuel Thibault , Wei Liu , Juergen Gross , "xen-devel@lists.xenproject.org" From: Jan Beulich Subject: [PATCH mini-os] x86: fix building with Clang Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3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bg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL It doesn't understand -fno-reorder-blocks. Whether without that option the resulting binary is actually functional I can't tell, though. For $(cc-option ...) to be usable in arch.mk, at least CC needs setting earlier in Config.mk. Move up the entire "Set tools" section. Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross --- Observed with Clang7, but then checked option (un)availability with godbolt.org. With Clang5 there's further breakage, due to apparently deliberate de- referencing of NULL in lib/xmalloc.c (poor man's BUG(), as it looks). The compiler's -Wnull-dereference causes a warning to be issued there, converted to an error by -Werror. Question is whether building with Clang5 is supposed to work. --- a/Config.mk +++ b/Config.mk @@ -86,6 +86,33 @@ TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FA export TARGET_ARCH_DIR export TARGET_ARCH_FAM +# Set tools +AS = $(CROSS_COMPILE)as +LD = $(CROSS_COMPILE)ld +ifeq ($(clang),y) +CC = $(CROSS_COMPILE)clang +LD_LTO = $(CROSS_COMPILE)llvm-ld +else +CC = $(CROSS_COMPILE)gcc +LD_LTO = $(CROSS_COMPILE)ld +endif +CPP = $(CC) -E +AR = $(CROSS_COMPILE)ar +RANLIB = $(CROSS_COMPILE)ranlib +NM = $(CROSS_COMPILE)nm +STRIP = $(CROSS_COMPILE)strip +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump +SIZEUTIL = $(CROSS_COMPILE)size + +# Allow git to be wrappered in the environment +GIT ?= git + +INSTALL = install +INSTALL_DIR = $(INSTALL) -d -m0755 -p +INSTALL_DATA = $(INSTALL) -m0644 -p +INSTALL_PROG = $(INSTALL) -m0755 -p + # This is used for architecture specific links. # This can be overwritten from arch specific rules. ARCH_LINKS = @@ -119,33 +147,6 @@ DEF_CPPFLAGS += -isystem $(LWIPDIR)/src/ DEF_CPPFLAGS += -isystem $(LWIPDIR)/src/include/ipv4 endif -# Set tools -AS = $(CROSS_COMPILE)as -LD = $(CROSS_COMPILE)ld -ifeq ($(clang),y) -CC = $(CROSS_COMPILE)clang -LD_LTO = $(CROSS_COMPILE)llvm-ld -else -CC = $(CROSS_COMPILE)gcc -LD_LTO = $(CROSS_COMPILE)ld -endif -CPP = $(CC) -E -AR = $(CROSS_COMPILE)ar -RANLIB = $(CROSS_COMPILE)ranlib -NM = $(CROSS_COMPILE)nm -STRIP = $(CROSS_COMPILE)strip -OBJCOPY = $(CROSS_COMPILE)objcopy -OBJDUMP = $(CROSS_COMPILE)objdump -SIZEUTIL = $(CROSS_COMPILE)size - -# Allow git to be wrappered in the environment -GIT ?= git - -INSTALL = install -INSTALL_DIR = $(INSTALL) -d -m0755 -p -INSTALL_DATA = $(INSTALL) -m0644 -p -INSTALL_PROG = $(INSTALL) -m0755 -p - BOOT_DIR ?= /boot SOCKET_LIBS = --- a/arch/x86/arch.mk +++ b/arch/x86/arch.mk @@ -14,7 +14,8 @@ EXTRA_SRC += arch/$(EXTRA_INC) endif ifeq ($(MINIOS_TARGET_ARCH),x86_64) -ARCH_CFLAGS := -m64 -mno-red-zone -fno-reorder-blocks +ARCH_CFLAGS := -m64 -mno-red-zone +ARCH_CFLAGS += $(call cc-option,$(CC),-fno-reorder-blocks) ARCH_CFLAGS += -fno-asynchronous-unwind-tables ARCH_ASFLAGS := -m64 ARCH_LDFLAGS := -m elf_x86_64