mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
[asan] remove .preinit_array from the compiler module (it breaks .so builds). This should be done in the run-time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146527 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -163,8 +163,6 @@ struct AddressSanitizer : public ModulePass {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void appendToPreinitArray(Module &M, Function *F);
|
|
||||||
|
|
||||||
uint64_t getAllocaSizeInBytes(AllocaInst *AI) {
|
uint64_t getAllocaSizeInBytes(AllocaInst *AI) {
|
||||||
Type *Ty = AI->getAllocatedType();
|
Type *Ty = AI->getAllocatedType();
|
||||||
uint64_t SizeInBytes = TD->getTypeStoreSizeInBits(Ty) / 8;
|
uint64_t SizeInBytes = TD->getTypeStoreSizeInBits(Ty) / 8;
|
||||||
@@ -565,17 +563,6 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .preinit_array is something that hapens before all other inits.
|
|
||||||
// On systems where .preinit_array is honored, we will call __asan_init early.
|
|
||||||
void AddressSanitizer::appendToPreinitArray(Module &M, Function *F) {
|
|
||||||
IRBuilder<> IRB(M.getContext());
|
|
||||||
GlobalVariable *Var =
|
|
||||||
new GlobalVariable(M, PointerType::getUnqual(F->getFunctionType()),
|
|
||||||
false, GlobalValue::PrivateLinkage,
|
|
||||||
F, "__asan_preinit_private");
|
|
||||||
Var->setSection(".preinit_array");
|
|
||||||
}
|
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
bool AddressSanitizer::runOnModule(Module &M) {
|
bool AddressSanitizer::runOnModule(Module &M) {
|
||||||
// Initialize the private fields. No one has accessed them before.
|
// Initialize the private fields. No one has accessed them before.
|
||||||
@@ -647,9 +634,6 @@ bool AddressSanitizer::runOnModule(Module &M) {
|
|||||||
|
|
||||||
appendToGlobalCtors(M, AsanCtorFunction, 1 /*high priority*/);
|
appendToGlobalCtors(M, AsanCtorFunction, 1 /*high priority*/);
|
||||||
|
|
||||||
if (M.getTargetTriple().find("linux") != std::string::npos)
|
|
||||||
appendToPreinitArray(M, AsanInitFunction);
|
|
||||||
|
|
||||||
return Res;
|
return Res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user