diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 8ce4063a3b780..817b2b5e6a69d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1517,24 +1517,6 @@ 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 - // 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); - if (T.isARM() || T.isThumb() || T.isAArch64()) { // Previously 1 is used and meant for the backed to derive the function // attribute form it. 2 now means function attributes already set for all