[PATCH] D41613: [ELF] - Do not use HeaderSize for conditions in PltSection.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 01:48:00 PST 2018


>Sure. But if PLTs for all targets have the PLT header for lazy symbol resolution (I believe that's the case),

>and IPLT doesn't have one (I believe that's true too), then we can use `bool is Iplt() { return HeaderSize == 0; }`

>instead of adding a new boolean flag to the ctor.


Such approach does not always works good. I tried to do that and

for example for safety I tried to check that we always set PltHeaderSize when creating PltSections:


  assert(Target->PltHeaderSize);
  InX::Plt = make<PltSection>(Target->PltHeaderSize);
  Add(InX::Plt);
  InX::Iplt = make<PltSection>(0);
  Add(InX::Iplt);?


And found that AMDGPU does not set it either, though according to its spec (https://llvm.org/docs/AMDGPUUsage.html)

and LLD code it does not have PLT relocations. There is no much sence to set dummy value for PltHeaderSize for

AMDGPU, it looks just like a hacky workaround.


And at the same time for PPC and PPC64 I had to add:


  // Our implementation assumes that target's PltHeaderSize is
  // never a zero. Use dummy value.
  PltHeaderSize = 8;


What is actually completely useless IMO. I see nothing wrong that some target does not implement lazy binding. It might never

implement it probably. So why we should assume it must do it and create larger output for it then ?

It looks like because of bad design of PLT sections we are trying to create larger output to workaround it.


George.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180110/0bc5cc73/attachment.html>


More information about the llvm-commits mailing list