Skip to content

Commit 66ef46b

Browse files
authored
Remove compatibility for LLVM < 14 (#606)
* Remove compatibility with LLVM < 14 * Remove redundant VectorType compat file * Remove redundant Attributes compat file * Remove redundant BitcodeReaderWriter compat file * Remove redundant Verifier compat file * Remove redundant Cloning compat file * Remove redundant DebugInfo compat file * Remove redundant GlobalValue compat file * Remove redundant FileSystem compat file * Remove redundant JITSymbol compat file * Remove redundant TargetLibraryInfo compat file * Remove redundant ScalarTransforms compat file * Actually remove the file this time * Remove redundant ToolOutputFile compat file * Remove redundant DataLayout compat file * Move Error helpers out of Compat directory * Remove redundant CallSite compat file * Remove redundant RuntimeDyld compat file * Remove redundant CTypes compat file * Modify build script to exclude LLVM 13 * Update references to LLVM in README
1 parent 65549b3 commit 66ef46b

31 files changed

+46
-1115
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Most of Remill's dependencies can be provided by the [cxx-common](https://github
4040
| [Google Flags](https://github.com/google/glog) | Latest |
4141
| [Google Log](https://github.com/google/glog) | Latest |
4242
| [Google Test](https://github.com/google/googletest) | Latest |
43-
| [LLVM](http://llvm.org/) | 12 |
44-
| [Clang](http://clang.llvm.org/) | 12 |
43+
| [LLVM](http://llvm.org/) | 14 |
44+
| [Clang](http://clang.llvm.org/) | 14 |
4545
| [Intel XED](https://software.intel.com/en-us/articles/xed-x86-encoder-decoder-software-library) | Latest |
4646
| [Python](https://www.python.org/) | 2.7 |
4747
| Unzip | Latest |
@@ -55,7 +55,7 @@ Remill now comes with a Dockerfile for easier testing. This Dockerfile reference
5555

5656
The Dockerfile allows for quick builds of multiple supported LLVM, architecture, and Linux configurations.
5757

58-
Quickstart (builds Remill against LLVM 12 on Ubuntu 20.04 for AMD64):
58+
Quickstart (builds Remill against LLVM 14 on Ubuntu 20.04 for AMD64):
5959

6060
Clone Remill:
6161
```shell
@@ -71,15 +71,15 @@ docker build . -t remill \
7171
-f Dockerfile \
7272
--build-arg UBUNTU_VERSION=20.04 \
7373
--build-arg ARCH=amd64 \
74-
--build-arg LLVM_VERSION=12
74+
--build-arg LLVM_VERSION=14
7575
```
7676

7777
Ensure remill works:
7878
```shell
7979
# Decode some AMD64 instructions to LLVM
8080
docker run --rm -it remill \
8181
--arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
82-
82+
8383
# Decode some AArch64 instructions to LLVM
8484
docker run --rm -it remill \
8585
--arch aarch64 --address 0x400544 --ir_out /dev/stdout \

include/remill/Arch/Arch.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#pragma clang diagnostic ignored "-Wold-style-cast"
2424
#pragma clang diagnostic ignored "-Wdocumentation"
2525
#pragma clang diagnostic ignored "-Wswitch-enum"
26-
#include <remill/BC/Compat/CTypes.h>
27-
#include <remill/BC/Compat/CallingConvention.h>
2826

2927
#include <llvm/ADT/SmallVector.h>
3028
#include <llvm/ADT/Triple.h>

include/remill/BC/Annotate.h

Lines changed: 0 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ DECLARE_FUNC_ORIGIN_TYPE(Semantics, Helper);
7272
// is supposed to be part of multiple pairs
7373
const std::string TieKind = "remill.function.tie";
7474

75-
// Versions before LLVM-4.0 do not have metadata for functions. There is (probably) no reasonable way
76-
// to simulate them, therefore older version do not provide this functionality. However, since these
77-
// annotations are not crucial to lift itself, definition of functions are provided (so that project)
78-
// compiles. They issue error and return negative answers and nullptrs.
79-
80-
#if LLVM_VERSION_NUMBER >= LLVM_VERSION(4, 0)
81-
8275
template <typename OriginType>
8376
static bool Contains(llvm::MDString *node) {
8477
return node && node->getString().contains(OriginType::metadata_value);
@@ -253,142 +246,4 @@ GetTieMapping(llvm::Module &module, const std::string &kind = TieKind) {
253246
std::vector<std::string>{kind});
254247
}
255248

256-
#else
257-
258-
# define NOT_AVAILABLE(Err) \
259-
LOG(Err) \
260-
<< "LLVM version is less than 4.0, functions metadata are not avalaible"
261-
262-
template <typename OriginType>
263-
static bool Contains(llvm::MDString *node) {
264-
NOT_AVAILABLE(ERROR);
265-
return false;
266-
}
267-
268-
template <typename OriginType>
269-
static llvm::MDNode *GetNode(llvm::Function *func) {
270-
NOT_AVAILABLE(ERROR);
271-
return nullptr;
272-
}
273-
274-
template <typename OriginType>
275-
static bool Remove(llvm::Function *func) {
276-
NOT_AVAILABLE(ERROR);
277-
return false;
278-
}
279-
280-
// Give function OriginType
281-
template <typename OriginType>
282-
static void Annotate(llvm::Function *func) {
283-
NOT_AVAILABLE(ERROR);
284-
}
285-
286-
template <typename OriginType>
287-
static bool HasOriginType(llvm::Function *func) {
288-
NOT_AVAILABLE(ERROR);
289-
return false;
290-
}
291-
292-
template <typename Type, typename Second, typename... OriginTypes>
293-
static bool HasOriginType(llvm::Function *func) {
294-
NOT_AVAILABLE(ERROR);
295-
return false;
296-
}
297-
298-
template <typename Container, typename... OriginTypes>
299-
static void GetFunctionsByOrigin(llvm::Module &module, Container &result) {
300-
NOT_AVAILABLE(ERROR);
301-
}
302-
303-
template <typename Container, typename... OriginTypes>
304-
static Container GetFunctionsByOrigin(llvm::Module &module) {
305-
NOT_AVAILABLE(ERROR);
306-
return {};
307-
}
308-
309-
template <typename OriginType>
310-
static void ChangeOriginType(llvm::Function *func) {
311-
NOT_AVAILABLE(ERROR);
312-
}
313-
314-
template <typename OriginType, typename OldType>
315-
static bool ChangeOriginType(llvm::Function *func) {
316-
NOT_AVAILABLE(ERROR);
317-
return false;
318-
}
319-
320-
static inline llvm::MDNode *GetTieNode(llvm::Function *func,
321-
const std::string &kind = TieKind) {
322-
NOT_AVAILABLE(ERROR);
323-
return nullptr;
324-
}
325-
326-
static inline bool IsTied(llvm::Function *func,
327-
const std::string &kind = TieKind) {
328-
NOT_AVAILABLE(ERROR);
329-
return false;
330-
}
331-
332-
static inline llvm::MDNode *TieFunction(llvm::Function *first,
333-
llvm::Function *second,
334-
const std::string &kind = TieKind) {
335-
NOT_AVAILABLE(ERROR);
336-
return nullptr;
337-
}
338-
339-
static inline std::pair<llvm::MDNode *, llvm::MDNode *>
340-
TieFunctions(llvm::Function *first, llvm::Function *second,
341-
const std::string &kind = TieKind) {
342-
NOT_AVAILABLE(ERROR);
343-
return {};
344-
}
345-
346-
static inline llvm::Function *GetTied(llvm::Function *func,
347-
const std::string &kind = TieKind) {
348-
NOT_AVAILABLE(ERROR);
349-
return nullptr;
350-
}
351-
352-
template <typename BinaryPredicate>
353-
static void
354-
GetTieMapping(llvm::Module &module, BinaryPredicate pred,
355-
std::unordered_map<llvm::Function *, llvm::Function *> &result,
356-
const std::string &kind = TieKind) {
357-
NOT_AVAILABLE(ERROR);
358-
}
359-
360-
template <typename BinaryPredicate, typename Container>
361-
static std::unordered_map<llvm::Function *, llvm::Function *>
362-
GetTieMapping(llvm::Module &module, BinaryPredicate pred,
363-
const Container &kinds) {
364-
NOT_AVAILABLE(ERROR);
365-
return {};
366-
}
367-
368-
template <typename FromType, typename ToType = BaseFunction,
369-
typename Container = std::vector<std::string>>
370-
static std::unordered_map<llvm::Function *, llvm::Function *>
371-
GetTieMapping(llvm::Module &module, const Container &kinds) {
372-
NOT_AVAILABLE(ERROR);
373-
return {};
374-
}
375-
376-
template <typename FromType, typename ToType = BaseFunction>
377-
static std::unordered_map<llvm::Function *, llvm::Function *>
378-
GetTieMapping(llvm::Module &module, const std::string &kind = TieKind) {
379-
NOT_AVAILABLE(ERROR);
380-
return {};
381-
}
382-
383-
static inline std::unordered_map<llvm::Function *, llvm::Function *>
384-
GetTieMapping(llvm::Module &module, const std::string &kind = TieKind) {
385-
NOT_AVAILABLE(ERROR);
386-
return {};
387-
}
388-
389-
# undef NOT_AVAILABLE
390-
391-
#endif
392-
393-
394249
} // namespace remill

include/remill/BC/Compat/Attributes.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

include/remill/BC/Compat/BitcodeReaderWriter.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

include/remill/BC/Compat/CTypes.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

include/remill/BC/Compat/CallSite.h

Lines changed: 0 additions & 104 deletions
This file was deleted.

0 commit comments

Comments
 (0)