From 408f459f5ac910311f8f7ebfb7626a5762f1e8b5 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Tue, 17 Jul 2012 14:36:37 +0000 Subject: [PATCH] * 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 - --- compiler/x86/cgx86.pas | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 2c5f2ce3b4..4669cf800e 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -399,18 +399,12 @@ unit cgx86; 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 if cs_create_pic in current_settings.moduleswitches then 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 { unfortunately, RIP-based addresses don't support an index } if (ref.base<>NR_NO) or @@ -936,8 +930,7 @@ unit cgx86; end else if (cs_create_pic in current_settings.moduleswitches) {$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} then begin