Commit 5538c90
committed
Resolve getFullyQualifiedType in a statically-linked plugin host.
clad's reverse-mode argument handling (CladUtils::makeTypeReadable) calls
clang::TypeName::getFullyQualifiedType, but within clang that symbol is
referenced only by the Interpreter library. A clang driver built without
LLVM_LINK_LLVM_DYLIB does not contain it, so loading clad as a -fplugin leaves
the reference unresolved; under -undefined dynamic_lookup it binds to null and
the first call jumps to address 0. Reverse mode over any class construction
crashes as a result, which on such a host is most of the reverse-mode suite.
Force-reference the symbol from clad (RequiredSymbols.cpp) and link the clangAST
archive file into the plugin when not building against the LLVM dylib. Linking
the clangAST target instead would drag in LLVMSupport and duplicate its cl::opt
registrations, so the archive file is used directly.
The attribute that keeps the reference alive is spelled for GNU compilers only
and expands to nothing on MSVC, which has no equivalent and does not need one:
Windows fails a link on an unresolved symbol rather than binding it to null.1 parent 6e3b00f commit 5538c90
3 files changed
Lines changed: 66 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
19 | 27 | | |
20 | 28 | | |
21 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
1 | 11 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
6 | 25 | | |
| 26 | + | |
| 27 | + | |
0 commit comments