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

This assumes that the environment is always Thumb

Change by Walter Erquinigo <wall...@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()));


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()));
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to