[CodeGen] Change getSDagStackGuard to get an internal sym.

Fixes a crash in the backend during an LTO build of rtld(1) in
FreeBSD.

llvm-svn: 272262
This commit is contained in:
Davide Italiano 2016-06-09 14:23:38 +00:00
parent 62d5d2ff36
commit 74d4553b12
2 changed files with 14 additions and 1 deletions

View File

@ -1831,7 +1831,7 @@ void TargetLoweringBase::insertSSPDeclarations(Module &M) const {
// Currently only support "standard" __stack_chk_guard. // Currently only support "standard" __stack_chk_guard.
// TODO: add LOAD_STACK_GUARD support. // TODO: add LOAD_STACK_GUARD support.
Value *TargetLoweringBase::getSDagStackGuard(const Module &M) const { Value *TargetLoweringBase::getSDagStackGuard(const Module &M) const {
return M.getGlobalVariable("__stack_chk_guard"); return M.getGlobalVariable("__stack_chk_guard", true);
} }
Value *TargetLoweringBase::getSSPStackGuardCheck(const Module &M) const { Value *TargetLoweringBase::getSSPStackGuardCheck(const Module &M) const {

View File

@ -0,0 +1,13 @@
; Check that the backend doesn't crash.
; RUN: llc -mtriple=x86_64-pc-freebsd %s -o - | FileCheck %s
@__stack_chk_guard = internal global [8 x i64] zeroinitializer, align 16
define void @f() sspstrong {
%tbl = alloca [4 x i64], align 16
ret void
}
; CHECK: .type __stack_chk_guard,@object
; CHECK: .local __stack_chk_guard
; CHECK: .comm __stack_chk_guard,64,16