[PATCH] D58102: Support X86 Control-flow Enforcement Technology (CET) in LLD

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 20:01:08 PDT 2019


xiangzhangllvm added a comment.

In D58102#1425580 <https://reviews.llvm.org/D58102#1425580>, @MaskRay wrote:

> > Gold auto enabled CET in default
>
> What kind of CET support does gold have now? I think it can merge `.note.gnu.property` now but I don't find code related to second PLT or ibtplt. (I have a question about `ibtplt`, see below).
>
> > I add --auto-cet and --force-cet options, and disable CET in default. Now there will be no influence to the LLD when not using these options.
>
> I find that ld.bfd has three related options `-z ibt` `-z ibtplt` `-z shstk` (are there others?). What do they do?
>
>   -z ibtplt                   Generate IBT-enabled PLT entries\n"));
>   fprintf (file, _("\
>   -z ibt                      Generate GNU_PROPERTY_X86_FEATURE_1_IBT\n"));
>   fprintf (file, _("\
>   -z shstk                    Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK\n"));
>   
>
> Is `-z ibtplt` similar to the second PLT? Does `-z ibt` generate `GNU_PROPERTY_X86_FEATURE_1_IBT` even if there is an input object file with the GNU_PROPERTY_X86_FEATURE_1_IBT bit cleared? Or when it is specified while `-z shstk` is not, merge just `ibt` but not `shstk`? I'm puzzled as you said the note merging behavior is automatic in ld.bfd.
>
> > --auto-cet and --force-cet
>
> We can also make one option `--cet={none,auto,force}`, but I'd like to understand first what `-z ibt` `-z shstk` `-z ibtplt` do...


Hi MaskRay, 
1 please not focus on these -z options now, H.J add them just for testing, for example, if you compiled file without CET, but finally, you want to see the "there will be errors" if you force add CET flags in the output file.

2 I have sought used `--xxx={none,auto,force}`,  at last I choose using --xxx-xxx, because I think we will mostly use --auto-cet, rarely use others


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58102/new/

https://reviews.llvm.org/D58102





More information about the llvm-commits mailing list