From d27b31ee07cd27743005c4815fc24a6c8f83124b Mon Sep 17 00:00:00 2001 From: Maksim Panchenko Date: Tue, 1 Aug 2017 11:19:01 -0700 Subject: [PATCH] [BOLT] Fix reading LSDA address for PIC code Summary: Fix a bug while reading LSDA address in PIC format. The base address was wrong for PC-relative value. There's more work involved in making PIC code with C++ exceptions work. (cherry picked from FBD5538755) --- bolt/Exceptions.cpp | 4 ++-- bolt/RewriteInstance.cpp | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/bolt/Exceptions.cpp b/bolt/Exceptions.cpp index 4fd5e7494aed..110cda04168c 100644 --- a/bolt/Exceptions.cpp +++ b/bolt/Exceptions.cpp @@ -64,7 +64,7 @@ namespace bolt { // // The best visual representation of the tables comprising LSDA and // relationships between them is illustrated at: -// http://mentorembedded.github.io/cxx-abi/exceptions.pdf +// https://github.com/itanium-cxx-abi/cxx-abi/blob/master/exceptions.pdf // Keep in mind that GCC implementation deviates slightly from that document. // // To summarize, there are 4 tables in LSDA: call site table, actions table, @@ -145,7 +145,7 @@ void BinaryFunction::parseLSDA(ArrayRef LSDASectionData, intptr_t MaxTypeIndexTableOffset = 0; // The actual type info table starts at the same location, but grows in - // different direction. Encoding is different too (TTypeEncoding). + // opposite direction. TTypeEncoding is used to encode stored values. auto TypeTableStart = reinterpret_cast(Ptr + TTypeEnd); uint8_t CallSiteEncoding = *Ptr++; diff --git a/bolt/RewriteInstance.cpp b/bolt/RewriteInstance.cpp index 8f65bc27a3c4..473f607d7101 100644 --- a/bolt/RewriteInstance.cpp +++ b/bolt/RewriteInstance.cpp @@ -3577,7 +3577,6 @@ void RewriteInstance::rewriteFile() { // Update ELF book-keeping info. patchELFSectionHeaderTable(); - // TODO: we should find a way to mark the binary as optimized by us. Out->keep(); // If requested, open again the binary we just wrote to dump its EH Frame