0

Basically I use IDA Pro to disassemble some binaries from SPEC2006, and do some modification work to make it nasm-reassmeble on Windows 7 32bit.

I find one problem in the disassembled asm code generated from IDA Pro like this:

            ;this is .text section
            .....
            LeadUpVec:
                dd offset LeadUp1
                dd offset LeadUp2
                dd offset LeadUp3
            LeadUp1:
            ;this is .text section

Obviously IDA Pro put this jump table inside the code.

I use nasm to assemble this code and it generate this:

error: comma expected after operand 1  

in each of the four lines

I modify it like this:

            ;this is .text section
            .....
            section .data         <--- I add it here
            LeadUpVec:
                dd offset LeadUp1
                dd offset LeadUp2
                dd offset LeadUp3
            section .text         <--- I add it here
            LeadUp1:
            ;this is .text section

But it still generate the same errors at each of the four lines...

   error: comma expected after operand 1  

Could any one give me some help? THank you!

lllllllllllll
  • 8,519
  • 9
  • 45
  • 80
  • 1
    Nasm doesn't use the `offset` keyword. Just `dd LeadUp1` etc should do it. If you've got a lot of 'em, you can `%define offset` (as nothing) to make Nasm ignore it. Having a jump table in `section .text` shouldn't be a problem. The memory will be readonly, but you probably don't want your jump table writable anyway... – Frank Kotler Feb 16 '14 at 18:07
  • @FrankKotler If you would like to answer this question below, then I will mark it as "answer" and it will benefit others:) – lllllllllllll Feb 16 '14 at 18:19

1 Answers1

1

Okay, consider it an "answer".

Nasm doesn't use the offset keyword. Just dd LeadUp1 etc should do it. If you've got a lot of 'em, you can %define offset (as nothing) to make Nasm ignore it. Having a jump table in section .text shouldn't be a problem. The memory will be readonly, but you probably don't want your jump table writable anyway...

Frank Kotler
  • 3,079
  • 2
  • 14
  • 9