From 1cc1d4ebf2ffc258bc1152621bd286d35f7e4e66 Mon Sep 17 00:00:00 2001 From: tom_at_work Date: Thu, 12 Jul 2007 21:00:55 +0000 Subject: [PATCH] * use automatic ppc64/linux got/toc entry generation by the linker if possible - removes the need of some workarounds git-svn-id: trunk@8031 - --- compiler/powerpc64/cgcpu.pas | 14 +++----------- compiler/ppcgen/agppcgas.pas | 6 +++++- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/compiler/powerpc64/cgcpu.pas b/compiler/powerpc64/cgcpu.pas index a81c40b72e..8f3c08c507 100644 --- a/compiler/powerpc64/cgcpu.pas +++ b/compiler/powerpc64/cgcpu.pas @@ -714,7 +714,7 @@ begin if not (size in [OS_8, OS_S8, OS_16, OS_S16, OS_32, OS_S32, OS_64, OS_S64]) then internalerror(2002090902); { if PIC or basic optimizations are enabled, and the number of instructions which would be - required to load the value is greater than 2, store (and later load) the value from there } + required to load the value is greater than 2, store (and later load) the value from there } if (((cs_opt_peephole in current_settings.optimizerswitches) or (cs_create_pic in current_settings.moduleswitches)) and (getInstructionLength(a) > 2)) then loadConstantPIC(list, size, a, reg) @@ -1903,15 +1903,7 @@ var ref: treference; symname : string; begin - maybe_new_object_file(current_asmdata.asmlists[al_picdata]); - symname := '_$' + current_asmdata.name + '$got$' + symbol; - l:=current_asmdata.getasmsymbol(symname); - if not(assigned(l)) then begin - l:=current_asmdata.DefineAsmSymbol(symname, AB_COMMON, AT_DATA); - current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8)); - current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0)); - current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symbol + '[TC], ' + symbol)); - end; + l:=current_asmdata.getasmsymbol(symbol); reference_reset_symbol(ref,l,0); ref.base := NR_R2; ref.refaddr := addr_pic; @@ -2177,7 +2169,7 @@ begin end; reference_reset_symbol(ref,l,0); ref.base := NR_R2; - ref.refaddr := addr_pic; + ref.refaddr := addr_no; {$IFDEF EXTDEBUG} list.concat(tai_comment.create(strpnew('loading value from TOC reference for ' + symname))); diff --git a/compiler/ppcgen/agppcgas.pas b/compiler/ppcgen/agppcgas.pas index 9fdf8cea24..ed6d25b655 100644 --- a/compiler/ppcgen/agppcgas.pas +++ b/compiler/ppcgen/agppcgas.pas @@ -123,7 +123,11 @@ unit agppcgas; s := s+refaddr2str[refaddr]; end; {$ifdef cpu64bit} - if (refaddr = addr_pic) then s := s + ')'; + if (refaddr = addr_pic) then + if (target_info.system <> system_powerpc64_linux) then + s := s + ')' + else + s := s + ')@got'; {$endif cpu64bit} if (index=NR_NO) and (base<>NR_NO) then