#212 √ resolved
Peter Johnson

64bit pop incorrectly generated as popw

Reported by Peter Johnson | June 25th, 2011 @ 07:52 PM | in 1.2.0 (closed)

Originally posted on Trac by alexei.svitkine@gmail.com
Original Trac Ticket

  Description

When using a pop instruction without a suffix in 64-bit mode, for example:

pop -24(%rcx)

YASM incorrectly generated a popw instruction instead of a popq.

See below comparing yasm to gas:

$ cat pop.s pop -24(%rcx)
$ ./yasm -f macho64 -p gas -o pop.o pop.s $ otool -t -v pop.o pop.o:
(TEXT,text) section 0000000000000000 popw 0xe8(%rcx)
$ as -o pop.o pop.s $ otool -t -v pop.o pop.o:
(TEXT,text) section 0000000000000000 popq 0xe8(%rcx)

h3. Trac Attachments
http://www.tortall.net/projects/yasm/attachment/ticket/233/gen_x86_...
http://www.tortall.net/projects/yasm/raw-attachment/ticket/233/gen_...
http://www.tortall.net/projects/yasm/timeline?from=2010-11-26T10%3A...
h3. Trac Comments
comment:1

              Changed 7 months ago by anonymous


The above transcript with corrected formatting (yasm vs. system as (gas)):

$ cat pop.s  

pop -24(%rcx)

$ ./yasm -f macho64 -p gas -o pop.o pop.s

$ otool -t -v pop.o

pop.o: (TEXT,text) section

0000000000000000 popw 0xe8(%rcx)

$ as -o pop.o pop.s

$ otool -t -v pop.o

pop.o: (TEXT,text) section

0000000000000000 popq 0xe8(%rcx)

Changed 7 months ago by alexei.svitkine@gmail.com



Patch to fix this

                  Changed 7 months ago by alexei.svitkine@gmail.com

      attachment
        gen_x86_patch.txt​
          added

Patch to fix this

      attachment
        gen_x86_patch.txt​
          added

comment:2

              Changed 7 months ago by anonymous


Above patch fixes the issue by generating only64 versions of popq and pushq at the start of the table so that for 64 bit asm, they are chosen before popq and pushw.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The Yasm Modular Assembler Project

Shared Ticket Bins

People watching this ticket

Tags