diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-31 21:22:58 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-31 21:22:58 +0000 |
| commit | 5ffd83dbcc34f10e07f6d3e968ae6365869615f4 (patch) | |
| tree | 0e9f5cf729dde39f949698fddef45a34e2bc7f44 /contrib/llvm-project/llvm/lib/Object/IRSymtab.cpp | |
| parent | 1799696096df87b52968b8996d00c91e0a5de8d9 (diff) | |
| parent | cfca06d7963fa0909f90483b42a6d7d194d01e08 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Object/IRSymtab.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Object/IRSymtab.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/lib/Object/IRSymtab.cpp b/contrib/llvm-project/llvm/lib/Object/IRSymtab.cpp index e4282b9d6bd3..e39cb732add1 100644 --- a/contrib/llvm-project/llvm/lib/Object/IRSymtab.cpp +++ b/contrib/llvm-project/llvm/lib/Object/IRSymtab.cpp @@ -181,7 +181,7 @@ Expected<int> Builder::getComdatIndex(const Comdat *C, const Module *M) { llvm::raw_string_ostream OS(Name); Mang.getNameWithPrefix(OS, GV, false); } else { - Name = C->getName(); + Name = std::string(C->getName()); } storage::Comdat Comdat; @@ -264,9 +264,13 @@ Error Builder::addSymbol(const ModuleSymbolTable &Msymtab, Sym.Flags |= unsigned(GV->getVisibility()) << storage::Symbol::FB_visibility; if (Flags & object::BasicSymbolRef::SF_Common) { + auto *GVar = dyn_cast<GlobalVariable>(GV); + if (!GVar) + return make_error<StringError>("Only variables can have common linkage!", + inconvertibleErrorCode()); Uncommon().CommonSize = GV->getParent()->getDataLayout().getTypeAllocSize( GV->getType()->getElementType()); - Uncommon().CommonAlign = GV->getAlignment(); + Uncommon().CommonAlign = GVar->getAlignment(); } const GlobalObject *Base = GV->getBaseObject(); |
