aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/llvm/elf_format.hrl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-05-18 18:59:24 +0200
committerMagnus Lång <[email protected]>2016-05-18 19:08:01 +0200
commit8914b835d26cc3b513eaef0a19cd9b39d1d2ccae (patch)
treeddb97b78dd773e3dbfcc137ef950fe849145000e /lib/hipe/llvm/elf_format.hrl
parentea308bc26d4664705895ff3be31687dc5235cc79 (diff)
downloadotp-8914b835d26cc3b513eaef0a19cd9b39d1d2ccae.tar.gz
otp-8914b835d26cc3b513eaef0a19cd9b39d1d2ccae.tar.bz2
otp-8914b835d26cc3b513eaef0a19cd9b39d1d2ccae.zip
hipe_llvm: Move elf_format.hrl types to module
Named types, except those for the records in the header files, have been moved from elf*_format.hrl to elf_format.erl. Also: * Use lists instead of element/2-indexed tuples for ELF section and symbol tables. * Enable +warn_export_vars for hipe/llvm/ subdirectory and fix warning. * Extract duplicated code in hipe_llvm module into help function pp_dereference_type/3.
Diffstat (limited to 'lib/hipe/llvm/elf_format.hrl')
-rw-r--r--lib/hipe/llvm/elf_format.hrl66
1 files changed, 27 insertions, 39 deletions
diff --git a/lib/hipe/llvm/elf_format.hrl b/lib/hipe/llvm/elf_format.hrl
index 5074682ae6..57a36f0c3e 100644
--- a/lib/hipe/llvm/elf_format.hrl
+++ b/lib/hipe/llvm/elf_format.hrl
@@ -491,50 +491,38 @@
%% 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
- }).
+-record(elf_shdr,
+ {name :: elf_format:name() % Section name
+ ,type :: elf_format:shdr_type() % Section type
+ ,flags :: elf_format:bitflags() % Section attributes
+ ,addr :: elf_format:offset() % Virtual address in memory
+ ,offset :: elf_format:offset() % Offset in file
+ ,size :: elf_format:size() % Size of section
+ ,link :: non_neg_integer() % Link to other section
+ ,info :: non_neg_integer() % Miscellaneous information
+ ,addralign :: elf_format:size() % Address align boundary
+ ,entsize :: elf_format:size() % 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()
- }).
+-record(elf_sym,
+ {name :: elf_format:name() % Symbol name
+ ,bind :: elf_format:sym_bind() % Symbol binding
+ ,type :: elf_format:sym_type() % Symbol type
+ ,value :: elf_format:valueoff() % Symbol value
+ ,size :: elf_format: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()
- }).
+-record(elf_rel,
+ {offset :: elf_format:offset()
+ ,type :: elf_format:reloc_type()
+ ,addend :: elf_format:addend()
+ ,symbol :: elf_sym()
+ }).
-type elf_rel() :: #elf_rel{}.