Skip to content

Commit 143d450

Browse files
committed
[PPC][BOLT] Fix compilation error "variable 'G' with type 'const auto *' has incompatible initializer of type 'ErrorOr<BinarySection &>", unwrap ErrorOr<BinarySection&> before using it.
1 parent 3faf3ae commit 143d450

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,9 @@ Error RewriteInstance::run() {
744744
discoverFileObjects();
745745

746746
if (BC->isPPC64()) {
747-
if (const auto *G = BC->getUniqueSectionByName(".got")) {
748-
PPC64TOCBase = G->getAddress() + 0x8000; // ELFv2 ABI
747+
if (auto GOrErr = BC->getUniqueSectionByName(".got")) {
748+
const BinarySection &G = *GOrErr;
749+
PPC64TOCBase = G.getAddress() + 0x8000; // ELFv2 ABI
749750
HavePPC64TOCBase = true;
750751
if (opts::Verbosity >= 1)
751752
BC->outs() << "BOLT-INFO: PPC64 TOC base: 0x"

0 commit comments

Comments
 (0)