From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Mc2jNW6w; spf=pass (domain: linaro.org, ip: 209.85.221.66, mailfrom: ard.biesheuvel@linaro.org) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by groups.io with SMTP; Fri, 31 May 2019 05:50:14 -0700 Received: by mail-wr1-f66.google.com with SMTP id h1so6463221wro.4 for ; Fri, 31 May 2019 05:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a7sWnUDzwmi03LTX1Db8uuOKn5dAL6Qd0grMmDiM24c=; b=Mc2jNW6wrQ2LZHYT5s8C4OfLXSCdP6Djvw8bgwWSs26poPWFda1muCfq8j14erHNLK CsFUgRkzxqoQEQ0Tgq0G9aKkwhze8ThzpY5AVpqyoEfIozvKh5iGWE+QSBxYBi+4aAoS +P86hENS8IIyC3VrOFz2cdVrgMXPdGHYNvgtG9ISYA7KwWzckWO3IO4jMQjW0Me6jko3 icP0WuUbUv/k6FuYYe20D8sBb935YTECH9Uh4EkD5gqdEgOeWkfbdJpVGAkXejnWoGag YwLdFAkVXbK4pziiw9AGAiu2jYRDTwMI/wAanv9EytXwydXGiBl4Y/X15OIyjMXxHwTw gBMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a7sWnUDzwmi03LTX1Db8uuOKn5dAL6Qd0grMmDiM24c=; b=H3q9jHsd3qxBp4Slq4cMozPTNh82BVXtfv7j7oglD28IZLrDZ+yLOBPrvUeHQ36RPp vV3cKC8sQgYhvS78S7X97eZk7a5PAnBcOBMmhx6sjOBR5M431lyTOsyOI1r7BUr/brbZ 8Lfzu69POLktI/zUo+tkIssPU8SWXfYD0SpSpERwAkq+riWLO66BKAsLr8walIcELUMh wWGczzQK260nSKbUu/8ztCvF0je1yGnj+ly3pHNcxnqnMfjJ2iotTEvZzP75x7YG4MwL 3FyXA6vVmVP50VMVyYaIxb2Wi5xdbYJYHBUw0hxAkxtVl4lx8pjFBu6attcwfkuGfDR1 ERtw== X-Gm-Message-State: APjAAAWIaJF/QkL1FWHJlEhpVzWXgjElZHviO7/7BIrBwBIygJccxl0w P5GqdU69CGeuUkRmL7DoX0y8D67zeis= X-Google-Smtp-Source: APXvYqzS928pHiYgBI/h0K20N++PnnUXXvJCPHWR/SH2B1lTYkvws9805pYdt28PCdPeoBydgBTvgg== X-Received: by 2002:adf:c541:: with SMTP id s1mr972254wrf.44.1559307012756; Fri, 31 May 2019 05:50:12 -0700 (PDT) Return-Path: Received: from sudo.home ([2a01:cb1d:112:6f00:c225:e9ff:fe2e:ea8]) by smtp.gmail.com with ESMTPSA id b9sm6385076wma.29.2019.05.31.05.50.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 31 May 2019 05:50:11 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Laszlo Ersek , "Gao, Liming" , "Wang, Jian J" , Leif Lindholm , Michael D Kinney Subject: [PATCH v3 4/7] BaseTools/tools_def CLANG3x ARM AARCH64: force use of C99 standard Date: Fri, 31 May 2019 14:49:55 +0200 Message-Id: <20190531124958.8421-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190531124958.8421-1-ard.biesheuvel@linaro.org> References: <20190531124958.8421-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When building OpenSSL for ARM or AARCH64 with recent Clang, the following error may result: In file included from .../CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7VerifyEku.c:18: In file included from .../CryptoPkg/Library/OpensslLib/openssl/crypto/include/internal/x509_int.h:10: In file included from .../CryptoPkg/Library/OpensslLib/openssl/include/internal/refcount.h:21: In file included from /usr/lib/llvm-7/lib/clang/7.0.1/include/stdatomic.h:35: In file included from /usr/lib/llvm-7/lib/clang/7.0.1/include/stdint.h:61: /usr/include/stdint.h:26:10: fatal error: 'bits/libc-header-start.h' file not found #include ^~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. This is caused by the fact that the refcount.h header includes compiler headers that in turn rely on system headers, which we don't support. Since the C native atomics are a C11 feature, let's explicitly use the C99 standard instead to work around this issue, and add the -ffreestanding option so that the compiler never attempts to include system headers. Acked-by: Laszlo Ersek Signed-off-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 26a2cf604f74..f1467d5e8cef 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -2280,8 +2280,8 @@ DEFINE CLANG35_ARM_TARGET = -target arm-linux-gnueabi DEFINE CLANG35_AARCH64_TARGET = -target aarch64-linux-gnu DEFINE CLANG35_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unknown-warning-option -DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) DEF(CLANG35_WARNING_OVERRIDES) -DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES) +DEFINE CLANG35_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG35_ARM_TARGET) DEF(CLANG35_WARNING_OVERRIDES) -std=c99 -ffreestanding +DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64_TARGET) -mcmodel=small DEF(CLANG35_WARNING_OVERRIDES) -std=c99 -ffreestanding ################## # CLANG35 ARM definitions @@ -2430,7 +2430,7 @@ NOOPT_CLANG38_X64_DLINK2_FLAGS = DEF(GCC5_X64_DLINK2_FLAGS) -O0 # CLANG38 ARM definitions ################## DEFINE CLANG38_ARM_TARGET = -target arm-linux-gnueabi -DEFINE CLANG38_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt +DEFINE CLANG38_ARM_CC_FLAGS = DEF(GCC_ARM_CC_FLAGS) DEF(CLANG38_ARM_TARGET) DEF(CLANG38_WARNING_OVERRIDES) -mno-movt -std=c99 -ffreestanding DEFINE CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS) *_CLANG38_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) @@ -2474,7 +2474,7 @@ RELEASE_CLANG38_ARM_DLINK_FLAGS = DEF(CLANG38_ARM_DLINK_FLAGS) -flto -Wl,-O3 -L # CLANG38 AARCH64 definitions ################## DEFINE CLANG38_AARCH64_TARGET = -target aarch64-linux-gnu -DEFINE CLANG38_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES) +DEFINE CLANG38_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG38_AARCH64_TARGET) -mcmodel=small DEF(CLANG38_WARNING_OVERRIDES) -std=c99 -ffreestanding DEFINE CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH64_DLINK_FLAGS) -z common-page-size=0x1000 *_CLANG38_AARCH64_PP_FLAGS = DEF(GCC_PP_FLAGS) -- 2.20.1