[PATCH] D147544: [BOLT] Move from RuntimeDyld to JITLink

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 20 05:39:02 PDT 2023


jobnoorman added a comment.

I've been investigating the remaining differences using `llvm-bolt-wrapper.py` and they seem to fall in three categories.

  main:
    [ 8] .text.cold.2      PROGBITS        0000000000600080 400080 000014 00  AX  0   0 64
  cmp:
    [ 8] .text.cold.3      PROGBITS        0000000000600080 400080 00000a 00  AX  0   0 64
  
  headers mismatch

This seems serious at a first glance but turned out to be caused by the order in which `JITLink` processes sections. Sections are stored in a `DenseMap` so iteration doesn't happen in insertion order (which seems to happen in `RuntimeDyld`). I've attached a patch to use a `VectorMap` instead which causes these errors to go away (the patch is just for testing of course :)) F27207495: 0001-Deterministic-JITLink-section-order.patch <https://reviews.llvm.org/F27207495>

  main:
    [ 3] .eh_frame         PROGBITS        00000000004001c0 2001c0 00007c 00   A  0   0  8
  cmp:
    [ 3] .eh_frame         PROGBITS        00000000004001c0 2001c0 000074 00   A  0   0  8
  
  headers mismatch

The different size of `.eh_frame` is caused by the difference in the way terminators are added. iiuc, this is benign.

  main:
    Start of section headers:          4198288 (bytes into file)
  cmp:
    Start of section headers:          4198272 (bytes into file)
  
  headers mismatch

I believe this is simply a consequence of the previous difference. The section headers are stored after the sections. I checked a few files manually and the difference in the section header offset equals the size difference of `.eh_frame` aligned to 4 bytes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147544



More information about the llvm-commits mailing list