"can't find label" error in Y86 compiler

1.6k views Asked by At

I'm writing up a program in Y86, but I keep getting an error "can't find label" for my code lines setting up the stack and base pointer. My code is:

.pos 0

init: 
    irmovl Stack, %esp  //Set up stack pointer
    irmovl Stack, %ebp  //Set up base pointer
    call main       //call main program
    halt            //Terminate program

Which is how it appears in my notes, but when I try to compile, I get

Error on line 8: Can't find label
Line 8, Byte 0x0006:    irmovl stack, %esp  //Set up stack pointer
Error on line 9: Can't find label
Line 9, Byte 0x000c:    irmovl stack, %ebp  //Set up base pointer

I've tried putting the .pos 0 line inside the init function (I thought it might help) as well as simply nixing the init: line all together but I still get the same problem.

1

There are 1 answers

0
Anon On

Possible solution:

If you have the Stack label defined at the bottom of your file, try creating an extra blank line after it. I was literally just having the same issue and creating a blank line after the Stack label fixed the problem.

As an aside:

It's absolutely amazing that this is the only search result I've come across regarding this error.