27
27
#include < clang/Lex/PreprocessorOptions.h>
28
28
#include < glog/logging.h>
29
29
#include < llvm/ADT/SmallVector.h>
30
- #include < llvm/ADT/Triple.h>
31
30
#include < llvm/ADT/Twine.h>
32
31
#include < llvm/Demangle/Demangle.h>
33
32
#include < llvm/ExecutionEngine/ExecutionEngine.h>
38
37
#include < llvm/Support/TargetSelect.h>
39
38
#include < llvm/Support/raw_os_ostream.h>
40
39
40
+ #if LLVM_VERSION_MAJOR <= 15
41
+ #include < llvm/ADT/Triple.h>
42
+ #else
43
+ #include < llvm/TargetParser/Triple.h>
44
+ #endif
45
+
41
46
#include < array>
42
47
#include < boost/range/combine.hpp>
43
48
#include < boost/scope_exit.hpp>
@@ -135,6 +140,13 @@ OICompiler::Disassembler::operator()() {
135
140
* allocate memory and prepare the relocation.
136
141
*/
137
142
class OIMemoryManager : public RTDyldMemoryManager {
143
+ private:
144
+ #if LLVM_VERSION_MAJOR <= 15
145
+ using ReserveAllocationSpaceAlignTy = uint32_t ;
146
+ #else
147
+ using ReserveAllocationSpaceAlignTy = llvm::Align;
148
+ #endif
149
+
138
150
public:
139
151
struct Slab {
140
152
private:
@@ -244,8 +256,13 @@ class OIMemoryManager : public RTDyldMemoryManager {
244
256
bool needsToReserveAllocationSpace (void ) override {
245
257
return true ;
246
258
}
247
- void reserveAllocationSpace (
248
- uintptr_t , uint32_t , uintptr_t , uint32_t , uintptr_t , uint32_t ) override ;
259
+
260
+ void reserveAllocationSpace (uintptr_t ,
261
+ ReserveAllocationSpaceAlignTy,
262
+ uintptr_t ,
263
+ ReserveAllocationSpaceAlignTy,
264
+ uintptr_t ,
265
+ ReserveAllocationSpaceAlignTy) override ;
249
266
250
267
uint8_t * allocateCodeSection (uintptr_t ,
251
268
unsigned ,
@@ -281,12 +298,17 @@ class OIMemoryManager : public RTDyldMemoryManager {
281
298
}
282
299
};
283
300
284
- void OIMemoryManager::reserveAllocationSpace (uintptr_t codeSize,
285
- uint32_t codeAlign,
286
- uintptr_t roDataSize,
287
- uint32_t roDataAlign,
288
- uintptr_t rwDataSize,
289
- uint32_t rwDataAlign) {
301
+ void OIMemoryManager::reserveAllocationSpace (
302
+ uintptr_t codeSize,
303
+ ReserveAllocationSpaceAlignTy codeAlignIn,
304
+ uintptr_t roDataSize,
305
+ ReserveAllocationSpaceAlignTy roDataAlignIn,
306
+ uintptr_t rwDataSize,
307
+ ReserveAllocationSpaceAlignTy rwDataAlignIn) {
308
+ llvm::Align codeAlign{codeAlignIn};
309
+ llvm::Align roDataAlign{roDataAlignIn};
310
+ llvm::Align rwDataAlign{rwDataAlignIn};
311
+
290
312
/*
291
313
* It looks like the sizes given to us already take into account the
292
314
* alignment restrictions the different type of sections may have. Aligning
@@ -295,9 +317,10 @@ void OIMemoryManager::reserveAllocationSpace(uintptr_t codeSize,
295
317
uint64_t totalSz = alignTo ((codeSize + roDataSize + rwDataSize), 1024 );
296
318
297
319
VLOG (1 ) << " reserveAllocationSpace: codesize " << codeSize << " codeAlign "
298
- << codeAlign << " roDataSize " << roDataSize << " roDataAlign "
299
- << roDataAlign << " rwDataSize " << rwDataSize << " rwDataAlign "
300
- << rwDataAlign << " (Total Size: " << totalSz << " )" ;
320
+ << codeAlign.value () << " roDataSize " << roDataSize
321
+ << " roDataAlign " << roDataAlign.value () << " rwDataSize "
322
+ << rwDataSize << " rwDataAlign " << rwDataAlign.value ()
323
+ << " (Total Size: " << totalSz << " )" ;
301
324
302
325
Slabs.emplace_back (totalSz, codeSize, roDataSize + rwDataSize + 128 );
303
326
0 commit comments