llvm.org GIT mirror llvm / 718dba1
ModuleUtils: Stop using comdat members to generate unique module ids. It is possible for two modules to define the same set of external symbols without causing a duplicate symbol error at link time, as long as each of the symbols is a comdat member. So we cannot use them as part of a unique id for the module. Differential Revision: https://reviews.llvm.org/D38602 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315026 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 2 years ago
4 changed file(s) with 11 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
8484 Module &M, SmallVectorImpl &DeadComdatFunctions);
8585
8686 /// \brief Produce a unique identifier for this module by taking the MD5 sum of
87 /// the names of the module's strong external symbols.
87 /// the names of the module's strong external symbols that are not comdat
88 /// members.
8889 ///
8990 /// This identifier is normally guaranteed to be unique, or the program would
9091 /// fail to link due to multiply defined symbols.
242242 bool ExportsSymbols = false;
243243 auto AddGlobal = [&](GlobalValue &GV) {
244244 if (GV.isDeclaration() || GV.getName().startswith("llvm.") ||
245 !GV.hasExternalLinkage())
245 !GV.hasExternalLinkage() || GV.hasComdat())
246246 return;
247247 ExportsSymbols = true;
248248 Md5.update(GV.getName());
1212
1313 @al = external unnamed_addr alias i8*, getelementptr inbounds ({ [1 x i8*] }, { [1 x i8*] }* @anon, i32 0, i32 0, i32 1)
1414
15 @foo = global i32 1
16
1517 !0 = !{i64 8, !"?AVA@@"}
2020 ret void
2121 }
2222
23 $h = comdat any
24 ; CHECK: define void @h() comdat
25 define void @h() comdat {
26 ret void
27 }
28
2329 !0 = !{i32 0, !"typeid"}