• Uncategorized

About assembly : Why-I-got-this-strange-errors-when-compiling-assembly-code-using-nasm

Question Detail

Test platform is Linux 32 bit.

I use

nasm -f elf final.s

to assemble the code, and it generate these errors:

final.s:40454: error: (at:1) `%$strucname': context stack is empty
final.s:40454: error: (at:1) `%$strucstart': context stack is empty
final.s:40454: error: (at:1) `%$strucname': context stack is empty
final.s:40454: error: (at:1) `%$strucstart': context stack is empty
final.s:40454: error: expecting `)'
final.s:40454: error: label or instruction expected at start of line

And here is part of my code:

40451
40452 byte_4092CA     db 89h, 0FFh
40453 off_415E82      dd $LN119
40454 aT              db 'T',0

40454 is the last line of my code.

I have not seen this kind of error and after a quick google, I can not find any useful stuff.

Could anyone give me some help? Thank you!

————–update————–

I tried to put this line of code to other places, but same errors…, which means it is not some issues with last line

Question Answer

“at” is a keyword used to initialize a structure. Apparently, Nasm is (very!) confused when you use it as a symbol. I thought I knew Nasm pretty well, but this is a new one on me! Just call your variable something else – _aT seems to work…

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.