[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 Mar 20 01:02:49 PDT 2019
xiangzhangllvm updated this revision to Diff 191457.
xiangzhangllvm added a comment.
I rewrited the collecting feature functions.
It is very simple now!
+struct GnuPropertyHeadType {
+ uint32_t Namesz;
+ uint32_t Descsz;
+ uint32_t NType;
+ uint32_t Name;
+}; // Did here need packed attribute ? I have a little concern
+
+struct GnuPropertyDescType {
+ uint32_t DescTy;
+ uint32_t Descsz;
+ uint32_t Feature;
+ uint32_t Pad;
+}; // Did here need packed attribute ? I have a little concern
+
+struct GnuPropertyType {
+ GnuPropertyHeadType Head;
+ GnuPropertyDescType Desc[];
+}; // Did here need packed attribute ? I have a little concern
+
+static bool findGNUPropertyX86Feature1AND(InputSectionBase *S,
+ unsigned &Features) {
+ auto Data = S->getDataAs<uint32_t>();
+ GnuPropertyType *GnuProperty = cast<GnuPropertyType>(Data.data());
+ size_t DescNum = GnuProperty->Head.Descsz / sizeof (GnuPropertyDescType);
+ if (GnuProperty->Head.NType != NT_GNU_PROPERTY_TYPE_0)
+ return false;
+ for (size_t i = 0; i < DescNum; i ++) {
+ if (GnuProperty->Desc[i].DescTy == GNU_PROPERTY_X86_FEATURE_1_AND) {
+ Features = GnuProperty->Desc[i].Feature;
+ return true;
+ }
+ }
+ return false;
+}
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58102/new/
https://reviews.llvm.org/D58102
Files:
ELF/Arch/X86.cpp
ELF/Arch/X86_64.cpp
ELF/Config.h
ELF/Driver.cpp
ELF/InputSection.cpp
ELF/Options.td
ELF/Relocations.cpp
ELF/Symbols.cpp
ELF/Symbols.h
ELF/SyntheticSections.cpp
ELF/SyntheticSections.h
ELF/Target.h
ELF/Writer.cpp
docs/ld.lld.1
test/ELF/Inputs/i386-feature-1-and0.s
test/ELF/Inputs/i386-feature-1-and1.s
test/ELF/Inputs/i386-feature-1-and1x.s
test/ELF/Inputs/i386-feature-1-and2.s
test/ELF/Inputs/i386-feature-1-and2s.s
test/ELF/Inputs/x86-64-feature-1-and0.s
test/ELF/Inputs/x86-64-feature-1-and1.s
test/ELF/Inputs/x86-64-feature-1-and1x.s
test/ELF/Inputs/x86-64-feature-1-and2.s
test/ELF/Inputs/x86-64-feature-1-and2s.s
test/ELF/i386-feature-1-and.s
test/ELF/x86-64-feature-1-and.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58102.191457.patch
Type: text/x-patch
Size: 40762 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190320/e8e88f27/attachment.bin>
More information about the llvm-commits
mailing list