diff options
| author | Michael Woerister <michaelwoerister@posteo.net> | 2016-03-01 08:19:00 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-03-25 14:07:19 -0400 |
| commit | 247570732205fd226981082ee5c96c0abf5fed21 (patch) | |
| tree | bd688feb9cc055d362723d373fbc9a5bb40a0f1e /src/rustllvm/ExecutionEngineWrapper.cpp | |
| parent | 82b5f1d8690ec538557ce3f355add91e3809ba51 (diff) | |
| download | rust-247570732205fd226981082ee5c96c0abf5fed21.tar.gz rust-247570732205fd226981082ee5c96c0abf5fed21.zip | |
Add a "link-guard" to avoid accidentally linking to a wrong dylib at runtime.
We want to prevent compiling something against one version of a dynamic library and then, at runtime accidentally using a different version of the dynamic library. With the old symbol-naming scheme this could not happen because every symbol had the SVH in it and you'd get an error by the dynamic linker when using the wrong version of a dylib. With the new naming scheme this isn't the case any more, so this patch adds the "link-guard" to prevent this error case. This is implemented as follows: - In every crate that we compile, we emit a function called "__rustc_link_guard_<crate-name>_<crate-svh>" - The body of this function contains calls to the "__rustc_link_guard" functions of all dependencies. - An executable contains a call to it's own "__rustc_link_guard" function. As a consequence the "__rustc_link_guard" function call graph mirrors the crate graph and the dynamic linker will fail if a wrong dylib is loaded somewhere because its "__rustc_link_guard" function will contain a different SVH in its name.
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
