mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-03-14 20:17:16 +00:00
[asan] Rename the ABI versioning symbol to '__asan_version_mismatch_check' instead of abusing '__asan_init'
We currently version `__asan_init` and when the ABI version doesn't match, the linker gives a `undefined reference to '__asan_init_v5'` message. From this, it might not be obvious that it's actually a version mismatch error. This patch makes the error message much clearer by changing the name of the undefined symbol to be `__asan_version_mismatch_check_xxx` (followed by the version string). We obviously don't want the initializer to be named like that, so it's a separate symbol that is used only for the purpose of version checking. Reviewed at http://reviews.llvm.org/D11004 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243003 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -107,7 +107,8 @@ Function *llvm::checkSanitizerInterfaceFunction(Constant *FuncOrBitcast) {
|
||||
|
||||
std::pair<Function *, Function *> llvm::createSanitizerCtorAndInitFunctions(
|
||||
Module &M, StringRef CtorName, StringRef InitName,
|
||||
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs) {
|
||||
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
|
||||
StringRef VersionCheckName) {
|
||||
assert(!InitName.empty() && "Expected init function name");
|
||||
assert(InitArgTypes.size() == InitArgTypes.size() &&
|
||||
"Sanitizer's init function expects different number of arguments");
|
||||
@@ -122,6 +123,13 @@ std::pair<Function *, Function *> llvm::createSanitizerCtorAndInitFunctions(
|
||||
AttributeSet()));
|
||||
InitFunction->setLinkage(Function::ExternalLinkage);
|
||||
IRB.CreateCall(InitFunction, InitArgs);
|
||||
if (!VersionCheckName.empty()) {
|
||||
Function *VersionCheckFunction =
|
||||
checkSanitizerInterfaceFunction(M.getOrInsertFunction(
|
||||
VersionCheckName, FunctionType::get(IRB.getVoidTy(), {}, false),
|
||||
AttributeSet()));
|
||||
IRB.CreateCall(VersionCheckFunction, {});
|
||||
}
|
||||
return std::make_pair(Ctor, InitFunction);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user