From 8914b835d26cc3b513eaef0a19cd9b39d1d2ccae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20L=C3=A5ng?= Date: Wed, 18 May 2016 18:59:24 +0200 Subject: 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. --- lib/hipe/llvm/elf_format.hrl | 66 ++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 39 deletions(-) (limited to 'lib/hipe/llvm/elf_format.hrl') 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{}. -- cgit v1.2.3