[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)
This commit is contained in:
Maksim Panchenko 2017-08-01 11:19:01 -07:00
parent eb64d03b73
commit d27b31ee07
2 changed files with 2 additions and 3 deletions

View File

@ -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<uint8_t> 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<const uint32_t *>(Ptr + TTypeEnd);
uint8_t CallSiteEncoding = *Ptr++;

View File

@ -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