Browse Source

* Another fix to PIC assembler: GOT slot stores the address of variable, not variable itself.

git-svn-id: trunk@24127 -
sergei 12 years ago
parent
commit
37a347ce7b
1 changed files with 4 additions and 2 deletions
  1. 4 2
      tests/test/opt/tretopt.pp

+ 4 - 2
tests/test/opt/tretopt.pp

@@ -295,7 +295,8 @@ begin
     movl %eax,p3-.Lpic(%ecx)
     movl %eax,p3-.Lpic(%ecx)
 {$else darwin}
 {$else darwin}
    addl $_GLOBAL_OFFSET_TABLE_+1,%ecx
    addl $_GLOBAL_OFFSET_TABLE_+1,%ecx
-   movl %eax,p3@GOT(%ecx)
+   movl p3@GOT(%ecx),%edx
+   movl %eax,(%edx)
 {$endif darwin}
 {$endif darwin}
 {$endif FPC_PIC}
 {$endif FPC_PIC}
 {$endif cpui386}
 {$endif cpui386}
@@ -350,7 +351,8 @@ begin
     movl %eax,p3-.Lpic(%ecx)
     movl %eax,p3-.Lpic(%ecx)
 {$else darwin}
 {$else darwin}
    addl $_GLOBAL_OFFSET_TABLE_+1,%ecx
    addl $_GLOBAL_OFFSET_TABLE_+1,%ecx
-   movl %eax,p3@GOT(%ecx)
+   movl p3@GOT(%ecx),%edx
+   movl %eax,(%edx)
 {$endif darwin}
 {$endif darwin}
 {$endif FPC_PIC}
 {$endif FPC_PIC}
 {$endif}
 {$endif}