简体   繁体   中英

Segmentation Fault on jmp instruction

For a project, I write a compiler for a specific langage. I have to handle exceptions. My problem is in the assembly code. I get a segmentation fault on a jmpq instruction and I don't understand why.

This is an extract of the code :

    jmpq *.finally_27
    [...]
.finally_27:
    [...]

ddd pointed me that it is the line jmp that causes a segmentation fault, but I don't understand why. Why a jmpq instruction can fail ?

The full code is here : http://pastebin.com/E2AbW158

The error is at the line 311.

When you use JMP with a label, you shoudn't include the '*', because otherwise, you are telling: "jump to the address location stored in the quadword beginning at memory address finally_27 "

And you want: "jump to the address location whose value is finally_27 " so it is:

JMP .finally_27

Not

JMPQ *.finally_27

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM