forked from OSchip/llvm-project
[sanitizer-coverage] ensure minimal alignment for coverage counters and guards
llvm-svn: 309610
This commit is contained in:
parent
9f6e41cdba
commit
bb6f079a45
|
@ -487,6 +487,8 @@ GlobalVariable *SanitizerCoverageModule::CreateFunctionLocalArrayInSection(
|
|||
if (auto Comdat = F.getComdat())
|
||||
Array->setComdat(Comdat);
|
||||
Array->setSection(getSectionName(Section));
|
||||
Array->setAlignment(Ty->isPointerTy() ? DL->getPointerSize()
|
||||
: Ty->getPrimitiveSizeInBits() / 8);
|
||||
return Array;
|
||||
}
|
||||
|
||||
|
@ -505,7 +507,6 @@ void SanitizerCoverageModule::CreatePCArray(Function &F,
|
|||
FunctionPCsArray->setInitializer(
|
||||
ConstantArray::get(ArrayType::get(Int8PtrTy, N), PCs));
|
||||
FunctionPCsArray->setConstant(true);
|
||||
FunctionPCsArray->setAlignment(DL->getPointerSize());
|
||||
}
|
||||
|
||||
void SanitizerCoverageModule::CreateFunctionLocalArrays(
|
||||
|
|
|
@ -5,6 +5,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3
|
|||
target triple = "x86_64-unknown-linux-gnu"
|
||||
define void @foo() {
|
||||
entry:
|
||||
; CHECK: section "__sancov_cntrs", align 1
|
||||
; CHECK: %0 = load i8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__sancov_gen_, i64 0, i64 0), !nosanitize
|
||||
; CHECK: %1 = add i8 %0, 1
|
||||
; CHECK: store i8 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @__sancov_gen_, i64 0, i64 0), !nosanitize
|
||||
|
|
|
@ -26,6 +26,7 @@ entry:
|
|||
; CHECK_PC: ret void
|
||||
; CHECK_PC-NOT: call void @__sanitizer_cov_module_init
|
||||
|
||||
; CHECK_PC_GUARD: section "__sancov_guards", align 4
|
||||
; CHECK_PC_GUARD-LABEL: define void @foo
|
||||
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
||||
; CHECK_PC_GUARD: call void @__sanitizer_cov_trace_pc_guard
|
||||
|
|
Loading…
Reference in New Issue