From: Waldemar Kozaczuk <jwkozac...@gmail.com>
Committer: Waldemar Kozaczuk <jwkozac...@gmail.com>
Branch: master

elf: capture address of PT_GNU_EH_FRAME

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>

---
diff --git a/core/elf.cc b/core/elf.cc
--- 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
--- 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;
 

-- 
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 osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/0000000000001e5eaa05deeb414c%40google.com.

Reply via email to