-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[cxxmodules] Do not generate a rootmap if a module exists. #4005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cxxmodules] Do not generate a rootmap if a module exists. #4005
Conversation
|
Starting build on |
642a4b7 to
88aeafe
Compare
|
Starting build on |
e7a5641 to
4c11030
Compare
|
Starting build on |
|
Starting build on |
|
Starting build on |
|
Build failed on ROOT-ubuntu16/rtcxxmod. Errors:
|
eeae536 to
bcf826a
Compare
|
Starting build on |
|
Starting build on |
|
Build failed on ROOT-fedora27/noimt. Failing tests: |
|
Starting build on |
Move common code into lambda. Extract out the lookup in dynamic sections into a separate routine.
Both data structures are used to store the dirname of the system and non-system library respectively. Their use is to provide a stable offset for the LibraryPath.
…in ACLiC
When ACLiC builds a shared library it does either explicit linking (enumerating
all related libraries with -l) or implicit symbol resolution. When ROOT6
appeared we could only rely on rootmaps to compute library dependencies and
this hardened the implementation of explicit linking.
Explicit linking happens in two ways:
1. We read all rootmap files and store a mapping qualified name -> library.
Whenever we read a RecordDecl when generating a dictionary in rootcling
we check if the RecordDecl's qualified name exists in the map and store the
corresponding library in a special *.out file.
2. In the case of runtime_cxxmodule, if the -cxxmodule flag is passed to
rootcling, whenever we deserialize a declaration we fill that information
from RecordDecl's owning module.
This approach is suboptimal because the deserialized declaration can be a
forward declaration or codegen decided not to produce code because the entity
was not ord-used. We cannot use explicit linking when ROOT is running in mixed
mode, that is it has -Druntime_cxxmodules=On and no -cxxmodule flag in
rootcling.
The implicit linking means we do not use explicit linking but resolve undefined
symbols at library loading time. This is the preferrable way to resolve symbols
but it can be tricky and unefficient. It happens in two ways:
1. Upon loading of a shared library we listen to a callback if the library
failed to load. The dynamic linker gives an 'undefined symbol' error which
we search for in the LD_LIBRARY_PATH.
2. It can happen that the library loads successfully and the symbol lookup
fails later. Currently there is no way to subscribe to such an event.
This patch enables implicit linking for the 2nd way solving the deficiency of
explicit linking when ROOT runs in hybrid mode. In that rare case, we iterate
over all undefined symbols in a given library and try to find their definitions
in the list of predefined library paths.
Currently the behavior is O(n*m) where n is the number of the undefined symbols
and m is the number of libraries. We can use a combination of caching and bloom
filters to improve the performance but it is not worth it, given the almost
corner-case we are in. An easier optimization is to check if the symbol is
resolvable via dlsym which means that the library contains an undefined symbol
but it was already loaded. This simple optimization brings ~30% improvement.
We have user library search paths which come from LD_LIBRARY_PATH or similar; and system library search paths which are coming from the platform. This patch enables external users performing symbol resolution to filter out system search paths when they know the symbol cannot be there. Now, TClingCallbacks can merge the modules vs non-modules code paths, where the modules prebuilt path is essentially our LD_LIBRARY_PATH.
Improve code readability by early continue-s.
c78f4f6 to
ea2ea42
Compare
|
Starting build on |
|
@phsft-bot build with flags -DCTEST_TEST_EXCLUDE_NONE=On |
|
Starting build on |
|
Build failed on ROOT-fedora29/python3. |
|
Build failed on ROOT-fedora27/noimt. |
|
Build failed on ROOT-ubuntu16/rtcxxmod. |
|
Build failed on windows10/default. Errors:
|
|
@phsft-bot build with flags -DCTEST_TEST_EXCLUDE_NONE=On |
|
Starting build on |
Depends on #3850.