[PATCH] D63309: [llvm-objcopy][MachO] Rebuild the symbol/string table in the writer

Seiya Nuta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 19:15:43 PDT 2019


seiya marked 5 inline comments as done.
seiya added inline comments.


================
Comment at: llvm/tools/llvm-objcopy/MachO/Object.cpp:10
+  assert(Index < Symbols.size() && "invalid symbol index");
+  return const_cast<SymbolEntry *>(Symbols[Index].get());
+}
----------------
alexshap wrote:
> khm, why is this const_cast needed here ?
First I thought we need to modify something in the `SymbolEntry` pointed from the `RelocationInfo.Symbol`, but I realized it is not necessary in this patch. 

FYI, I used the ELF implementation as reference:

```
class SymbolTableSection : public SectionBase {
...
public:
  const Symbol *getSymbolByIndex(uint32_t Index) const;
  Symbol *getSymbolByIndex(uint32_t Index);
};
```




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

https://reviews.llvm.org/D63309





More information about the llvm-commits mailing list