[flac-dev] PATCH: match calls and returns

lvqcl lvqcl.mail at gmail.com
Fri Jan 3 05:47:47 PST 2014


According to Agner Fog, "...you must make sure that all calls
are matched with returns. Never jump out of a subroutine without
a return and never use a return as an indirect jump."

(see paragraph 3.15 in microarchitecture.pdf and
examples 3.5a and 3.5b in optimizing_assembly.pdf)

Basically this patch replaces
		call	.get_eip0
	.get_eip0:
		pop	eax

with

		call	.mov_eip_to_eax
	.get_eip0:

and

	.mov_eip_to_eax:
		mov eax, [esp]
		ret

 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: get_eip.diff
Type: application/octet-stream
Size: 2054 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20140103/b797d34c/attachment.obj 


More information about the flac-dev mailing list