Home Search
 You are here: arrow Home Forum

Search Our Site
Welcome, Guest
Please Login or Register.    Lost Password?
How to disable FPO optimisation on x64 VC++ compil
(1 viewing) 1 Guest
Go to bottom
TOPIC: How to disable FPO optimisation on x64 VC++ compil
Vineel Kumar Reddy Kovvuri (Visitor)
Posts: 1
User Offline

How to disable FPO optimisation on x64 VC++ compil 17 Nov 2015 - 06:08

Recently I started using Windbg(x64), To play with it, I have compiled(x64) a sample program using

cl.exe ls.c /Zi /Od /GS-

Interestingly the functions generated for the executable contain FPO optimization. Below is the snippet of the disassembly of a routine.

0:000> uf ls!GetDateString
00007ff7`459a6d00 mov     qword ptr [rsp+8],rcx
00007ff7`459a6d05 sub     rsp,88h
00007ff7`459a6d0c mov     qword ptr [rsp+58h],0
00007ff7`459a6d15 mov     qword ptr [rsp+50h],0
00007ff7`459a6d1e mov     eax,dword ptr [ls!dateType (00007ff7`45a14494)]
00007ff7`459a6d24 and     eax,1
00007ff7`459a6d27 test    eax,eax
00007ff7`459a6d29 je      ls!GetDateString+0x3e (00007ff7`459a6d3e)

May I know how can I disable this FPO optimization on x64 VC++ compilers. Looking at the official documentation it seems we cannot disable it via /Oy- switch

/Oy enables frame-pointer omission and /Oy- disables omission. /Oy is available only in x86 compilers.

I am wondering if this flag is only available for x86, then how come the x64 windows routines like FileTimeToSystemTime has FPO disabled!

0:000> uf .
00007ffc`a03ad120 mov     qword ptr [rsp+18h],rbx
00007ffc`a03ad125 push    rbp
00007ffc`a03ad126 mov     rbp,rsp
00007ffc`a03ad129 sub     rsp,40h
00007ffc`a03ad12d mov     rax,qword ptr [KERNELBASE!_security_cookie (00007ffc`a0515000)]
00007ffc`a03ad134 xor     rax,rsp
00007ffc`a03ad137 mov     qword ptr [rbp-8],rax
00007ffc`a03ad13b mov     eax,dword ptr [rcx]
00007ffc`a03ad13d mov     rbx,rdx
00007ffc`a03ad140 mov     dword ptr [rbp-20h],eax
00007ffc`a03ad143 mov     eax,dword ptr [rcx+4]
00007ffc`a03ad146 mov     dword ptr [rbp-1Ch],eax

  Logged IP
  The administrator has disabled public write access.
Go to top
  up top of page up  

Copyright © 2017 All Rights Reserved.
Page generated in 0.0006 seconds.