[PATCH] D12874: [LLD/ELF2] Initial support for local symbols in symtab

Denis Protivensky via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 00:28:09 PDT 2015


denis-protivensky added a subscriber: denis-protivensky.

================
Comment at: ELF/InputFiles.cpp:78
@@ +77,3 @@
+  if (!this->Symtab)
+    return Elf_Sym_Range(nullptr, nullptr);
+  Elf_Sym_Range Syms = this->ELFObj->symbols(this->Symtab);
----------------
`return llvm::make_range...` for consistency

================
Comment at: ELF/Writer.cpp:551
@@ -532,2 +550,3 @@
+
   uint8_t *BufStart = Buf;
 
----------------
Maybe better to rename `BufStart` to something like `BufVisible` since it points to the start of visible symbols?

================
Comment at: ELF/Writer.cpp:614
@@ -595,4 +613,3 @@
   auto *Syms = reinterpret_cast<Elf_Sym *>(BufStart);
-  ++Syms;
-  array_pod_sort(Syms, Syms + NumVisible, compareSym<ELFT>);
+  array_pod_sort(Syms, Syms + NumVisible - NumLocals, compareSym<ELFT>);
 }
----------------
Looks like `Syms` = `BufStart` = pointer to the buffer with STN_UNDEF and local symbols already skipped, so you need to pass `Syms + NumVisible` as the array end.


Repository:
  rL LLVM

http://reviews.llvm.org/D12874





More information about the llvm-commits mailing list