Skip to content

Commit 2112b81

Browse files
committed
More cleanups.
1 parent 369ac05 commit 2112b81

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,9 +2841,8 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
28412841

28422842
// In the cross-dso CFI mode with canonical jump tables, we want !type
28432843
// attributes on definitions only.
2844-
if ((CodeGenOpts.SanitizeCfiCrossDso &&
2845-
CodeGenOpts.SanitizeCfiCanonicalJumpTables) ||
2846-
CodeGenOpts.CallGraphSection) {
2844+
if (CodeGenOpts.SanitizeCfiCrossDso &&
2845+
CodeGenOpts.SanitizeCfiCanonicalJumpTables) {
28472846
if (auto *FD = dyn_cast<FunctionDecl>(D)) {
28482847
// Skip available_externally functions. They won't be codegen'ed in the
28492848
// current module anyway.
@@ -3070,9 +3069,10 @@ void CodeGenModule::createIndirectFunctionTypeMD(const FunctionDecl *FD,
30703069
// Return if generalized type metadata is already attached.
30713070
if (hasExistingGeneralizedTypeMD(F))
30723071
return;
3072+
30733073
// All functions which are not internal linkage could be indirect targets.
30743074
// Address taken functions with internal linkage could be indirect targets.
3075-
if (!F->hasLocalLinkage() &&
3075+
if (!F->hasLocalLinkage() ||
30763076
F->getFunction().hasAddressTaken(nullptr, /*IgnoreCallbackUses=*/true,
30773077
/*IgnoreAssumeLikeCalls=*/true,
30783078
/*IgnoreLLVMUsed=*/false))
@@ -3258,6 +3258,9 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
32583258
!CodeGenOpts.SanitizeCfiCanonicalJumpTables)
32593259
createFunctionTypeMetadataForIcall(FD, F);
32603260

3261+
if (CodeGenOpts.CallGraphSection)
3262+
createIndirectFunctionTypeMD(FD, F);
3263+
32613264
if (LangOpts.Sanitize.has(SanitizerKind::KCFI))
32623265
setKCFIType(FD, F);
32633266

0 commit comments

Comments
 (0)