From patchwork Wed Dec 12 10:33:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 153566 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1660928ljp; Wed, 12 Dec 2018 02:33:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/Weu2rFTsUJbJ0jnh4hCPDRDo4iQb0aG07t48tyj/ganuqXzViES62r84N5lw6plbgOd3dz X-Received: by 2002:a62:e201:: with SMTP id a1mr19264647pfi.75.1544610799614; Wed, 12 Dec 2018 02:33:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544610799; cv=none; d=google.com; s=arc-20160816; b=EfAe086kxnGCgHrahmfOgSxZRfiu+dAP3RHoxU4OAgVOuGNIJvMnphmwGHg+bde2T8 +jHfI1i4wkneT6WXpxoY/9ISSlYF3pOZnu8fXRek1Lf72YppBcmbM036EFm0cmio7UdR 0r2HgtFLUpRWs70Nmg1YOon3n+gn4s3xs8YdPaE22TKWxQUDQJwqrjOSlZQnGfKUxBR5 RcbsQajzU8UhVwRzxLzzzhQuSMGLiToKBIzwVDAeUpADKGnG1GcmCFceB2XctvzZQ5bG QGxwgpm0O0ThGFjJXhsNQ2Dx0EoS2aD7PWx4wMm0PdaLTLzqgm4ULKdVWx8KIsKyTdr8 XGCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=dWOrLX6zNGPTgZyW1egDKy+mLkK9fvRkFK0N23hVN54=; b=Re7SUsqicidkuqkxQx2zYiHr+nv4bwjO2uFhgHSwSexOQA+bn3U0pZTAYCuedV5Q6c MqaDrDu93mTS9YdDlRqsjZcC7DlPGGlWLj1QRVp35G6JKCGYXbFtHLt9bt3h6wXvEyZ0 BTDdq+eqF8789OgQifrbK2QGFrn807/wmDFu2pjOivIWSuPOWdtrHEH2MHX8zWCkp9ve CVh2lR0NG1/jKt5UGWI1s1Tt/WJ3LprrZE+GsKtul/e11JrZrO/r8Qbv51j2Ro2iIzZA MZ+lm+eto0KQDUd1WUzHlv22R+ZMDdi1rhmHk0fFwGX9KvCfMCzEm8MfacoejHJ4x6ex QIcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=if3Jb4NW; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id w2si15793943pfg.78.2018.12.12.02.33.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 02:33:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=if3Jb4NW; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 564FE2119C8AB; Wed, 12 Dec 2018 02:33:17 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E66BB2119C8A5 for ; Wed, 12 Dec 2018 02:33:15 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id 96so17152187wrb.2 for ; Wed, 12 Dec 2018 02:33:15 -0800 (PST) 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=SNseYEtJ23oXEgtEGSjVklBNFSugpUppUFHH6JAiuds=; b=if3Jb4NWc0MeFM4rPeI9DwwHVpO9bYkpqlF82YXquLfXPG72ooCml79bu4JPrDIRnE 0f3gPZIRO5Ttg+QHsybuCQfTzO8oFa6xymNUeBFHIwo8r/wmNHg0bBevWGtXVk3F4OGW buYFqxTTcR8GG4YRDNhCN2EXAPUE4Qa9k7hGA= 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=SNseYEtJ23oXEgtEGSjVklBNFSugpUppUFHH6JAiuds=; b=WfewhDlLh5WMOpTy1Koq2SLvpwnICRSjYlU6tKGFbMJvJMpuBzPt8y7zFW0NpQ/1ju qHrQ3PYzweCb+kOdMllgizxp9kvPYXMi2HNKku831KW8LzZG151+9nsTOctooqjNK/+K twRkXlV7CO2g361VeV8fSO5CJlpJCEZ1PpczgmhhH9dJXMuSfj2yHlAdWxHREGyEYbV8 pb+9szlV0o+01cJTZS+Q2iNGs8gmOObxkuJmSzM5n+W+85W5s6bBXguQPrybeoLLUJnE yOInBLKZqpsIu5NFKpE6jvmkG2JRzx7fwSlhpzs2r0PFnImmXsJm/KuB/9RQfZKHfGGJ RMEg== X-Gm-Message-State: AA+aEWYkg4MfgxqOHoFqQbo11TbpXvjrMMBO+D6suiBQRpyobESocDdr SGQmsXqfzEV9W64USISYmiD6LySJ9Nm/wg== X-Received: by 2002:adf:a393:: with SMTP id l19mr17156651wrb.110.1544610794093; Wed, 12 Dec 2018 02:33:14 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:1db:abd7:f798:3277]) by smtp.gmail.com with ESMTPSA id r69sm3132789wmd.4.2018.12.12.02.33.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 02:33:13 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 12 Dec 2018 11:33:07 +0100 Message-Id: <20181212103308.8099-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181212103308.8099-1-ard.biesheuvel@linaro.org> References: <20181212103308.8099-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Subject: [edk2] [PATCH 2/3] BaseTools/tools_def ARM CLANG35: work around -mno-movt option name change X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao , Michael D Kinney , Laszlo Ersek Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" PE/COFF only has a very limited id space for runtime relocations, and so it defines only a single relocation for movw/movt instruction pairs, which can be combined to load a 32-bit symbol reference into a register. For this to work as expected, these instructions must always appear in the same order and adjacently, and this is something few compilers take into account, unless they target PE/COFF explicitly (and this is not the case for our ELF based toolchains) For Clang 3.6 and later, we can pass the -mno-movt option to suppress movw/movt pairs entirely, which works around the issue. Unfortunately, for Clang 3.5, the option is called differently (-mllvm -arm-use-movt=0) and mutually incompatible between 3.5 and 3.6. Since it is desirable for the CLANG35 toolchain to be usable on newer versions of Clang as well (given that it is the only non-LTO alternative to CLANG38), let's work around this issue in a way that permits versions 3.5 and newer of Clang to be used with the CLANG35 profile. So pass the -mkernel flag instead (and drop the -mno-unaligned-access in *_CLANG35_ARM_CC_XIPFLAGS which now becomes redundant, and which Clang complains about). This also inhibits movw/movt generation, along with some other changes (e.g., long calls) which do affect code generation but not in a undesirable manner. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BaseTools/Conf/tools_def.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Acked-by: Laszlo Ersek Reviewed-by: Leif Lindholm diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index ac2b95e0f5ba..2ba833e1fb06 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -5249,7 +5249,7 @@ DEFINE CLANG35_AARCH64_CC_FLAGS = DEF(GCC_AARCH64_CC_FLAGS) DEF(CLANG35_AARCH64 *_CLANG35_ARM_ASM_FLAGS = DEF(GCC_ASM_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) -Qunused-arguments *_CLANG35_ARM_DLINK_FLAGS = DEF(CLANG35_ARM_TARGET) DEF(GCC_ARM_DLINK_FLAGS) *_CLANG35_ARM_DLINK2_FLAGS = DEF(GCC_DLINK2_FLAGS_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 -*_CLANG35_ARM_PLATFORM_FLAGS = -march=armv7-a +*_CLANG35_ARM_PLATFORM_FLAGS = -march=armv7-a -mkernel -Qunused-arguments *_CLANG35_ARM_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) *_CLANG35_ARM_RC_FLAGS = DEF(GCC_ARM_RC_FLAGS) *_CLANG35_ARM_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG35_ARM_TARGET) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS)