[PATCH] D59780: Support Intel Control-flow Enforcement Technology

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 01:09:37 PDT 2019


xiangzhangllvm added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:594
 
+// If a source file is compiled with x86 hardware-assisted call flow control
+// enabled, the generated object file contains feature flags indicating that
----------------
MaskRay wrote:
> ruiu wrote:
> > xiangzhangllvm wrote:
> > > ruiu wrote:
> > > > MaskRay wrote:
> > > > > ruiu wrote:
> > > > > > MaskRay wrote:
> > > > > > > call flow control -> Control-Flow Enforcement ?
> > > > > > This is a general name and not specific to the Intel's implementation.
> > > > > My concern here is that llvm-objdump/GNU objdump and other tools/profilers would have to recognize two section names `.plt.sec` and `.splt`. Many tools use the section name to do special things, e.g.
> > > > > @hjl.tools If the ABI can be changed to not deliberately differ from the implementation (or the other way round), it'd be great.
> > > > > 
> > > > > binutils/objdump.c:739 
> > > > > 
> > > > > ```
> > > > > static bfd_boolean
> > > > > is_significant_symbol_name (const char * name)
> > > > > {
> > > > >   return strncmp (name, ".plt", 4) == 0 || strcmp (name, ".got") == 0;
> > > > > }
> > > > > ```
> > > > I'm not sure if I follow. Currently, in my patch, I use ".splt" and ".plt" as PLT section names, which I think as defined by the ABI. Are you saying that ".plt.sec" might be a correct name?
> > > The SPEC not fix the plt's name, It full name is Second IBT-enabled PLT,
> > > GCC name it as plt.sec. I name it splt for short at first.
> > > It may be better to have the same name with GCC.
> > > 
> > Ok, the I'll just follow the others. Is there anything other than this you invented a nonstandard stuff for this patch?
> > I'm not sure if I follow. Currently, in my patch, I use ".splt" and ".plt" as PLT section names, which I think as defined by the ABI. Are you saying that ".plt.sec" might be a correct name?
> 
> Sorry for not being clear. PLT sections do not have a dedicated section type and in practice they are usually recognized by the name `.plt`. My example above gave one case. If ld.bfd uses `.plt.sec` while we use `.splt`, the tools (objdump/llvm-mc/profiler/...) would have to understand the two names. The complexity could have been avoided if the linkers and the ABI agreed on the same name, say, `.plt.sec`.
> 
> I prefer `.plt.sec` to `.splt` because the same-prefix convention is already used in several other places to have fine-grained section types.
> 
> Thus, I suggest, if there is no strong reason to keep using `.splt` in the ABI, change it to what the implementations do: `.plt.sec`.
Another difference with GNU-LD is that, GNU-LD can deal with the muli-.note.gnu.sections case, for example:

```
file.s :
 .section ".note.gnu.property", "a"
....
 .section ".note.gnu.property", "a"
....
```

In my earlier patch version I supported it, but at last, to simply the patch, I delete this function.
Because I sought compiler and assember should merge them to 1 section (usually with multi-desc) one day.
I am not sure my sought is right or not. I think it should let you know. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59780/new/

https://reviews.llvm.org/D59780





More information about the llvm-commits mailing list