Browse Source

* the code generator bugs referred to in r21921 weren't completely fixed yet
after all, although for some reason the problems only showed up with the
external assembler on x86-64 platforms other than Darwin. Now we never use
GOT entries on x86-64 anymore for local symbols, regardless of their nature,
and instead use plain RIP-relative addressing for them.

git-svn-id: trunk@21924 -

Jonas Maebe 13 years ago
parent
commit
408f459f5a
1 changed files with 4 additions and 11 deletions
  1. 4 11
      compiler/x86/cgx86.pas

+ 4 - 11
compiler/x86/cgx86.pas

@@ -399,18 +399,12 @@ unit cgx86;
                end;
                end;
           end;
           end;
 
 
-        if assigned(ref.symbol) and not((ref.symbol.bind=AB_LOCAL) and (ref.symbol.typ in [AT_LABEL,AT_FUNCTION])) then
+        if assigned(ref.symbol) then
           begin
           begin
             if cs_create_pic in current_settings.moduleswitches then
             if cs_create_pic in current_settings.moduleswitches then
               begin
               begin
-                { Local data symbols must not be accessed via the GOT on
-                  darwin/x86_64 under certain circumstances (and do not
-                  have to be in other cases); however, linux/x86_64 does
-                  require it; don't know about others, so do use GOT for
-                  safety reasons
-                }
-                if (ref.symbol.bind=AB_LOCAL) and
-                   (ref.symbol.typ=AT_DATA) then
+                { Local symbols must not be accessed via the GOT }
+                if (ref.symbol.bind=AB_LOCAL) then
                   begin
                   begin
                     { unfortunately, RIP-based addresses don't support an index }
                     { unfortunately, RIP-based addresses don't support an index }
                     if (ref.base<>NR_NO) or
                     if (ref.base<>NR_NO) or
@@ -936,8 +930,7 @@ unit cgx86;
                       end
                       end
                     else if (cs_create_pic in current_settings.moduleswitches)
                     else if (cs_create_pic in current_settings.moduleswitches)
 {$ifdef x86_64}
 {$ifdef x86_64}
-                             and not((ref.symbol.bind=AB_LOCAL) and
-                                     (ref.symbol.typ in [AT_DATA,AT_LABEL,AT_ADDR]))
+                             and not(ref.symbol.bind=AB_LOCAL)
 {$endif x86_64}
 {$endif x86_64}
                             then
                             then
                       begin
                       begin