[PATCH] llvm-symbolizer: teach it about PowerPC64 ELF function descriptors

Alexey Samsonov vonosmas at gmail.com
Thu Nov 6 11:35:49 PST 2014


================
Comment at: tools/llvm-symbolizer/LLVMSymbolize.cpp:58
@@ +57,3 @@
+        if (!error(Section->getContents(Data)))
+          OpdExtractor = DataExtractor(Data, false, 8);
+        OpdAddress = Section->getAddress();
----------------
I'd prefer Module->isLittleEndian() here. 

================
Comment at: tools/llvm-symbolizer/LLVMSymbolize.cpp:89
@@ -71,1 +88,3 @@
     return;
+  uint64_t OpdOffset = SymbolAddress - OpdAddress;
+  if (OpdOffset == (uint32_t)OpdOffset && 
----------------
foad wrote:
> I realise this is a bit ugly. As an alternative I could update DataExtractor::isValidOffset{,ForDataOfSize} to take 64-bit offsets.
You can then hide this whole block under
  if (OpdExtractor) {}


================
Comment at: tools/llvm-symbolizer/LLVMSymbolize.cpp:89-90
@@ -71,1 +88,4 @@
     return;
+  uint64_t OpdOffset = SymbolAddress - OpdAddress;
+  if (OpdOffset == (uint32_t)OpdOffset && 
+      OpdExtractor.isValidOffsetForDataOfSize(OpdOffset, 8)) {
----------------
samsonov wrote:
> foad wrote:
> > I realise this is a bit ugly. As an alternative I could update DataExtractor::isValidOffset{,ForDataOfSize} to take 64-bit offsets.
> You can then hide this whole block under
>   if (OpdExtractor) {}
> 
Yeah, but let's fix DataExtractor later. Note that you can also compare OpdOffset with "uint32_t Offset" you declare below.

================
Comment at: tools/llvm-symbolizer/LLVMSymbolize.h:121
@@ +120,3 @@
+  // (function descriptor) section and OpdExtractor refers to its contents.
+  void addSymbol(const SymbolRef &Symbol, DataExtractor &OpdExtractor,
+                 uint64_t OpdAddress);
----------------
Consider making OpdExtractor argument a raw pointer - it is really optional, and you shouldn't need to create DataExtractor object if it's not needed.

http://reviews.llvm.org/D6110






More information about the llvm-commits mailing list