[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 17:40:48 PDT 2019


xiangzhangllvm added a comment.

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

> I'm having problems getting this to compile on at least GCC 5.4.0 on Linux:
>
>   lld/ELF/SyntheticSections.cpp:3104:28: warning: ISO C++ forbids zero-size array ‘Desc’ [-Wpedantic]
>      GnuPropertyDescType Desc[]
>  
>   lld/ELF/SyntheticSections.cpp:3110:55: error: invalid conversion from ‘llvm::cast_retty<GnuPropertyType, const unsigned int*>::ret_type {aka const GnuPropertyType*}’ to ‘GnuPropertyType*’ [-fpermissive]
>      GnuPropertyType *GnuProperty = cast<GnuPropertyType>(Data.data());
>
>
> The cast<> is an LLVM cast http://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates and isn't something you can do on an arbitrary struct.
>
> Assuming (x86) that your input data is always little endian then you'll need to use something like ulittle32_t instead of uint32_t or your tests will fail when run on a big-endian machine like PPC or some Mips machines.


I used GCC 6.5.0, So I didn't meet this build error, I'll check and refine it, thank you!


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