Navigation Menu

Skip to content

Commit

Permalink
elf: capture address of PT_GNU_EH_FRAME
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
  • Loading branch information
wkozaczuk committed May 13, 2022
1 parent 4160e40 commit 577d3a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/elf.cc
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions include/osv/elf.hh
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 577d3a8

Please sign in to comment.