Home | History | Annotate | Download | only in ExecutionEngine
      1 /*
      2  * Copyright 2012, The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef BCC_EXECUTION_ENGINE_ELF_OBJECT_LOADER_IMPL_H
     18 #define BCC_EXECUTION_ENGINE_ELF_OBJECT_LOADER_IMPL_H
     19 
     20 #include "ObjectLoaderImpl.h"
     21 
     22 // ELFObject and ELFSectionSymTab comes from librsloader. They're both
     23 // defined under global scope without a namespace enclosed.
     24 template <unsigned Bitwidth>
     25 class ELFObject;
     26 
     27 template <unsigned Bitwidth>
     28 class ELFSectionSymTab;
     29 
     30 namespace bcc {
     31 
     32 class ELFObjectLoaderImpl : public ObjectLoaderImpl {
     33 private:
     34 #ifdef __LP64__
     35   ELFObject<64> *mObject;
     36   ELFSectionSymTab<64> *mSymTab;
     37 #else
     38   ELFObject<32> *mObject;
     39   ELFSectionSymTab<32> *mSymTab;
     40 #endif
     41 
     42 public:
     43   ELFObjectLoaderImpl() : ObjectLoaderImpl(), mObject(NULL), mSymTab(NULL) { }
     44 
     45   virtual bool load(const void *pMem, size_t pMemSize);
     46 
     47   virtual bool relocate(SymbolResolverInterface &pResolver);
     48 
     49   virtual bool prepareDebugImage(void *pDebugImg, size_t pDebugImgSize);
     50 
     51   virtual void *getSymbolAddress(const char *pName) const;
     52 
     53   virtual size_t getSymbolSize(const char *pName) const;
     54 
     55   virtual bool getSymbolNameList(android::Vector<const char *>& pNameList,
     56                                  ObjectLoader::SymbolType pType) const;
     57   ~ELFObjectLoaderImpl();
     58 };
     59 
     60 } // end namespace bcc
     61 
     62 #endif // BCC_EXECUTION_ENGINE_ELF_OBJECT_LOADER_IMPL_H
     63