From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=leif.lindholm@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 179D92119BBD4 for ; Wed, 12 Dec 2018 04:34:49 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id z5so17496476wrt.11 for ; Wed, 12 Dec 2018 04:34:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gpDZmFyjHwkn0rRBrGAxM9GMQlXJQ2P3Z9rdechu64g=; b=abRqmtjRXrcp8eOtv9wRpCkJhatzwTucskRfeNeeSXFxrW512l4aTwbHffuMTIyvF6 rIuw0n+XfugrKwqpAehiRpWa+x2zA/chcULmtGli+2G2+ZJ2yiePej9MElNtdPOs5KAe 5tnTmIy4l+BnH2+H1MmdzArUlT2lfEnY/hWX0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gpDZmFyjHwkn0rRBrGAxM9GMQlXJQ2P3Z9rdechu64g=; b=BQs8srNK8xM3LaQW6MpczlyHFRpBh2qLlN+BEDGiObE5z0T5LGFMDcZHsNecSAN0Mi aKJCqSDSZcAfMNkLQr88b4ycmdLlDbgvVzMvUlWraddLBK1fNZxvmn0fZlwZQZht0Ttb 4xCPw5/QauO6Mpj/eukvhCJ2pZJNcMavG5wY0oYLP14+JuW7iTDfF9dLGUKApX2wgNhf JbU87SiPLeWEU+UwTBqo9v4/UgWgF+O+s+4Il6gKE3iDHtQXEnqqnhmFWjreLp79fLfr PbkJnQu5XOveKhGejthW3uWxsUZP2EBvwXPIaT1uT46HaBFbyr53Nr+V1c62V2NBLh2M 6oRw== X-Gm-Message-State: AA+aEWY+4SiuF0gUbbksWbEGZo/WDGmeM7o6ocgJXsB8Kieq9Jzd1Q1l J9fgJ4/2bvmnfMMH0zxkT99+5w== X-Google-Smtp-Source: AFSGD/Ue4buEZz0XarhN35r3NDf71LNNZkXdjwqrlEB/1GgO09sWJ04BlZd2cllVTQ5uj6FbKLzZcA== X-Received: by 2002:a5d:43d0:: with SMTP id v16mr18349460wrr.67.1544618088188; Wed, 12 Dec 2018 04:34:48 -0800 (PST) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id r77sm4682506wmd.22.2018.12.12.04.34.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Dec 2018 04:34:47 -0800 (PST) Date: Wed, 12 Dec 2018 12:34:45 +0000 From: Leif Lindholm To: Ard Biesheuvel Cc: "edk2-devel@lists.01.org" , "Kinney, Michael D" , "Gao, Liming" , "Feng, Bob C" , Laszlo Ersek Message-ID: <20181212123445.5eiorfzvriovrjzl@bivouac.eciton.net> References: <20181212103308.8099-1-ard.biesheuvel@linaro.org> <20181212103308.8099-3-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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: , X-List-Received-Date: Wed, 12 Dec 2018 12:34:50 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Dec 12, 2018 at 01:30:10PM +0100, Ard Biesheuvel wrote: > On Wed, 12 Dec 2018 at 11:33, Ard Biesheuvel wrote: > > > > 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(-) > > > > 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 > > Alternatively, we could switch to armv6 code generation here (except > for the .S pieces which us Thumb2 instructions), which also gets rid > of the movw/movt pairs. Please don't. For the version Laszlo is happy with: Reviewed-by: Leif Lindholm / Leif > > *_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) > > -- > > 2.19.2 > >