public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: "Shi, Steven" <steven.shi@intel.com>
Cc: "sigmaepsilon92@gmail.com" <sigmaepsilon92@gmail.com>,
	"Zhu, Yonghong" <yonghong.zhu@intel.com>,
	 "Gao, Liming" <liming.gao@intel.com>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	 "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	 "leif.lindholm@linaro.org" <leif.lindholm@linaro.org>,
	"afish@apple.com" <afish@apple.com>
Subject: Re: [PATCH 3/3] BaseTools GCC: add the compiler flags to the linker command line
Date: Wed, 17 Aug 2016 13:42:47 +0200	[thread overview]
Message-ID: <CAKv+Gu-FTywO00czH+Djm5VYkZT2t2KKhPLipcsFkZHcumZuGQ@mail.gmail.com> (raw)
In-Reply-To: <06C8AB66E78EE34A949939824ABE2B310338D619@shsmsx102.ccr.corp.intel.com>

On 17 August 2016 at 13:38, Shi, Steven <steven.shi@intel.com> wrote:
> Hi Ard,
>
> CLANG38 has a build failure as below for this patch. This failure is because
> 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 link
> error. LLVMgold.so only accept -O0~-O3, and you can see it in the LLVM gold
> 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/gold-plugin.cpp
>
>
>
>                       if (opt[1] < '0' || opt[1] > '3')
>
> line173:        message(LDPL_FATAL, "Optimization level must be between 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 CLANG38
> 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=xxx 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)

-- 
Ard.


  reply	other threads:[~2016-08-17 11:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 14:39 [PATCH 0/3] BaseTools GCC: pass CC flags to linker Ard Biesheuvel
2016-08-02 14:39 ` [PATCH 1/3] BaseTools GCC: move -c compiler flag to build rules Ard Biesheuvel
2016-08-02 15:01   ` Leif Lindholm
2016-08-02 15:02     ` Ard Biesheuvel
2016-08-02 15:09       ` Ard Biesheuvel
2016-08-02 14:39 ` [PATCH 2/3] BaseTools GCC5: disable warnings-as-errors for now Ard Biesheuvel
2016-08-02 14:39 ` [PATCH 3/3] BaseTools GCC: add the compiler flags to the linker command line Ard Biesheuvel
2016-08-17 11:38   ` Shi, Steven
2016-08-17 11:42     ` Ard Biesheuvel [this message]
2016-08-17 12:24       ` Shi, Steven
2016-08-17 13:06         ` Ard Biesheuvel
2016-08-02 14:50 ` [PATCH 0/3] BaseTools GCC: pass CC flags to linker Gao, Liming
2016-08-02 14:51   ` Ard Biesheuvel
2016-08-03  8:22     ` Ard Biesheuvel
2016-08-03  8:58       ` Gao, Liming
2016-08-03  9:23         ` Ard Biesheuvel
2016-08-03 13:20           ` Gao, Liming
2016-08-03 15:50             ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKv+Gu-FTywO00czH+Djm5VYkZT2t2KKhPLipcsFkZHcumZuGQ@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox