[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 23:35:06 PDT 2019


xiangzhangllvm marked an inline comment as done.
xiangzhangllvm added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:3136
+// else return false;
+static bool findGNUPropertyX86Feature1AND(InputSectionBase *S,
+                                          unsigned &X86F1ANDDescLoca) {
----------------
xiangzhangllvm wrote:
> ruiu wrote:
> > Essentially, when you read some structure from a file, you should cast a byte array to a struct defined in llvm/include/llvm/Object/ELFTypes.h. You should not read data like this function does.
> Yes! This is the key point! 
Hi Ruiu,  let me tell you my idea about how to rewrite here code first:

First I checked llvm/include/llvm/Object/ELFTypes.h, and find no structure corresponding to our .note.gnu.property.
Compiler write this section at llvm/lib/Target/X86/X86AsmPrinter.cpp:X86AsmPrinter::EmitStartOfAsmFile(), it not used any structure too.

I want to change here like this:

```
struct head{
...
}
struct desc{
...
}
struct gnu.property{
  head H;
  desc D[]; 
}
```
then cast the note.gnu.property's data array to struct gnu.property.
and check the features though struct gnu.property.
Do you think it's OK?


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