- After D113241, we have the section address easily accessible and no longer need to iterate across the LC_SEGMENT commands to emit LC_DATA_IN_CODE.
- There's no need to store a pointer to the data in code entries during the parse step; we can just look it up as part of the output step.
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.