From 76cf47a070d72a74fe3791ae0e9b0e6d0e1a7729 Mon Sep 17 00:00:00 2001 From: vsariola <5684185+vsariola@users.noreply.github.com> Date: Fri, 19 Mar 2021 19:43:55 +0200 Subject: [PATCH] optimize(templates): inline calls to __imp__*File on x86 (cherry picked from commit e8bf9cb6467686ba35895094ab804360ab736b5f) --- templates/amd64-386/gmdls.asm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/amd64-386/gmdls.asm b/templates/amd64-386/gmdls.asm index d0e2cac..73c0514 100644 --- a/templates/amd64-386/gmdls.asm +++ b/templates/amd64-386/gmdls.asm @@ -27,16 +27,17 @@ push 0 ; OF_READ push ebx ; &ofstruct, blatantly reuse the sample table push su_gmdls_path1 ; path - call _OpenFile@12 ; eax = OpenFile(path,&ofstruct,OF_READ) // should not touch ebx according to calling convention + call dword [__imp__OpenFile@12]; eax = OpenFile(path,&ofstruct,OF_READ) // should not touch ebx according to calling convention push 0 ; NULL push ebx ; &bytes_read, reusing sample table again; it does not matter that the first four bytes are trashed push 3440660 ; number of bytes to read push ebx ; here we actually pass the sample table to readfile push eax ; handle to file - call _ReadFile@20 ; Readfile(handle,&su_sample_table,SAMPLE_TABLE_SIZE,&bytes_read,NULL) + call dword [__imp__ReadFile@20] ; Readfile(handle,&su_sample_table,SAMPLE_TABLE_SIZE,&bytes_read,NULL) ret -extern _OpenFile@12 ; requires windows -extern _ReadFile@20 ; requires windows +extern __imp__OpenFile@12 ; requires windows +extern __imp__ReadFile@20 + ; requires windows {{end}} {{.Data "su_gmdls_path1"}}