diff options
author | Magnus Lång <[email protected]> | 2016-05-10 17:22:25 +0200 |
---|---|---|
committer | Magnus Lång <[email protected]> | 2016-05-11 13:19:46 +0200 |
commit | 0f489445070cf65d96db7938f80ad118921c1f6a (patch) | |
tree | eb31f67e5d9506ab000c3fd547c8f18aa92fadc4 /lib/hipe/llvm/elf_format.hrl | |
parent | 3dc060d7b6e0f2ea55e6649b23a47d226874b9d4 (diff) | |
download | otp-0f489445070cf65d96db7938f80ad118921c1f6a.tar.gz otp-0f489445070cf65d96db7938f80ad118921c1f6a.tar.bz2 otp-0f489445070cf65d96db7938f80ad118921c1f6a.zip |
hipe: Extract some records into elf_format.hrl
This allows for much more robust interpretation of relocations, symbols
and sections in hipe_llvm_main, without the clunkiness of an abstract
interface between two internal modules that belong to the same subsystem
anyway.
Diffstat (limited to 'lib/hipe/llvm/elf_format.hrl')
-rw-r--r-- | lib/hipe/llvm/elf_format.hrl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/hipe/llvm/elf_format.hrl b/lib/hipe/llvm/elf_format.hrl index 7a3cdfead6..5074682ae6 100644 --- a/lib/hipe/llvm/elf_format.hrl +++ b/lib/hipe/llvm/elf_format.hrl @@ -486,3 +486,55 @@ %% Misc. %%------------------------------------------------------------------------------ -define(bits(Bytes), ((Bytes) bsl 3)). + +%%------------------------------------------------------------------------------ +%% Exported record and type declarations for 'elf_format' module +%%------------------------------------------------------------------------------ + +-type offset() :: non_neg_integer(). +-type size() :: non_neg_integer(). +-type addend() :: integer() | undefined. +-type sym_bind() :: 'local' | 'global' | 'weak' | {os, ?STB_LOOS..?STB_HIOS} + | {proc, ?STB_LOPROC..?STB_HIPROC}. +-type sym_type() :: 'notype' | 'object' | 'func' | 'section' | 'file' + | {os, ?STT_LOOS..?STT_HIOS} + | {proc, ?STT_LOPROC..?STT_HIPROC}. +-type shdr_type() :: 'null' | 'progbits' | 'symtab' | 'strtab' | 'rela' + | 'hash' | 'dynamic' | 'note' | 'nobits' | 'rel' | 'shlib' + | 'dynsym' | {os, ?SHT_LOOS..?SHT_HIOS} + | {proc, ?SHT_LOPROC..?SHT_HIPROC}. + +-type valueoff() :: offset(). +-type name() :: string(). + +%% Section header entries +-record(elf_shdr, {name :: name() % Section name + ,type :: shdr_type()% Section type + ,flags % Section attributes + ,addr % Virtual address in memory + ,offset :: offset() % Offset in file + ,size :: size() % Size of section + ,link % Link to other section + ,info % Miscellaneous information + ,addralign % Address align boundary + ,entsize % Size of entries, if section has table + }). +-type elf_shdr() :: #elf_shdr{}. + +%% Symbol table entries +-record(elf_sym, {name :: name() % Symbol name + ,bind :: sym_bind() % Symbol binding + ,type :: sym_type() % Symbol type + ,value :: valueoff() % Symbol value + ,size :: size() % Size of object + ,section :: undefined | abs | elf_shdr() + }). +-type elf_sym() :: #elf_sym{}. + +%% Relocations +-record(elf_rel, {offset :: offset() + ,type :: reloc_type() + ,addend :: addend() + ,symbol :: elf_sym() + }). +-type elf_rel() :: #elf_rel{}. |