From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (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 555651A1DF2 for ; Wed, 17 Aug 2016 04:42:49 -0700 (PDT) Received: by mail-it0-x233.google.com with SMTP id e63so58472885ith.1 for ; Wed, 17 Aug 2016 04:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xgD/cgnVyK95TXGPcj9hzSRUDt7wZE38zeCl036Nlbg=; b=UVZytUruYoDJXshp9qaqVjjSnt7pFvLUVP1teRLOtxdIcJEVMKkfV2KDk7yr5EXxPw gVJb9wHJ3XfbOLC/POPzKTzINlZF2EzJKfiYcMjDI6klJ/AVt3GwtPzFDDQoAMhaZsi9 0akSpFRElybkkOypMBBNQYlt4zzpW0j47NMTY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xgD/cgnVyK95TXGPcj9hzSRUDt7wZE38zeCl036Nlbg=; b=I5Mt5J1ZonCw9c0wJhlukvgMO2h9xHj6NthA2uFCmpbKbrhyfu+rjaMgTgt/Q4h1yW vUBtW7VPLxP9YCFs2pdTZrDH5IwV6hWRWj0GaQo4v6lLW4dSmtfzvb8w2H18LO9WzLC/ vWsF+WTQybOg/6Lt3laVW1QROU+zxutKAvo3mu51pOIpCS6hjxxyGRTPqbL7k4ncVtMH INPwuWOENnc42BF+yt2uRYQTA6l6hkrfG4BYPWDCTckdMfCD1ZmhpcnqK3c8C+35YKSB EY3/DR4sF4ltWljUfG9ye7xLM7d/QFPf3X6nHX6X7NjvN4W5hzRWIgtE2BhPbj6qXW79 2n5g== X-Gm-Message-State: AEkoousRPO6hAy3j91e7FiYi99bCOBeTngvXo5VwIBuY8vXnyZRGg/i5F4+S9tvJJ9qNSk3/NglJs4SllTs3M7FU X-Received: by 10.36.57.215 with SMTP id l206mr28894405ita.5.1471434168329; Wed, 17 Aug 2016 04:42:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.204.195 with HTTP; Wed, 17 Aug 2016 04:42:47 -0700 (PDT) In-Reply-To: <06C8AB66E78EE34A949939824ABE2B310338D619@shsmsx102.ccr.corp.intel.com> References: <1470148772-15712-1-git-send-email-ard.biesheuvel@linaro.org> <1470148772-15712-4-git-send-email-ard.biesheuvel@linaro.org> <06C8AB66E78EE34A949939824ABE2B310338D619@shsmsx102.ccr.corp.intel.com> From: Ard Biesheuvel Date: Wed, 17 Aug 2016 13:42:47 +0200 Message-ID: To: "Shi, Steven" Cc: "sigmaepsilon92@gmail.com" , "Zhu, Yonghong" , "Gao, Liming" , "Justen, Jordan L" , "edk2-devel@lists.01.org" , "leif.lindholm@linaro.org" , "afish@apple.com" Subject: Re: [PATCH 3/3] BaseTools GCC: add the compiler flags to the linker command line X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2016 11:42:49 -0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 17 August 2016 at 13:38, Shi, Steven wrote: > Hi Ard, > > CLANG38 has a build failure as below for this patch. This failure is beca= use > the CLANG38 enable the LTO through LLVMgold.so linker plugin, but the > LLVMgold.so plugin cannot accept the clang -Oz cc flag as build option. > After CC_FLAG is added in the link rule, the LLVMgold.so plugin reports l= ink > error. LLVMgold.so only accept -O0~-O3, and you can see it in the LLVM go= ld > plugin source code in below: > This is interesting. I tried enabling LTO with CLANG35 for AARCH64 (using a 3.7 binary) and I did not see this problem. > > > http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_380/final/tools/gold/g= old-plugin.cpp > > > > if (opt[1] < '0' || opt[1] > '3') > > line173=EF=BC=9A message(LDPL_FATAL, "Optimization level must be b= etween 0 > and 3"); > > > > I hope to know is it mandatory to add compiler CC_FLAG in the linker rule > for you? If it is mandatory, I have to introduce a new link rule for CLAN= G38 > to remove the compiler CC_FLAG. What do you think? > Yes, it is mandatory. And I consider this a bug in Clang. For example, the mcmodel=3Dxxx parameter *must* be passed to the linker, since the linker generates code itself under LTO, and needs to know for which code model it is doing so. The same applies to -fpie and -mstrict-align (although clang also requires the -pie linker flag to generate correct code) Could you try putting -O2 in the DLINK2_FLAGS for Clang 38? (i.e., so that the last -O option the linker sees is not -Oz) --=20 Ard.