From 1267fa50ff54a65f22e279f1500af6e913accca5 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 16 Oct 2014 09:19:46 +0900 Subject: [PATCH] Bug 1081034 part 1 - Move GetSymbolPtr, Contains and FindExidx from CustomElf to BaseElf. r=nfroyd --- mozglue/linker/BaseElf.cpp | 25 +++++++++++++++++++++++++ mozglue/linker/BaseElf.h | 11 ++++++++--- mozglue/linker/CustomElf.cpp | 25 ------------------------- mozglue/linker/CustomElf.h | 12 ------------ 4 files changed, 33 insertions(+), 40 deletions(-) diff --git a/mozglue/linker/BaseElf.cpp b/mozglue/linker/BaseElf.cpp index 7cefecee03e..e3cb8053878 100644 --- a/mozglue/linker/BaseElf.cpp +++ b/mozglue/linker/BaseElf.cpp @@ -22,6 +22,12 @@ BaseElf::Hash(const char *symbol) return h; } +void * +BaseElf::GetSymbolPtr(const char *symbol) const +{ + return GetSymbolPtr(symbol, Hash(symbol)); +} + void * BaseElf::GetSymbolPtr(const char *symbol, unsigned long hash) const { @@ -53,3 +59,22 @@ BaseElf::GetSymbol(const char *symbol, unsigned long hash) const } return nullptr; } + +bool +BaseElf::Contains(void *addr) const +{ + return base.Contains(addr); +} + +#ifdef __ARM_EABI__ +const void * +BaseElf::FindExidx(int *pcount) const +{ + if (arm_exidx) { + *pcount = arm_exidx.numElements(); + return arm_exidx; + } + *pcount = 0; + return nullptr; +} +#endif diff --git a/mozglue/linker/BaseElf.h b/mozglue/linker/BaseElf.h index 18091f6d15d..0c9dff6dc92 100644 --- a/mozglue/linker/BaseElf.h +++ b/mozglue/linker/BaseElf.h @@ -44,12 +44,12 @@ protected: * Inherited from LibHandle. Those are temporary and are not supposed to * be used. */ - virtual void *GetSymbolPtr(const char *symbol) const { return NULL; }; - virtual bool Contains(void *addr) const { return false; }; + virtual void *GetSymbolPtr(const char *symbol) const; + virtual bool Contains(void *addr) const; virtual void *GetBase() const { return GetPtr(0); } #ifdef __ARM_EABI__ - virtual const void *FindExidx(int *pcount) const { return NULL; }; + virtual const void *FindExidx(int *pcount) const; #endif virtual Mappable *GetMappable() const { return NULL; }; @@ -96,6 +96,11 @@ public: /* Symbol table */ UnsizedArray symtab; + +#ifdef __ARM_EABI__ + /* ARM.exidx information used by FindExidx */ + Array arm_exidx; +#endif }; #endif /* BaseElf_h */ diff --git a/mozglue/linker/CustomElf.cpp b/mozglue/linker/CustomElf.cpp index 64c8a48439e..8bfc4e52298 100644 --- a/mozglue/linker/CustomElf.cpp +++ b/mozglue/linker/CustomElf.cpp @@ -278,12 +278,6 @@ CustomElf::~CustomElf() ElfLoader::Singleton.Forget(this); } -void * -CustomElf::GetSymbolPtr(const char *symbol) const -{ - return BaseElf::GetSymbolPtr(symbol, Hash(symbol)); -} - void * CustomElf::GetSymbolPtrInDeps(const char *symbol) const { @@ -359,25 +353,6 @@ CustomElf::GetSymbolPtrInDeps(const char *symbol) const return nullptr; } -bool -CustomElf::Contains(void *addr) const -{ - return base.Contains(addr); -} - -#ifdef __ARM_EABI__ -const void * -CustomElf::FindExidx(int *pcount) const -{ - if (arm_exidx) { - *pcount = arm_exidx.numElements(); - return arm_exidx; - } - *pcount = 0; - return nullptr; -} -#endif - void CustomElf::stats(const char *when) const { diff --git a/mozglue/linker/CustomElf.h b/mozglue/linker/CustomElf.h index 0c51c68ce2d..c7242fb465e 100644 --- a/mozglue/linker/CustomElf.h +++ b/mozglue/linker/CustomElf.h @@ -35,13 +35,6 @@ public: * Inherited from LibHandle/BaseElf */ virtual ~CustomElf(); - virtual void *GetSymbolPtr(const char *symbol) const; - virtual bool Contains(void *addr) const; - virtual void *GetBase() const { return GetPtr(0); } - -#ifdef __ARM_EABI__ - virtual const void *FindExidx(int *pcount) const; -#endif protected: virtual Mappable *GetMappable() const; @@ -161,11 +154,6 @@ private: bool initialized; bool has_text_relocs; - -#ifdef __ARM_EABI__ - /* ARM.exidx information used by FindExidx */ - Array arm_exidx; -#endif }; #endif /* CustomElf_h */