3

I'm really new to programming (in general - it's pathetic) and some Python-related assembly has cropped up in this app that I'm hacking to run on 64-bit.

Essentially, the code goes like this:

#define FUNCTION(name)        \
  .globl _##name;             \
  _##name:                    \
    jmp *(_p_##name)

.text
  FUNCTION(name)

The FUNCTION(name) syntax is used about 50 times to define headers for an external Python library as far as I can tell (I'm not going to pretend that I fully understand it, I'm just bugfixing).

Since I'm compiling for x86_64, the following error is spit out by GCC for each FUNCTION(name) instance:

32-bit absolute addressing is not supported for x86-64

cannot do signed 4 byte relocation

How would I go about "fixing" this to run on x86_64?

1 Answer 1

2

Grab a copy of the Intel Architecture Software Developer's Manuals. As you're seeing, some forms of the jmp instruction are invalid in 64-bit mode. In particular, the two "Jump far, absolute, address given in operand" forms won't work. You will need to change to a relative addressing or absolute indirect addressing form of the instruction. Volume 2A, page 3-549 in my copy, of the manual has a huge pile of information about jmp.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.