about summary refs log tree commit diff homepage
path: root/lib/Module/ModuleUtil.cpp
AgeCommit message (Collapse)Author
2020-12-04llvm11: Use getCalledOperand instead of getCalledValueLukas Zaoral
CallBase::getCalledValue has been deprecated by getCalledOperand since LLVM 8 and has been removed in LLVM 11 See: https://reviews.llvm.org/D78882
2020-12-04llvm11: Make conversions from StringRef to std::string explicitLukas Zaoral
The same applies to SmallString. See: llvm/llvm-project@777180a#diff-497ba4c0c527a125d382b51a34f32542
2020-10-12Implemented support for C++ ExceptionsFelix Rath
We implement the Itanium ABI unwinding base-API, and leave the C++-specific parts to libcxxabi. Co-authored-by: Lukas Wölfer <lukas.woelfer@rwth-aachen.de>
2020-10-09Replace `NULL` with explicit `nullptr`Martin Nowack
2020-10-09Explicitly track global variables in getDirectCallTargetMartin Nowack
Global variables can't be a direct call target. Their values are read and treated as indirect call targets.
2020-09-26Replace llvm::CallSite with llvm::CallBase on LLVM 8+Lukas Zaoral
This is in preparation for LLVM 11 as the llvm:CallSite class has been removed.
2020-04-30Removed the Internal directory from include/kleeCristian Cadar
2019-03-21drop support for LLVM <= 3.7Julian Büning
2019-03-21remove obsolete LegacyLLVMPassManagerTyJulian Büning
2019-03-17run VerifierPass after optimization and instrumentationJulian Büning
2018-10-26llvm5: handle new file_magic's locationJiri Slaby
llvm 5, moved file_magic to BinaryFormat in commit 19ca2b0f9daed883c21730285d7f04424e5f5f88, so adapt to that. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2018-10-04remove obsolete dependency of kleeModule on kleeCoreJulian Büning
2018-09-18llvm4: errorOr and similarJiri Slaby
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2018-09-18llvm4: handle different header namesJiri Slaby
LLVM 4 renamed and splitted some headers. Take this into account in includes. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2018-09-14llvm: make KLEE compile against LLVM 3.9Jiri Slaby
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2018-09-10Unify the error message if that function has not been found.Martin Nowack
2018-07-23ModuleUtil: improve and test valueIsOnlyCalledJulian Büning
* handle BlockAddress (which is not a valid function pointer) * there is no instruction with opcode 0 * add test for functionality
2018-07-23fix: LLVM 3.5, begin_user() instead of begin_use()Julian Büning
With version 3.5, LLVM introduced a subtle semantic change in the API of `Value`. With that change, `use_begin()` is renamed to `user_begin()`. Additionally, a new method `use_begin()` with a different meaning was introduced. Now, `use_begin()` actually iterates over `Use`s, whereas before, dereferencing it would give a `User *`. For further details, please refer to https://reviews.llvm.org/rL203364. Due to the reintroduction of `use_begin()`, existing code may still compile, although the semantics have changed. In the code changed with this patch, all `dyn_cast`s for `Use` fail and the else branch is always taken.
2018-07-12llvm38: archive child iterator changesJiri Slaby
After LLVM commit 25569fdcdab0, archive iterator returns object::Archive::Child instead of child_iterator, adapt to that. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2018-07-12llvm38: adapt to new Linker::linkModulesJiri Slaby
LLVM commit d912be98f8eb changed the prototype of linkModules to accept std::unique_ptr. Adapt to that. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2018-07-04Reorder linking and optimizationsMartin Nowack
Link intrinsic library before executing optimizations. This makes sure that any optimization run by KLEE on the module is executed for the intrinsic library as well. Support .ll files as input for KLEE as well.
2018-05-24llvm: make KLEE compile against LLVM 3.7Richard Trembecký
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2017-10-03Silenced some warnings about unused variables when assertions are disabled.Cristian Cadar
2017-07-23Remove support for LLVM < 3.4Martin Nowack
Request LLVM 3.4 as minimal requirement for KLEE
2017-06-16move module loading into external functionJörg Thalheim
- having an explicit function which is defined for multiple llvm versions separately increases readability. - also: error handling was simplified - Personal motivation: being able to use this functionality in unit tests fixes #561 related to #656
2017-05-24llvm: make KLEE compile against LLVM 3.5 and 3.6Richard Trembecký
Based on work by @ccadeptic23 and @delcypher. Formatting fixed by @snf. Fix compiler warning by @martijnthe. Further fixes by @mchalupa. Refactored, so that changes can be reviewed -- no massive changes in whitespace and in the surrounding code. Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2017-02-28Module: simplify is_object checksJiri Slaby
object::Binary has isObject method, which can be used to check whether it is an object::ObjectFile. Use that, since dyn_casting of object::Binary is not allowed in newer LLVMs: lib/Module/ModuleUtil.cpp:304:78: error: cannot convert ‘llvm::object::ObjectFile’ to ‘llvm::object::ObjectFile*’ in initialization else if (object::ObjectFile *o = dyn_cast<object::ObjectFile>(child.get())) ^ Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2017-02-25llvm: stop using global contextJiri Slaby
It was marked as deprecated long time ago and finally removed in LLVM 3.9. Remove all uses of getGlobalContext and create our own context. Propagate it all over the code then. [v2] use ctx, not C as name Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
2017-02-21Teach `klee::getDirectCallTarget()` to resolve weak aliases. This isDan Liew
controlled by a new parameter `moduleIsFullyLinked`. When true the linkage type of a weak alias is ignored. It is legal to do this when the module is fully linked because there won't be another function that could override the weak alias. This fixes a previous assertion failure in `klee::getDirectCallTarget()` triggered by the `test/regression/2016-11-24-bitcast-weak-alias.c` test case.
2016-02-20Fix valueIsOnlyCalled() used by MD2U.Sean Bartell
CallInst::getOperand() uses incompatible operand orders across LLVM versions. Use CallSite::hasArgument() instead. This bug prevented the MD2U searcher from working correctly.
2015-12-17Refactoring: Moving klee_warning/_error functions to ErrorHandling in ↵Martin Nowack
Support directory
2015-04-29Fix assertion failure in getDirectCallTargetSean Bartell
It failed when the function being called is a bitcasted alias.
2014-09-16Fix compilation error due to r199218. Maybe we should just remove thisDan Liew
assertion entirely?
2014-09-14[LLVM3.5] Update for more random headers moving around.Daniel Dunbar
2014-09-14[LLVM3.5] Update for move of CFG.h into IR.Daniel Dunbar
- Mostly fixed by removing unnecessary references.
2014-09-14[LLVM3.5] Update for CallSite.h move into IR/.Daniel Dunbar
2014-09-13Add KLEE specific DEBUG macros.Daniel Dunbar
- This allows us to build in +Asserts mode even when LLVM isn't (by disabling the checks in that mode). - Eventually it would be nice to just move off of LLVM's DEBUG infrastructure entirely and just have our own copy, but this works for now. - Fixes #150.
2014-05-29Remove #include <iostream> to avoid static constructorsMartin Nowack
iostream injects static constructor function into every compilation unit. Remove this to avoid it.
2014-04-14Add missing include file for LLVM 3.4Martin Nowack
2014-02-14When running with -debug-only=klee_linker do not report the numberDan Liew
of modules left because this information is no longer correct (we no longer shrink the vector).
2014-02-14Refactor cleaning up memory in linkBCA() so that if linking failsDan Liew
then clean up is performed.
2014-02-14Refactor variable name s/RemovedSymbols/SymbolsToRemove/Dan Liew
because "RemovedSymbols" implies that the symbols have already been removed which is misleading because we don't remove until the end.
2014-02-14Correct and tidy up comments.Dan Liew
2014-02-06Fix access of iterators after they have been invalidatedMartin Nowack
Iterators get invalidated after elements of std::vector/set are deleted. Avoid this by remembering which elements need to be deleted and do it after iterating over the data structure.
2014-02-06When using KLEE's built-in Bitcode archive linker do not considerDan Liew
KLEE intrinsics as undefined symbols
2014-02-06Do not consider llvm intrinsics as undefined symbols in KLEE'sDan Liew
bitcode archive linker.
2014-02-06Improved archive (of bitcode modules) linking performance forDan Liew
LLVM >= 3.3 by effectively reimplementing the linking algorithm used in LLVM <= 3.2. The LLVM specific bitcode archive format has been removed from LLVM >= 3.3 . Now archives are normal system archives that can contain LLVM bitcode modules as well as regular binary object files. The previous commit implemented an approach where ALL the bitcode modules get linked in which can be terribly slow when klee-uclibc gets linked (~600 LLVM modules). Here are the options that I considered to address this: * Use LD with LLVM gold plug-in and call as an external program. I Don't really want to add another dependency to KLEE. It already has enough! * Use the upcomming LLVM linker (lld). Not really an option because at the time of writing there is no support for linking archives of bitcode modules. * Don't use archives at all and just work with modules (i.e. replace uses of llvm-ar with llvm-link and tinker with the flags a little). This isn't so great because the resulting LLVM bitcode module we execute is bigger than it should be. * Reimpelent bitcode archive linking ourselves in a slightly better way. I've gone for the last option This implementation unfortunately loads all bitcode modules into memory first so we can query the module symbols tables. I would prefer to read the archive's index and link in modules on demand but unfortunately although the new Object::Archive interface in LLVM allows iteration over symbols it doesn't provide a way of knowing if that symbol is defined/undefined. This implementation is far from perfect!
2014-02-06Add support for archive and single bc file linkingMartin Nowack
With LLVM 3.3 the linker does not support reading of archive files directly. This brings the support back (based on llvm-mn). Furthermore, linking single bc files or archives with bc and object files mixed is supported as well.
2014-01-17Fix error message for failing linking of librariesMartin Nowack
In case linking of external libraries failed, user would only be informed if KLEE is compiled with assertions enabled. This fix lets KLEE always fail.
2013-12-06Deprecate LLVM 2.8 and lowerMartin Nowack