aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/llvm/hipe_llvm_main.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2016-05-04 19:04:16 +0200
committerMagnus Lång <[email protected]>2016-05-09 18:21:59 +0200
commit34ac363e14498fce8f0d04c9296eb3d53d531069 (patch)
tree87d9188a8a7a16d95e29b2e4d6dc426a4d0c4f37 /lib/hipe/llvm/hipe_llvm_main.erl
parent56ec17296fb350f1eed5486b8d9b575be5afb7a8 (diff)
downloadotp-34ac363e14498fce8f0d04c9296eb3d53d531069.tar.gz
otp-34ac363e14498fce8f0d04c9296eb3d53d531069.tar.bz2
otp-34ac363e14498fce8f0d04c9296eb3d53d531069.zip
hipe: Cleanup elf_format module
Diffstat (limited to 'lib/hipe/llvm/hipe_llvm_main.erl')
-rw-r--r--lib/hipe/llvm/hipe_llvm_main.erl11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/hipe/llvm/hipe_llvm_main.erl b/lib/hipe/llvm/hipe_llvm_main.erl
index 9e025929b5..1a2fed0c6f 100644
--- a/lib/hipe/llvm/hipe_llvm_main.erl
+++ b/lib/hipe/llvm/hipe_llvm_main.erl
@@ -24,9 +24,10 @@ rtl_to_native(MFA, RTL, Roots, Options) ->
%% Extract information from object file
%%
ObjBin = open_object_file(ObjectFile),
+ Obj = elf_format:read(ObjBin),
%% Get labels info (for switches and jump tables)
- Labels = elf_format:get_rodata_relocs(ObjBin),
- {Switches, Closures} = get_tables(ObjBin),
+ Labels = elf_format:get_rodata_relocs(Obj),
+ {Switches, Closures} = get_tables(Obj),
%% Associate Labels with Switches and Closures with stack args
{SwitchInfos, ExposedClosures} =
correlate_labels(Switches ++ Closures, Labels),
@@ -37,19 +38,19 @@ rtl_to_native(MFA, RTL, Roots, Options) ->
%% used for switch's jump tables
LabelMap = create_labelmap(MFA, SwitchInfos, RelocsDict),
%% Get relocation info
- TextRelocs = elf_format:get_text_relocs(ObjBin),
+ TextRelocs = elf_format:get_text_relocs(Obj),
%% AccRefs contains the offsets of all references to relocatable symbols in
%% the code:
AccRefs = fix_relocations(TextRelocs, RelocsDict, MFA),
%% Get stack descriptors
- SDescs = get_sdescs(ObjBin),
+ SDescs = get_sdescs(Obj),
%% FixedSDescs are the stack descriptors after correcting calls that have
%% arguments in the stack
FixedSDescs =
fix_stack_descriptors(RelocsDict, AccRefs, SDescs, ExposedClosures),
Refs = AccRefs ++ FixedSDescs,
%% Get binary code from object file
- BinCode = elf_format:extract_text(ObjBin),
+ BinCode = elf_format:extract_text(Obj),
%% Remove temp files (if needed)
ok = remove_temp_folder(Dir, Options),
%% Return the code together with information that will be used in the