[PATCH] D115556: [lld-macho][nfc] Simplify LC_DATA_IN_CODE generation

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 12:07:57 PDT 2022


thakis added inline comments.


================
Comment at: lld/MachO/SyntheticSections.cpp:745-748
+    assert(is_sorted(dataInCodeEntries, [](const data_in_code_entry &lhs,
+                                           const data_in_code_entry &rhs) {
+      return lhs.offset < rhs.offset;
+    }));
----------------
BertalanD wrote:
> This assert seems to check a different thing than the one that was in `ObjFile::parseInDataCode`. Here, `dataInCodeEntries` contains the final contents of the DataInCodeSection, we should be checking `entries` instead, which contains the data from the object file.
> 
> This assertion will fail if sections are reordered because of PGO; it just happens to work in the usual case, because sections are output in the order they are present in the input files.
> 
> Here is such a failure during a PGO bootstrapping build of LLVM on x86_64: https://ci.chromium.org/ui/p/chromium/builders/try/mac_upload_clang/2582/overview
> 
> (Or if we need to keep the entries sorted, we can't just add them in the order they appear in `inputFiles`)
> 
> I'm happy to fix this.
Fix for this is in D133581.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115556



More information about the llvm-commits mailing list