Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix with post scripts #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

elikaski
Copy link

@elikaski elikaski commented Dec 3, 2020

Compiling a simple Hello World program generates assembly code that contains:

	# (external call)
	movl (sp), %esp  # <REQ>
	movl $printf, (external)

When using post/xor.py (and other post scripts), the corresponding instructions generated are:

	# (external call)
	#xor> movl (sp), %esp  # <REQ>
	xorl %ebx, %ebx
	xorl (sp), %ebx
	xorl %esp  # <REQ>, %ebx
	xorl %ebx, %esp  # <REQ>

The third instruction is the problematic:
xorl %esp # <REQ>, %ebx

The root cause is that the comment (# <REQ>) is also being identified as the "destination" register
My change makes it discard the comment

Compiling a simple Hello World program generates assembly code that contains:

	# (external call)
	movl (sp), %esp  # <REQ>
	movl $printf, (external)

When using post/xor.py (and other post scripts), the corresponding instructions generated are:

	# (external call)
	#xor> movl (sp), %esp  # <REQ>
	xorl %ebx, %ebx
	xorl (sp), %ebx
	xorl %esp  # <REQ>, %ebx
	xorl %ebx, %esp  # <REQ>

The third instruction is the problematic:
	xorl %esp  # <REQ>, %ebx

The root cause is that the comment (# <REQ>) is also being identified as the "destination" register
My change makes it discard the comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant