[Lldb-commits] [PATCH] D39315: Correct the start address for exported windows functions in arm

Stephane Sezer via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 25 18:23:05 PDT 2017


sas created this revision.
Herald added subscribers: kristof.beyls, aemerson.

This assumes that the environment is always Thumb

Change by Walter Erquinigo <wallace at fb.com>


https://reviews.llvm.org/D39315

Files:
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp


Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===================================================================
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -648,6 +648,16 @@
                                            sizeof(uint32_t) * name_ordinal;
           uint32_t function_rva = symtab_data.GetU32(&function_offset);
 
+          ArchSpec header_arch;
+          GetArchitecture(header_arch);
+          if (header_arch.GetMachine() == llvm::Triple::arm) {
+            if (function_rva & 1) {
+              // For Thumb we need the last bit to be 0 so that the address
+              // points to the right beginning of the symbol.
+              function_rva ^= 1;
+            }
+          }
+
           Address symbol_addr(m_coff_header_opt.image_base + function_rva,
                               sect_list);
           symbols[i].GetMangled().SetValue(ConstString(symbol_name.c_str()));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39315.120348.patch
Type: text/x-patch
Size: 995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171026/e97289ee/attachment.bin>


More information about the lldb-commits mailing list