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

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 13 22:46:06 PST 2019


xiangzhangllvm added a comment.

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

> In D58102#1397542 <https://reviews.llvm.org/D58102#1397542>, @xiangzhangllvm wrote:
>
> > Hi ruiu:
> >  Very thank you for spending your time to review this patch, I'll keep your adjustments in my mind. But I am not clear about the RFC, what it stands for?
>
>
> I think RFC stands for "Request For Comments". You may send an email to llvm-dev (see http://lists.llvm.org/pipermail/llvm-dev/2019-February/thread.html for some examples) It is commonly used when some completely new features are planned. The comments here go to the mailing list llvm-commits but not many people subscribe to the list. llvm-dev has a wider audience.


Thank you MaskRay!
And I update the patch to avoid ifunc and retpolineplt:

  1 diff --git a/ELF/Driver.cpp b/ELF/Driver.cpp
  2 index 4b5a89a..1bc8101 100644
  3 --- a/ELF/Driver.cpp
  4 +++ b/ELF/Driver.cpp
  5 @@ -1505,6 +1505,13 @@ static void readGNUPropertyX86Feature1AND(InputSectionBase *S,
  6    // integer. A bit in the output pr_data field is set only if it is set
  7    // in all relocatable input pr_data fields.
  8    Config->X86Feature1AND &= Flags;
  9 +

10 +  // To Be Done.
 11 +  // Now the IBT can't work with retpolineplt feature, becasue they may conflict
 12 +  // in changing the PLT. So we disable the IBT when the IFUNC enabled.
 13 +  if (Config->ZRetpolineplt)
 14 +    Config->X86Feature1AND &= ~GNU_PROPERTY_X86_FEATURE_1_IBT;
 15 +
 16    Config->SPltSectionEnable = Config->X86Feature1AND
 17                                & GNU_PROPERTY_X86_FEATURE_1_IBT;
 18  }
 19 diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp
 20 index 2dc981e..c579dfb 100644
 21 --- a/ELF/Relocations.cpp
 22 +++ b/ELF/Relocations.cpp
 23 @@ -1036,6 +1036,12 @@ static void scanReloc(InputSectionBase &Sec, OffsetGetter &GetOffset, RelTy *&I,
 24             getLocation(Sec, Sym, Offset));
 25      }
 26      Expr = toPlt(Expr);
 27 +
 28 +    // To Be Done.
 29 +    // Now the IBT can't work with IFUNC feature, becasue they may conflict in
 30 +    // changing the PLT. So we disable the IBT when the IFUNC enabled.
 31 +    Config->X86Feature1AND &= ~GNU_PROPERTY_X86_FEATURE_1_IBT;
 32 +    Config->SPltSectionEnable = false;
 33    } else if (!Sym.IsPreemptible && Expr == R_GOT_PC && !isAbsoluteValue(Sym)) {
 34      Expr = Target->adjustRelaxExpr(Type, RelocatedAddr, Expr);
 35    } else if (!Sym.IsPreemptible) {


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