diff options
author | Peter Collingbourne <pcc@google.com> | 2025-04-15 11:12:05 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-15 11:12:05 -0700 |
commit | a5aa0c46c3274eaf25dde4d792a1abd6191cccf9 (patch) | |
tree | f905215b542b670091933a2bfdc01cc376d82cf5 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 3f58ff20fe540fbbc2e5bfea1606f8cdc00d4157 (diff) | |
download | llvm-a5aa0c46c3274eaf25dde4d792a1abd6191cccf9.zip llvm-a5aa0c46c3274eaf25dde4d792a1abd6191cccf9.tar.gz llvm-a5aa0c46c3274eaf25dde4d792a1abd6191cccf9.tar.bz2 |
Introduce -funique-source-file-names flag.
The purpose of this flag is to allow the compiler to assume that each
object file passed to the linker has been compiled using a unique
source file name. This is useful for reducing link times when doing
ThinLTO in combination with whole-program devirtualization or CFI,
as it allows modules without exported symbols to be built with ThinLTO.
Reviewers: vitalybuka, teresajohnson
Reviewed By: teresajohnson
Pull Request: https://github.com/llvm/llvm-project/pull/135728
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 4a48c2f..26e09fe 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1144,6 +1144,10 @@ void CodeGenModule::Release() { 1); } + if (CodeGenOpts.UniqueSourceFileNames) { + getModule().addModuleFlag(llvm::Module::Max, "Unique Source File Names", 1); + } + if (LangOpts.Sanitize.has(SanitizerKind::KCFI)) { getModule().addModuleFlag(llvm::Module::Override, "kcfi", 1); // KCFI assumes patchable-function-prefix is the same for all indirectly |