[PATCH] D58102: Support X86 Control-flow Enforcement Technology (CET) in LLD
Xiang Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 21 19:56:56 PDT 2019
xiangzhangllvm added a comment.
The update:
1 diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp
2 index 9066a84..a55ca1b 100644
3 --- a/ELF/SyntheticSections.cpp
4 +++ b/ELF/SyntheticSections.cpp
5 @@ -304,6 +304,9 @@ void GnuPropertySection::writeTo(uint8_t *Buf) {
6 uint8_t *DescBuf = Buf + 16;
7 write32(DescBuf, GNU_PROPERTY_X86_FEATURE_1_AND); // Feature type
8 write32(DescBuf + 4, 4); // Feature size
9 + // We need remove this if code when we supported IFUNC+CET.
10 + if (!Config->SPltSectionEnable)
11 + Feature1AND &= ~GNU_PROPERTY_X86_FEATURE_1_IBT;
12 write32(DescBuf + 8, Feature1AND); // Feature flags
13 }
14
15 diff --git a/ELF/SyntheticSections.h b/ELF/SyntheticSections.h
16 index 626a76d..51c3515 100644
17 --- a/ELF/SyntheticSections.h
18 +++ b/ELF/SyntheticSections.h
19 @@ -697,7 +697,8 @@ public:
20 SPltSection();
21 void writeTo(uint8_t *Buf) override;
22 size_t getSize() const override;
23 - bool empty() const override { return Entries.empty(); }
24 + bool empty() const override {
25 + return !Config->SPltSectionEnable || Entries.empty(); }
26
27 template <class ELFT> void addEntry(Symbol &Sym);
28 private:
29 diff --git a/ELF/Writer.cpp b/ELF/Writer.cpp
30 index 11639e5..341a557 100644
31 --- a/ELF/Writer.cpp
32 +++ b/ELF/Writer.cpp
33 @@ -421,10 +421,8 @@ template <class ELFT> static void createSyntheticSections() {
34 Add(In.Splt);
35 }
36
37 - if (Config->X86Feature1AND) {
38 - In.GnuProperty = make<GnuPropertySection>();
39 - Add(In.GnuProperty);
40 - }
41 + if (Config->X86Feature1AND)
42 + Add(make<GnuPropertySection>());
43
44 // .note.GNU-stack is always added when we are creating a re-linkable
45 // object file. Other linkers are using the presence of this marker
46 @@ -1669,8 +1667,6 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
47 // earlier.
48 finalizeSynthetic(In.EhFrame);
49
50 - finalizeSynthetic(In.GnuProperty);
51 -
52 for (Symbol *S : Symtab->getSymbols())
53 if (!S->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