[PATCH] D125036: [RISCV] Alignment relaxation

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 07:41:36 PDT 2022


gkm added inline comments.
Herald added a subscriber: shiva0217.


================
Comment at: lld/ELF/InputSection.cpp:179
+  // distinguished by the `isStart` member.
+  SmallVector<SymbolAddr> symbolAddrs;
+  for (auto &sym : file->getSymbols()) {
----------------



================
Comment at: lld/ELF/InputSection.cpp:179
+    uint64_t removedBytes = 0;
+    const auto *r = ranges.begin(), *rend = ranges.end();
+    for (auto *dr : symbols) {
----------------
reames wrote:
> This code seems to assume that ranges appear in order of increasing start address.  I believe that is true in the code, but could easily be asserted more heavily to prevent future subtle mistakes.  
The relaxation algorithm processes relocations by ascending address, and thus delete ranges are pushed to the vector by ascending address. I added an assertion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125036



More information about the llvm-commits mailing list