runtimeverification / llvm-backend

KORE to llvm translation
BSD 3-Clause "New" or "Revised" License
34 stars 22 forks source link

[DNM] set the linkage of some symbols to internal #1057

Closed dwightguth closed 4 months ago

dwightguth commented 4 months ago

Each semantics exports a large number of semantics-specific global symbols. If we want to create applications which link in libraries for multiple semantics of the llvm backend, this is a problem, because symbols will collide with one another.

This PR is the first step of attempting to resolve this problem. Some symbols that are currently externally visible can simply be replaced with internal linkage in llvm, thus allowing them to be automatically renamed by the linker when they occur in multiple semantics.

Note that this does not fully resolve the problem. There are still two other classes of symbols that are an issue:

  1. symbols that are generated to interface the code generator with the runtime, which the runtime needs to be able to call, but which need to be made somehow local to the semantics.
  2. symbols which are intended to be part of the public API of the semantics, and thus need to be callable by applications which link against these libraries.

These will require a more complex solution that will come in a follow-up pull request.

Don't merge this yet. I am experimenting with another solution right now.

Baltoli commented 4 months ago

The changes here seem locally fine so I've approved in the event that your experimental alternative doesn't work out.