Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 core/elf.cc        | 5 ++++-
 include/osv/elf.hh | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/elf.cc b/core/elf.cc
index 5170bf53..c96a45ec 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 afc9c9a5..31702bf8 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<std::string,void*> _cached_symbols;
 
-- 
2.34.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20220511141000.37478-1-jwkozaczuk%40gmail.com.

Reply via email to