Commit Graph

4703 Commits

Author SHA1 Message Date
Axel Naumann
cfc6f86de1 Throw less exceptions on Apple M1:
As llvm JIT cannot catch exceptions on Apple M1 (see
https://github.com/root-project/root/issues/7541) cling
should throw less. This is a hack to reduce the impact
a bit.
2021-03-31 15:29:04 +02:00
Bertrand Bellenot
df5fbb3c46 Fix unresolved external symbol errors on Windows
Resolves root-project/cling#399
Fix the following linker errors:
253>cling.exp : error LNK2001: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits,class std::allocator > __cdecl clang::QualType::getAsString(class clang::Type const *,class clang::Qualifiers)" (?getAsString@QualType@clang@@sa?AV?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@PEBVType@2@VQualifiers@2@@z)
253>cling.exp : error LNK2001: unresolved external symbol "private: virtual void __cdecl llvm::raw_ostream::handle(void)" (?handle@raw_ostream@llvm@@EEAAXXZ)
253>D:\work\libs\cling\src\build\Release\bin\cling.exe : fatal error LNK1120: 2 unresolved externals
2021-03-23 22:29:08 +01:00
Vassil Vassilev
a89bbcbb04 Do not bind cling's sysroot to a particular version of osx sdk.
The CMAKE_OSX_SYSROOT exports the exact version of the sdk which we build
against. However, this means that binary releases become sensitive to minor sdk
upgrades (eg. MacOSX11.1.sdk -> MacOSX11.2.sdk). Our infrastructure is
relatively resilient to such changes.

This patch introduces a workaround to address this issue -- it uses the fact
that the current sdk's parent directory has a symlink MacOSX.sdk which points
to the current sdk.

This should resolve root-project/root#7021.
2021-03-21 21:59:03 +01:00
Pratyush Das
2b222f35f5 Drop --compiler flag
Build compiler can be set using CMake flag
2021-03-18 23:29:07 +01:00
Axel Naumann
2b1af22926 In failed lookup, unload only decls produced, not existing fwd decl:
Before, pre-existing fwd decls of specializations got unloaded.

OTOH, any decl produced during (failed) template instantiation must
also be unloaded; see #6331. Those are easiest identified by unloading
the whole (failed) transaction.

```
error: no member named 'value' in 'std::__and_<std::is_copy_assignable<std::__cxx11::basic_string<char> >, std::is_copy_assignable<Inner<int> > >'
                       is_copy_assignable<_T2>>::value,
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~^
```

which is due to the first decl being invalid (as `Inner<int>` does not have a deinition and a `static_assert` /usr/lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/type_traits:1093 being triggered), then not unloaded, and then picked up again where we *do* have the definition for `Inner<int>`.

Add test for templt spec lookup vs unloading.
2021-03-18 19:59:03 +01:00
Axel Naumann
9ca9606a74 PushTransactionRAII: do not commit broken transactions:
There is no point in emitting a transaction that has been rolled back to
CodeGen. To make matters worse, a rolled-back transaction will not show up
in the list of transactions.
2021-03-18 19:59:03 +01:00
Axel Naumann
e66ea9ad58 Allow unloading of Transactions that have not been committed:
If Lookup fails to instantiate, its transaction should not be committed,
as we know it's useless and must be unloaded as it might contain invalid
Decls.
But that means Lookup needs to unload a non-committed transaction.
2021-03-18 19:59:03 +01:00
Axel Naumann
2fc0a3c5c4 Skip non-regular files to find dylibs:
To determine the file magic, the file needs to be opened and read.
This is done with *each* file in $LD_LIBRARY_PATH, including ./
If one of them is e.g. a FIFO then reading blocks until someone
writes into the FIFO, which might cause the process to hang. This
was reported a couple of times, such as at https://root-forum.cern.ch/t/compiling-from-source-first-interactive-command-hangs/43997/5

Solution: only check for the file magic of *regular* files.

Sadly, llvm::sys::fs::get_file_type never sets file_not_found but
returns an unspecific status_error.
2021-03-18 19:44:06 +01:00
David
b38fc1e80c make minimal adjustments (for removed headers) to boost modulemap for boost 1.75.0 (+patches for missing includes) 2021-03-18 15:59:04 +01:00
Axel Naumann
81b683bf1d When injecting symbols, do not rely on the last Module:
With llvm9, the module ptr gets reset upon emission.
Instead, just look for the symbol in the JIT - where it should be found,
as Init() is injecting it there, and we want to find *that* symbol,
not the one from the binary.

Fixes `CodeUnloading/AtExit.C` cling test.
2021-03-16 09:59:04 +01:00
Axel Naumann
b921ac814a Bring vanilla-cling lit feature back:
it is needed for test/Autoloading/AutoForwarding.C.
2021-03-16 09:59:04 +01:00
Axel Naumann
897701fb24 Help test find its parts:
was failing before but due to `REQUIRES: vanilla-cling` not run.
2021-03-16 09:59:03 +01:00
Axel Naumann
608a992e5f Fix expected diags in test/Pragmas/load.C:
A failure to load the library will *not* trigger loading the
same file as a source file: `#pragma load` will cause zero or
one diagnostics, not two.

Now that the diagnostic for a missing file to be `#pragma load`ed
is "file not found", re-use the existing `expected-error@input_line_12`
line!.
2021-03-16 09:59:03 +01:00
Axel Naumann
0ae95fb193 Improve diag on #pragma load failure. 2021-03-16 09:59:03 +01:00
Vassil Vassilev
899b3337fc Install the modulemap files 2021-03-11 10:44:07 +01:00
Jonas Hahnfeld
b38192f29f Disable GlobalISel on AArch64 (#7419)
In tests on an Apple M1 after the upgrade to LLVM 9, this new
instruction selection framework emits branches / calls that expect
all code to be reachable in +/- 128 MB. This cannot be guaranteed
during JIT, which generates code into allocated pages on the heap
and could span the entire address space of the process.
2021-03-09 21:29:04 +01:00
Axel Naumann
d1c49f4397 Put else back to handle CastExpr of DeclRefExpr 2021-03-07 00:14:03 +01:00
Axel Naumann
e0249a77d2 ForwardDeclPrinter: also log skipped types. 2021-03-07 00:14:03 +01:00
Axel Naumann
44f304c672 skipDecl if template arg cannot be fwd declared:
Fixes CMS dictionary build issue with forward declaring a template argument
of enum constant type - something we do not forward declare.
2021-03-07 00:14:03 +01:00
Axel Naumann
31cbf79eb6 A CastExpr cannot be a DeclRefExpr. 2021-03-07 00:14:03 +01:00
Simeon Ehrig
6fddcc0e42 Fix bug in cling's diagnostic engine, if CUDA mode is enable
- solves the bug, that error messages of the device compiler was
not prefixed with "cling-ptx"
2021-03-06 09:29:07 +01:00
Pratyush Das
9e2c41e580 Update cpt shebang to reflect Python 3 requirement 2021-03-05 12:44:07 +01:00
Pratyush Das
b7fc2bb37e Clarify in README that cpt requires Python 3 2021-03-05 09:29:07 +01:00
Vassil Vassilev
07ad3c1a72 Allow building clad as a cling plugin via -DCLING_BUILD_PLUGINS=On 2021-03-03 18:44:05 +01:00
Vassil Vassilev
c9dd3e66f8 Revert "[cling] modulemap <string_view> requires C++17."
This reverts commit 93c1649bef398ee310b85848bbe4a2f0182c3a76.
2021-02-28 17:44:05 +01:00
Vassil Vassilev
1804436da1 Add the CLANG_INCLUDE_DIRS if we build as part of LLVM. 2021-02-26 20:59:05 +01:00
Axel Naumann
34405e7a29 modulemap <string_view> requires C++17. 2021-02-26 18:14:07 +01:00
Axel Naumann
7c83a3e0ae Windows needs more symbols to be injected:
such as __dllonexit() and _onexit(). Without, static destruction
does not happen, as can be seen by roottest/cling/staticinit/execROOT-7775.C
failing to call the static destructors.
2021-02-25 20:44:19 +01:00
Javier Lopez-Gomez
b5348025ef DeclExtractor: exit early if there is nothing to do
In LLVM 9, the `CompoundStmt::replaceStmts()` call seems to write to an invalid
memory location if the body was empty. This may happen after a parse error and
might end up corrupting the program state.

This patch makes `DeclExtractor` to exit early if there is nothing to do, which
solves the aforementioned problem.
2021-02-25 20:44:19 +01:00
Vassil Vassilev
dad7ed462e removeRedeclFromChain is a template static. Fixes osx warning. 2021-02-25 20:44:19 +01:00
Vassil Vassilev
f2e5f43acf Fix warnings about the ignored quals. 2021-02-25 20:44:19 +01:00
Simeon Ehrig
be5ea3a651 Fixed CUDA mode for Clang/LLVM 9 upgrade
- fix bug, which was caused by executing a transaction in the device
interpreter
- fixed warning from the device compiler
- update test cases
2021-02-25 20:44:19 +01:00
Vassil Vassilev
84bcd07963 Add a module for Vc.
This should fix a problem where the ClingTest unit test fails due to the fact
that std::vector is copied and delivered by Vc pulling a wrong dependency.
2021-02-25 20:44:19 +01:00
Vassil Vassilev
fedeedc2cd Improve "[cling] DefinitionShadower: allow shadowing of non-user-defined declarations (#6571)"
The patch applies a patch to remove duplicated entries from the StoredDeclsList.
Apparently, reading a yet-to-be-determined PCM file adds the same `Decl *` to
the lookup table. Trying to remove it using `StoredDeclsList::remove()` makes
an internal assertion to fail, as it expects the Decl to disappear from the
lookup table after being removed.

So far, `darwin.pcm` seems like one of the possible causes of this problem, but
more investigation is needed.
2021-02-25 20:44:18 +01:00
Axel Naumann
74e4407225 Unload even if no T->module:
Modules are constructed lazily; not having one still means
DeferredDecls need to be unloaded. This fixes stressInterpreter.
2021-02-25 20:44:18 +01:00
Axel Naumann
400f7c7ffb Remove pseudo-conditional / simplify (NFC). 2021-02-25 20:44:18 +01:00
Vassil Vassilev
c061a8ae01 Plugins on Windows are not supported, don't build the example plugin. 2021-02-25 20:44:18 +01:00
Axel Naumann
eac42c613b Reset Sema::CurContext to TU before auto-import:
Sema create an ImportDecl, and that should not end up e.g. inside
a class definition, or wherever else the "autoparsing" was triggered.
Fixes roottest-root-meta-assertVarOffset.

(cherry picked from commit 4d8fcf0984118663a356d462eeec6cb6c34ebfef)
2021-02-25 20:44:18 +01:00
Axel Naumann
02ec8bf986 Only JIT symbols that are unavailable:
fixes CodeGeneration/Symbols.C
2021-02-25 20:44:18 +01:00
Axel Naumann
b118f4dee3 Get rid of extra-complex built_cling:
that is anyway what we want to test, always.
And nothing seems to set the env var.
2021-02-25 20:44:18 +01:00
Axel Naumann
ffc267b9dd Import updated lit config:
Copy and adapt lit.cfg from clang.
Export the CMake variable cling needs.
Add missing, now needed call to lit.llvm.initialize.
Remove unused "loadable_module" feature.
2021-02-25 20:44:18 +01:00
Vassil Vassilev
19543be988 LLVM-9 recommends gcc version at least 5.1
The reason is that llvm soon will use new features which are not available
on older versions.

That is a temporary fix to support gcc 4.8 and higher.
2021-02-25 20:44:18 +01:00
Vassil Vassilev
0ae75bafcd cling::Transaction::Initialize does not need Sema. 2021-02-25 20:44:18 +01:00
Vassil Vassilev
a4a06e0fdf Fix warnings coming from shadowing names. 2021-02-25 20:44:18 +01:00
Vassil Vassilev
d0904c1ec2 Remove unused member from the JIT. 2021-02-25 20:44:18 +01:00
Vassil Vassilev
deafa47202 Remove unused parameters. Fixes -Wunused-parameter. 2021-02-25 20:44:18 +01:00
Vassil Vassilev
23dadd0812 Mark the include directories of clang and llvm as system. 2021-02-25 20:44:18 +01:00
Vassil Vassilev
cad5c25c17 Implement -Dbuiltin_cling=Off
Cling needs to be built and installed as part of llvm/clang and
then we need to specify paths as we do for builtin_clang=Off.
2021-02-25 20:44:18 +01:00
Vassil Vassilev
45002e650d Complete the upgrade to LLVM/Clang 9.0 for cling. 2021-02-25 20:44:18 +01:00
Vassil Vassilev
36ffd9a3d5 Include ExternalProject for the clad plugin.
That allows building clad for cling standalone.
2021-02-25 20:44:18 +01:00