mirror of
https://github.com/lifting-bits/remill
synced 2026-06-21 13:56:07 +00:00
More fixes
This commit is contained in:
@@ -21,7 +21,7 @@ namespace remill {
|
||||
|
||||
// TODO(alex): Just remove this function entirely
|
||||
inline static llvm::Type *PointerElementType(llvm::PointerType *type) {
|
||||
assert(type->isOpaque());
|
||||
// assert(type->isOpaque());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
+2
-7
@@ -496,11 +496,7 @@ FinishAddressOf(llvm::IRBuilder<> &ir, const llvm::DataLayout &dl,
|
||||
// Best case: we've found a value field in the structure that
|
||||
// is located at the correct byte offset.
|
||||
if (gep_offset == reg->offset) {
|
||||
if (gep->getType()->isPointerTy()) {
|
||||
return gep;
|
||||
|
||||
} else if (auto const_gep = llvm::dyn_cast<llvm::Constant>(gep);
|
||||
const_gep) {
|
||||
if (auto const_gep = llvm::dyn_cast<llvm::Constant>(gep); const_gep) {
|
||||
return llvm::ConstantExpr::getBitCast(const_gep, goal_ptr_type);
|
||||
|
||||
} else {
|
||||
@@ -574,8 +570,7 @@ llvm::Value *Register::AddressOf(llvm::Value *state_ptr,
|
||||
return AddressOf(state_ptr, ir);
|
||||
}
|
||||
|
||||
llvm::Value *
|
||||
Register::AddressOf(llvm::Value *state_ptr,
|
||||
llvm::Value *Register::AddressOf(llvm::Value *state_ptr,
|
||||
llvm::IRBuilder<> &ir) const {
|
||||
auto &context = type->getContext();
|
||||
CHECK_EQ(&context, &(state_ptr->getContext()));
|
||||
|
||||
@@ -1464,6 +1464,9 @@ llvm::GlobalVariable *DeclareVarInModule(llvm::GlobalVariable *var,
|
||||
return llvm::dyn_cast<llvm::GlobalVariable>(moved_var);
|
||||
}
|
||||
|
||||
// NOTE(alex): This looks difficult to reproduce without querying `PointerElementType`.
|
||||
// It appears to be transferring global variables from one LLVM module to another. The
|
||||
// variables are pointer types.
|
||||
auto &dest_context = dest_module->getContext();
|
||||
const auto type = ::remill::RecontextualizeType(
|
||||
PointerElementType(var->getType()), dest_context);
|
||||
@@ -2433,6 +2436,7 @@ llvm::Value *BuildPointerToOffset(llvm::IRBuilder<> &ir, llvm::Value *ptr,
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE(alex): Same here
|
||||
const auto dest_elem_type = PointerElementType(dest_elem_ptr_type);
|
||||
const auto ptr_elem_type = PointerElementType(ptr_type);
|
||||
const auto ptr_elem_size = dl.getTypeAllocSize(ptr_elem_type);
|
||||
|
||||
Reference in New Issue
Block a user