diff --git a/core/elf.cc b/core/elf.cc index 5170bf5306..c96a45ec23 100644 --- a/core/elf.cc +++ b/core/elf.cc @@ -124,6 +124,7 @@ object::object(program& prog, std::string pathname) , _module_index(_prog.register_dtv(this)) , _is_executable(false) , _init_called(false) + , _eh_frame(0) , _visibility_thread(nullptr) , _visibility_level(VisibilityLevel::Public) { @@ -517,10 +518,12 @@ void object::process_headers() case PT_PHDR: case PT_GNU_STACK: case PT_GNU_RELRO: - case PT_GNU_EH_FRAME: case PT_PAX_FLAGS: case PT_GNU_PROPERTY: break; + case PT_GNU_EH_FRAME: + _eh_frame = _base + phdr.p_vaddr; + break; case PT_TLS: _tls_segment = _base + phdr.p_vaddr; _tls_init_size = phdr.p_filesz; diff --git a/include/osv/elf.hh b/include/osv/elf.hh index afc9c9a510..31702bf8bf 100644 --- a/include/osv/elf.hh +++ b/include/osv/elf.hh @@ -383,6 +383,7 @@ public: ulong get_tls_size(); ulong get_aligned_tls_size(); void copy_local_tls(void* to_addr); + void* eh_frame_addr() { return _eh_frame; } protected: virtual void load_segment(const Elf64_Phdr& segment) = 0; virtual void unload_segment(const Elf64_Phdr& segment) = 0; @@ -436,6 +437,7 @@ protected: bool _is_executable; bool is_core(); bool _init_called; + void* _eh_frame; std::unordered_map _cached_symbols;