#121 ✓hold
Peter Johnson

unable to use differences in labels in preprocessor code

Reported by Peter Johnson | June 25th, 2011 @ 07:50 PM

Originally posted on Trac by anonymous
Original Trac Ticket


came across this bit of code:

section .data
_fetch                dd 0
_readbyte             dd 0
_readword             dd 0
section .text
%rep ((contextend-contextbegin) / 8)
  mov eax,[contextbegin]

yasm aborts with:

test.asm:8: cannot reference symbol `contextend' in preprocessor
test.asm:8: cannot reference symbol `contextbegin' in preprocessor

which i would understand if we were trying to utilize the value of the symbol directly ... but here we're using unknown values with a known difference. so while the address of contextend and contextbegin may not be known at preproccessing time, the difference in their addresses is known.

Trac Attachments

h3. Trac Comments

              Changed 4 years ago by peter@tortall.net

Actually, their difference in addresses is not known at preprocessing time either, at least currently.  Unlike NASM, Yasm is a single-pass assembler; it only reads the source file once.  We're working on improving Yasm to handle the simpler cases of this, but Yasm will essentially always be somewhat more limited than NASM in this area.  I'll leave this ticket open for now reflecting the need for improvement.

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