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

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 01:26:28 PDT 2019


xiangzhangllvm added a comment.

In D58102#1433093 <https://reviews.llvm.org/D58102#1433093>, @peter.smith wrote:

> I guess you mean "I tried", not "I tend" in 1). I think that you can do accomplish 1.) via unconditionally creating the In.GnuPropertySection and SPltSection and by implementing the empty() member function, ensure that they are removed by removeUnusedSyntheticSections() if there isn't anything that uses them. Unconditionally creating the sections means that you don't need to call mergeAggregateMetaData from Driver.cpp prior to createSyntheticSections(). For the case of ifunc where you need to turn off the feature then just inform In.GnuPropertySection and In.SPltSection as they will always be there.


Hi peter, I have implemented your idea in my code, and it work well, I did not update here now because I am not sure about the ifunc.
One of my destination is to remove the Config->X86Feature1AND and do the feature collection work inside synthetic GnuPropertySection class.
I found I can remove the Config->X86Feature1AND except dealing with ifunc, If I remove the Config->X86Feature1AND I still need another global variable.
At this stage I want to disable CET when the program will use ifunc, my current code is Relocations.cpp:1072

  // To Be Done.
  // Now the IBT can't work with IFUNC feature, becasue they may conflict in
  // changing the PLT. So we disable the IBT when the IFUNC enabled.
  if (Sym.isGnuIFunc()) {
    Config->X86Feature1AND &= ~GNU_PROPERTY_X86_FEATURE_1_IBT;
    Config->SPltSectionEnable = false;
  }

Do you have some good idea to turn off the CET feature in ifunc ?
Thank you very much!


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