left and right bit shift assembly operators

Indira Estacio Moreno <[email protected]>
Newsgroups gmane.os.opendarwin.general
Message-ID <[email protected]>
Since no-one answered my previous post, I want to add more details in regards to this cirtical problem that we're experiencing. Here's the code snippet (Darwin for i86) that generates a problem (the last line is the one that the compiler throws an error on stating that "Relocation error. Absolute 0 assumed":


.file "devio.w"

.text

.long c.false, c.procedure_key

.L4:

.long x.L4, c.false

.long .L9

.byte 0, 1

.byte 0, 0

.value 0

.byte 14, 13, 0, 12, 0, 0

.long .L5


x.L4:

movl $.L4, %ebp

subl $48, %esp

pushl %ebp

.L6:

movl (%ebx), %eax

movl %eax, 4(%esp)

leal 8(%esp), %eax

movl %eax, -4(%ebx)

movl $2, -8(%ebx)

movl $tcgetattr, -12(%ebx)

leal -12(%ebx), %ebx

call c.031call_sys

cmpl $0, (%ebx)

leal 4(%ebx), %ebx

jns .L8

movl $c.false, -4(%ebx)

leal -4(%ebx), %ebx

jmp .L7

.L8:

movl $c.true, -4(%ebx)

leal -4(%ebx), %ebx

.L7:

.L5:

addl $52, %esp

movl 4(%esp), %ebp

ret 

.align 4

.LA:

.set .L9, ((.LA - x.L4) >> 2) + 9

Here is what we know about the problem.

1) The bitwise right shift operator is the one that it has a problem with. If we cut this operation on 3 different lines, the line that includes the right shift id the one that it will have a problem on.

2) The bitwise right shift is documented to work on Integers only. The defintion of L9 variable is stated to be of type long. We tried to make this an Integer, but we still experienced the same trouble afterwards.

I hope that you can now tell me something that I can do to fix this problem.

Original post:

We're porting an i86 software (poplog) from Linux for i86 to Darwin. We're almost done with it, but experience a problem.

Here's the problem: When we have a set instruction that reads as following .set .L9, ((.LA-X.L4)>>2)+9, the right shift operator generates a compile time error stating that " Relocation error. Absolute 0 assumed".

The problem is well identified, but we are somewhat clueless in regards to the solution. Any help is well appreciated.

 



---------------------------------
Do You Yahoo!?
Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo.
Visíta Yahoo! Noticias.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.