[llvm] [ORC] Add absoluteSymbolsObjectLayer to expose absolute symbols to platform (PR #77008)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 11:40:12 PST 2024


https://github.com/lhames commented:

`tryToGenerate` just has to add the definitions to the target MU, so what if you replaced

```c++
using AbsoluteSymbolsMUFactory =
      unique_function<std::unique_ptr<MaterializationUnit>(SymbolMap)>;
```
with
```c++
using AddAbsoluteSymbolsFn =
      unique_function<Error(JITDylib&, SymbolMap)>;
```

then you could replace `absoluteSymbolsObjectLayer` with a more generic `absoluteSymbolsLinkGraph` function that just returns the graph, and your adder could be:

```c++
[&ObjLinkingLayer](JITDylib &JD, SymbolMap Symbols) {
  // Build graph.
  return ObjLinkingLayer.add(JD, std::move(G));
}
```

https://github.com/llvm/llvm-project/pull/77008


More information about the llvm-commits mailing list