llvm: force strip without libllvm to avoid unimplemented behavior

Also fix deinit bugs.
This commit is contained in:
Jacob Young
2023-08-08 22:34:24 -04:00
parent 53bea0f7e4
commit 3e1dd93bb2
2 changed files with 21 additions and 6 deletions

View File

@@ -1131,7 +1131,16 @@ void ZigLLVMEraseGlobalValue(LLVMValueRef GlobalVal) {
}
void ZigLLVMDeleteGlobalValue(LLVMValueRef GlobalVal) {
delete unwrap<GlobalVariable>(GlobalVal);
auto *GV = unwrap<GlobalValue>(GlobalVal);
assert(GV->getParent() == nullptr);
switch (GV->getValueID()) {
#define HANDLE_GLOBAL_VALUE(NAME) \
case Value::NAME##Val: \
delete static_cast<NAME *>(GV); \
break;
#include <llvm/IR/Value.def>
default: llvm_unreachable("Expected global value");
}
}
void ZigLLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) {