[clang] [clang] Drop `sign-return-address-buildattr` module flag emission (PR #211021)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 21 08:52:36 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
Author: Daniil Kovalev (kovdan01)
<details>
<summary>Changes</summary>
1. The flag emission was gated by `ptrauth` target feature which does not actually exist: see `AArch64TargetInfo::computeFeatureLookup()` and `ARMTargetInfo::hasFeature(StringRef Feature)`. So, it was never emitted.
2. The flag is never exercised elsewhere by existing tests or code across the whole LLVM source tree.
Note: the flag was previously introduced in https://reviews.llvm.org/D112421
---
Full diff: https://github.com/llvm/llvm-project/pull/211021.diff
1 Files Affected:
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+3-9)
``````````diff
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 5f5fc4401bb4e..c1cd7a0d5b597 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1496,20 +1496,14 @@ void CodeGenModule::Release() {
if (CodeGenOpts.IndirectBranchCSPrefix)
getModule().addModuleFlag(llvm::Module::Override, "indirect_branch_cs_prefix", 1);
- // Add module metadata for return address signing (ignoring
- // non-leaf/all) and stack tagging. These are actually turned on by function
- // attributes, but we use module metadata to emit build attributes. This is
- // needed for LTO, where the function attributes are inside bitcode
+ // Add module metadata for stack tagging. This is actually turned on by
+ // function attributes, but we use module metadata to emit build attributes.
+ // This is needed for LTO, where the function attributes are inside bitcode
// serialised into a global variable by the time build attributes are
// emitted, so we can't access them. LTO objects could be compiled with
// different flags therefore module flags are set to "Min" behavior to achieve
// the same end result of the normal build where e.g BTI is off if any object
// doesn't support it.
- if (Context.getTargetInfo().hasFeature("ptrauth") &&
- LangOpts.getSignReturnAddressScope() !=
- LangOptions::SignReturnAddressScopeKind::None)
- getModule().addModuleFlag(llvm::Module::Override,
- "sign-return-address-buildattr", 1);
if (LangOpts.Sanitize.has(SanitizerKind::MemtagStack))
getModule().addModuleFlag(llvm::Module::Override,
"tag-stack-memory-buildattr", 1);
``````````
</details>
https://github.com/llvm/llvm-project/pull/211021
More information about the cfe-commits
mailing list