Skip to content
Snippets Groups Projects
Commit 0c8325d7 authored by Avi Kivity's avatar Avi Kivity
Browse files

elf: record TLS segment

parent 5a14c143
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,9 @@ namespace elf {
elf_object::elf_object(program& prog)
: _prog(prog)
, _tls_segment()
, _tls_init_size()
, _tls_uninit_size()
, _dynamic_table(nullptr)
{
}
......@@ -139,6 +142,11 @@ namespace elf {
case PT_NOTE:
case PT_GNU_STACK:
break;
case PT_TLS:
_tls_segment = _base + phdr.p_vaddr;
_tls_init_size = phdr.p_filesz;
_tls_uninit_size = phdr.p_memsz - phdr.p_filesz;
break;
case PT_GNU_EH_FRAME:
load_segment(phdr);
break;
......
......@@ -79,6 +79,7 @@ namespace elf {
PT_DYNAMIC = 2, // Dynamic linking tables
PT_INTERP = 3, // Program interpreter path name
PT_NOTE = 4, // Note sections
PT_TLS = 7, // Thread local storage initial segment
PT_GNU_EH_FRAME = 0x6474e550, // Exception handling records
PT_GNU_STACK = 0x6474e551, // Stack permissions record
};
......@@ -227,6 +228,8 @@ namespace elf {
std::vector<Elf64_Phdr> _phdrs;
void* _base;
void* _end;
void* _tls_segment;
ulong _tls_init_size, _tls_uninit_size;
Elf64_Dyn* _dynamic_table;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment