[PATCH] D32887: [ELF] Emit __ehdr_start when there is a segment containing program headers

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 14:52:05 PDT 2017


phosek added inline comments.


================
Comment at: ELF/Writer.cpp:1190
 
+  if (ElfSym::EhdrStart) {
+    auto PhdrI =
----------------
ruiu wrote:
> What is this doing?
The idea is that `ElfSym::EhdrStart` is only defined if needed by `addOptionalRegular`, so if it's `nullptr` we can ignore it.


================
Comment at: ELF/Writer.cpp:1195
+    if (PhdrI == Phdrs.end()) {
+      forEachRelSec([&](InputSectionBase &S) {
+        if (S.AreRelocsRela)
----------------
ruiu wrote:
> Re-scanning all relocations is probably too slow.
I'm aware of that, do you have any ideas on how to do it faster? I don't know if there's any way to find relocations for a given symbol which is what's really needed here. Alternative would be to print an error without giving section and offset info, but that'll make it inconsistent with error reports for regular undefined symbols.


Repository:
  rL LLVM

https://reviews.llvm.org/D32887





More information about the llvm-commits mailing list