Jelajahi Sumber

merge with trunk

git-svn-id: branches/tg74/avx1@22712 -
tg74 12 tahun lalu
induk
melakukan
6be933ad71

+ 23 - 23
compiler/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/09/21]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/10/17]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
@@ -372,28 +372,28 @@ RTLOPT:=$(OPT)
 endif
 ifdef CYCLELEVEL
 ifeq ($(CYCLELEVEL),1)
-LOCALOOPT+=$(OPTLEVEL1)
-RTLOPT+=$(OPTLEVEL1)
-LOCALOPT+=$(LOCALOPTLEVEL1)
-RTLOPT+=$(RTLOPTLEVEL1)
+override LOCALOPT+=$(OPTLEVEL1)
+override RTLOPT+=$(OPTLEVEL1)
+override LOCALOPT+=$(LOCALOPTLEVEL1)
+override RTLOPT+=$(RTLOPTLEVEL1)
 endif
 ifeq ($(CYCLELEVEL),2)
-LOCALOOPT+=$(OPTLEVEL2)
-RTLOPT+=$(OPTLEVEL2)
-LOCALOPT+=$(LOCALOPTLEVEL2)
-RTLOPT+=$(RTLOPTLEVEL2)
+override LOCALOPT+=$(OPTLEVEL2)
+override RTLOPT+=$(OPTLEVEL2)
+override LOCALOPT+=$(LOCALOPTLEVEL2)
+override RTLOPT+=$(RTLOPTLEVEL2)
 endif
 ifeq ($(CYCLELEVEL),3)
-LOCALOOPT+=$(OPTLEVEL3)
-RTLOPT+=$(OPTLEVEL3)
-LOCALOPT+=$(LOCALOPTLEVEL3)
-RTLOPT+=$(RTLOPTLEVEL3)
+override LOCALOPT+=$(OPTLEVEL3)
+override RTLOPT+=$(OPTLEVEL3)
+override LOCALOPT+=$(LOCALOPTLEVEL3)
+override RTLOPT+=$(RTLOPTLEVEL3)
 endif
 ifeq ($(CYCLELEVEL),4)
-LOCALOOPT+=$(OPTLEVEL4)
-RTLOPT+=$(OPTLEVEL4)
-LOCALOPT+=$(LOCALOPTLEVEL4)
-RTLOPT+=$(RTLOPTLEVEL4)
+override LOCALOPT+=$(OPTLEVEL4)
+override RTLOPT+=$(OPTLEVEL4)
+override LOCALOPT+=$(LOCALOPTLEVEL4)
+override RTLOPT+=$(RTLOPTLEVEL4)
 endif
 endif
 override OPT=
@@ -3816,12 +3816,12 @@ cycle:
 	$(MAKE) echotime
 else
 cycle:
-	$(MAKE) OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+	$(MAKE) OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=1
 	$(MAKE) OS_TARGET=$(OS_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=1
-	$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+	$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=2
 	$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=2
 ifndef CROSSINSTALL
-	$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' rtlclean rtl
+	$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' rtlclean rtl CYCLELEVEL=3
 ifneq ($(OS_TARGET),embedded)
 ifneq ($(OS_TARGET),gba)
 	$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' cycleclean compiler CYCLELEVEL=3
@@ -3832,12 +3832,12 @@ endif
 else
 cycle: override FPC=
 cycle:
-	$(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+	$(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=1
 	$(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=1
-	$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+	$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=‚
 	$(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) PPC_TARGET=$(CPU_TARGET) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=2
 ifndef CROSSINSTALL
-	$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(RTLOPT) $(CROSSOPT)' rtlclean rtl
+	$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(RTLOPT) $(CROSSOPT)' rtlclean rtl CYCLELEVEL=3
 ifndef NoNativeBinaries
 	$(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(LOCALOPT) $(CROSSOPT)' cycleclean compiler CYCLELEVEL=3
 endif

+ 22 - 22
compiler/Makefile.fpc

@@ -125,28 +125,28 @@ endif
 
 ifdef CYCLELEVEL
 ifeq ($(CYCLELEVEL),1)
-LOCALOOPT+=$(OPTLEVEL1)
-RTLOPT+=$(OPTLEVEL1)
-LOCALOPT+=$(LOCALOPTLEVEL1)
-RTLOPT+=$(RTLOPTLEVEL1)
+override LOCALOPT+=$(OPTLEVEL1)
+override RTLOPT+=$(OPTLEVEL1)
+override LOCALOPT+=$(LOCALOPTLEVEL1)
+override RTLOPT+=$(RTLOPTLEVEL1)
 endif
 ifeq ($(CYCLELEVEL),2)
-LOCALOOPT+=$(OPTLEVEL2)
-RTLOPT+=$(OPTLEVEL2)
-LOCALOPT+=$(LOCALOPTLEVEL2)
-RTLOPT+=$(RTLOPTLEVEL2)
+override LOCALOPT+=$(OPTLEVEL2)
+override RTLOPT+=$(OPTLEVEL2)
+override LOCALOPT+=$(LOCALOPTLEVEL2)
+override RTLOPT+=$(RTLOPTLEVEL2)
 endif
 ifeq ($(CYCLELEVEL),3)
-LOCALOOPT+=$(OPTLEVEL3)
-RTLOPT+=$(OPTLEVEL3)
-LOCALOPT+=$(LOCALOPTLEVEL3)
-RTLOPT+=$(RTLOPTLEVEL3)
+override LOCALOPT+=$(OPTLEVEL3)
+override RTLOPT+=$(OPTLEVEL3)
+override LOCALOPT+=$(LOCALOPTLEVEL3)
+override RTLOPT+=$(RTLOPTLEVEL3)
 endif
 ifeq ($(CYCLELEVEL),4)
-LOCALOOPT+=$(OPTLEVEL4)
-RTLOPT+=$(OPTLEVEL4)
-LOCALOPT+=$(LOCALOPTLEVEL4)
-RTLOPT+=$(RTLOPTLEVEL4)
+override LOCALOPT+=$(OPTLEVEL4)
+override RTLOPT+=$(OPTLEVEL4)
+override LOCALOPT+=$(LOCALOPTLEVEL4)
+override RTLOPT+=$(RTLOPTLEVEL4)
 endif
 endif
 
@@ -645,14 +645,14 @@ else
 
 cycle:
 # ppc (source native)
-        $(MAKE) OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+        $(MAKE) OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=1
         $(MAKE) OS_TARGET=$(OS_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=1
 # ppcross<ARCH> (source native)
-        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=2
         $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=2
 # ppc<ARCH> (target native)
 ifndef CROSSINSTALL
-        $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' rtlclean rtl
+        $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' rtlclean rtl CYCLELEVEL=3
 # building a native compiler for embedded targets is not possible
 ifneq ($(OS_TARGET),embedded)
 # building a native compiler for the arm-gba target is not possible
@@ -678,14 +678,14 @@ cycle: override FPC=
 cycle:
 # ppc (source native)
 # Clear detected compiler binary, because it can be existing crosscompiler binary, but we need native compiler here
-        $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+        $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=1
         $(MAKE) OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) EXENAME=$(TEMPNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=1
 # ppcross<ARCH> (source native)
-        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl
+        $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 rtlclean rtl CYCLELEVEL=‚
         $(MAKE) 'FPC=$(BASEDIR)/$(TEMPNAME)' OS_TARGET=$(OS_SOURCE) CPU_TARGET=$(CPU_SOURCE) PPC_TARGET=$(CPU_TARGET) EXENAME=$(PPCROSSNAME) CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 cycleclean compiler CYCLELEVEL=2
 # ppc<ARCH> (target native)
 ifndef CROSSINSTALL
-        $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(RTLOPT) $(CROSSOPT)' rtlclean rtl
+        $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(RTLOPT) $(CROSSOPT)' rtlclean rtl CYCLELEVEL=3
 # building a native compiler for JVM and embedded targets is not possible
 ifndef NoNativeBinaries
         $(MAKE) 'FPC=$(BASEDIR)/$(PPCROSSNAME)' 'OPT=$(LOCALOPT) $(CROSSOPT)' cycleclean compiler CYCLELEVEL=3

+ 2 - 2
compiler/aggas.pas

@@ -810,9 +810,9 @@ implementation
                      begin
                        asmwrite(#9'.lcomm ');
                        asmwrite(ReplaceForbiddenAsmSymbolChars(tai_datablock(hp).sym.name));
-                       asmwrite(',_data.bss_[RW],');
+                       asmwrite(',');
                        asmwrite(tostr(tai_datablock(hp).size)+',');
-                       asmwriteln(tostr(last_align));
+                       asmwrite('_data.bss_');
                      end;
                  end
                else

+ 2 - 1
compiler/arm/agarmgas.pas

@@ -109,7 +109,8 @@ unit agarmgas;
 
         if current_settings.cputype=cpu_armv7m then
           result:='-march=armv7m -mthumb -mthumb-interwork '+result
-        else
+        { pass only cpu types >= armv6 because the rtl uses runtime selected code with armv5te statements }
+        else if current_settings.cputype>=cpu_armv6 then
           result:='-march='+cputype_to_gas_march[current_settings.cputype]+' '+result;
 
         if target_info.abi = abi_eabihf then

+ 1 - 1
compiler/dbgstabx.pas

@@ -282,7 +282,7 @@ implementation
         if isglobal then
           list.concat(tai_stab.Create_ansistr(stabx_bs,'.data[RW]'))
         else
-          list.concat(tai_stab.Create_ansistr(stabx_bs,'_data.bss_[RW]'));
+          list.concat(tai_stab.Create_ansistr(stabx_bs,'_data.bss_'));
       inherited;
       if ismem then
         list.concat(tai_stab.Create_ansistr(stabx_es,''));

+ 15 - 5
compiler/mips/cpugas.pas

@@ -26,13 +26,15 @@ unit cpugas;
   interface
 
     uses
-      cpubase,
-       aasmtai, aasmcpu, assemble, aggas;
+      cpubase, aasmbase, globtype,
+      aasmtai, aasmcpu, assemble, aggas;
 
     type
       TMIPSGNUAssembler = class(TGNUassembler)
         nomacro, noreorder, noat : boolean;
         constructor create(smart: boolean); override;
+        {# Constructs the command line for calling the assembler }
+        function MakeCmdLine: TCmdStr; override;
       end;
 
       TMIPSInstrWriter = class(TCPUInstrWriter)
@@ -50,7 +52,7 @@ unit cpugas;
   implementation
 
     uses
-      aasmbase, cutils, systems,
+      cutils, systems, cpuinfo,
       verbose, itcpugas, cgbase, cgutils;
 
     function gas_std_regname(r:Tregister):string;
@@ -92,6 +94,14 @@ unit cpugas;
         noat:=false;
       end;
 
+    function TMIPSGNUAssembler.MakeCmdLine: TCmdStr;
+      begin
+         result := Inherited MakeCmdLine;
+         { ABI selection }
+         Replace(result,'$ABI','-mabi='+abitypestr[mips_abi]);
+         { ACH selection }
+         Replace(result,'$ARCH','-march='+cputypestr[mips_cpu]);
+      end;
 
 {****************************************************************************}
 {                  Helper routines for Instruction Writer                    }
@@ -376,7 +386,7 @@ unit cpugas;
         id: as_gas;
         idtxt: 'AS';
         asmbin: 'as';
-        asmcmd: '-mips2 $NOWARN -EL $PIC -o $OBJ $ASM';
+        asmcmd: '$ABI $ARCH $NOWARN -EL $PIC -o $OBJ $ASM';
         supported_targets: [system_mipsel_linux];
         flags: [af_allowdirect, af_needar, af_smartlink_sections];
         labelprefix: '.L';
@@ -388,7 +398,7 @@ unit cpugas;
         id: as_gas;
         idtxt: 'AS';
         asmbin: 'as';
-        asmcmd: '-mips2 $NOWARN -EB $PIC -o $OBJ $ASM';
+        asmcmd: '$ABI $ARCH $NOWARN -EB $PIC -o $OBJ $ASM';
         supported_targets: [system_mipseb_linux];
         flags: [af_allowdirect, af_needar, af_smartlink_sections];
         labelprefix: '.L';

+ 66 - 3
compiler/mips/cpuinfo.pas

@@ -32,11 +32,29 @@ Type
    { possible supported processors for this target }
    tcputype =
       (cpu_none,
-       cpu_mips32
+       cpu_mips_default,
+       cpu_mips1,
+       cpu_mis2,
+       cpu_mips3,
+       cpu_mips4,
+       cpu_mips5,
+       cpu_mips32,
+       cpu_mips32r2
       );
 
    tfputype =(fpu_none,fpu_soft,fpu_mips2,fpu_mips3);
 
+   tabitype = 
+     (
+     abi_none,
+     abi_default,
+     abi_o32,
+     abi_n32,
+     abi_o64,
+     abi_n64,
+     abi_eabi
+     );
+
 Const
    {# Size of native extended floating point type }
    extended_size = 8;
@@ -58,15 +76,40 @@ Const
      pocall_cppdecl
    ];
 
-   cputypestr : array[tcputype] of string[6] = ('',
-     'MIPS32'
+   { cpu strings as accepted by 
+     GNU assembler in -arch=XXX option }
+   cputypestr : array[tcputype] of string[8] = ('',
+     { cpu_mips_default } 'mips2',
+     { cpu_mips1        } 'mips1',
+     { cpu_mips2        } 'mips2',
+     { cpu_mips3        } 'mips3',
+     { cpu_mips4        } 'mips4',
+     { cpu_mips5        } 'mips5',
+     { cpu_mips32       } 'mips32',
+     { cpu_mips32r2     } 'mips32r2'
    );
 
+   mips_cpu : tcputype = cpu_mips_default;
+
    fputypestr : array[tfputype] of string[9] = ('',
      'SOFT',
      'FPU_MIPS2','FPU_MIPS3'
    );
 
+   { abi strings as accepted by 
+     GNU assembler in -abi=XXX option }
+   abitypestr : array[tabitype] of string[4] =
+     ({ abi_none    } '',
+      { abi_default } '32',
+      { abi_o32     } '32',
+      { abi_n32     } 'n32',
+      { abi_o64     } 'o64',
+      { abi_n64     } '64',
+      { abi_eabi    } 'eabi'
+     );
+
+   mips_abi : tabitype = abi_default;
+
    { Supported optimizations, only used for information }
    supported_optimizerswitches = [cs_opt_regvar,cs_opt_loopunroll,cs_opt_nodecse,
                                   cs_opt_reorder_fields,cs_opt_fastmath];
@@ -76,6 +119,26 @@ Const
    level3optimizerswitches = level2optimizerswitches + [cs_opt_loopunroll];
    level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
 
+function SetMipsABIType(const s : string) : boolean;
+
 Implementation
 
+uses
+  cutils;
+
+function SetMipsABIType(const s : string) : boolean;
+
+  var
+    abi : tabitype;
+  begin
+    SetMipsABIType:=false;
+    for abi := low(tabitype) to high(tabitype) do
+      if (lower(s)=abitypestr[abi]) then
+        begin
+          mips_abi:=abi;
+          SetMipsABIType:=true;
+          break;
+        end;
+  end;
+           
 end.

+ 7 - 1
compiler/msg/errore.msg

@@ -390,7 +390,7 @@ scan_w_unavailable_system_codepage=02091_W_Current system codepage "$1" is not a
 #
 # Parser
 #
-# 03322 is the last used one
+# 03324 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -1447,6 +1447,12 @@ parser_e_jvm_invalid_virtual_constructor_call=03321_E_Calling a virtual construc
 parser_e_method_lower_visibility=03322_E_Overriding method "$1" cannot have a lower visibility ($2) than in parent class $3 ($4)
 % The JVM does not allow lowering the visibility of an overriding method.
 % \end{description}
+parser_w_nostackframe_without_assembler=03323_W_Procedure/Function declared with call option NOSTACKFRAME but without ASSEMBLER
+% nostackframe call modifier is supposed to be used in conjunction with assembler.
+parser_e_nostackframe_with_locals=03324_E_Procedure/Function declared with call option NOSTACKFRAME but local stack size is $1
+% nostackframe call modifier used without assembler modifier
+% might still generate local stack needs.
+%
 # Type Checking
 #
 # 04119 is the last used one

+ 4 - 2
compiler/msgidx.inc

@@ -417,6 +417,8 @@ const
   parser_e_feature_unsupported_for_vm=03320;
   parser_e_jvm_invalid_virtual_constructor_call=03321;
   parser_e_method_lower_visibility=03322;
+  parser_w_nostackframe_without_assembler=03323;
+  parser_e_nostackframe_with_locals=03324;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
@@ -955,9 +957,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 67004;
+  MsgTxtSize = 67185;
 
   MsgIdxMax : array[1..20] of longint=(
-    26,92,323,120,87,56,125,26,202,63,
+    26,92,325,120,87,56,125,26,202,63,
     53,20,1,1,1,1,1,1,1,1
   );

File diff ditekan karena terlalu besar
+ 374 - 367
compiler/msgtxt.inc


+ 7 - 2
compiler/ncgutil.pas

@@ -1323,7 +1323,7 @@ implementation
     procedure gen_proc_entry_code(list:TAsmList);
       var
         hitemp,
-        lotemp : longint;
+        lotemp, stack_frame_size : longint;
       begin
         { generate call frame marker for dwarf call frame info }
         current_asmdata.asmcfi.start_frame(list);
@@ -1346,7 +1346,12 @@ implementation
           end;
 
          { generate target specific proc entry code }
-         hlcg.g_proc_entry(list,current_procinfo.calc_stackframe_size,(po_nostackframe in current_procinfo.procdef.procoptions));
+         stack_frame_size := current_procinfo.calc_stackframe_size;
+         if (stack_frame_size <> 0) and
+            (po_nostackframe in current_procinfo.procdef.procoptions) then
+           message1(parser_e_nostackframe_with_locals,tostr(stack_frame_size));
+
+         hlcg.g_proc_entry(list,stack_frame_size,(po_nostackframe in current_procinfo.procdef.procoptions));
       end;
 
 

+ 73 - 7
compiler/ogbase.pas

@@ -83,7 +83,9 @@ interface
            links to some sections }
          RELOC_NONE,
          { Darwin relocation, using PAIR }
-         RELOC_PIC_PAIR
+         RELOC_PIC_PAIR,
+         { Untranslated target-specific value }
+         RELOC_RAW
       );
 
 {$ifndef x86_64}
@@ -114,6 +116,12 @@ interface
       { GNU extensions }
       debuglinkname='.gnu_debuglink';
 
+      { TObjRelocation.flags }
+      { 'ftype' field contains platform-specific value }
+      rf_raw = 1;
+      { relocation must be added to dynamic list }
+      rf_dynamic = 2;
+
     type
       TObjSectionOption = (
        { Has Data available in the file }
@@ -172,15 +180,23 @@ interface
      PObjStabEntry=^TObjStabEntry;
 
      TObjRelocation = class
+     private
+        function GetType:TObjRelocationType;
+        procedure SetType(v:TObjRelocationType);
+     public
         DataOffset,
         orgsize    : aword;  { COFF: original size of the symbol to relocate }
                              { ELF: explicit addend }
         symbol     : TObjSymbol;
         objsection : TObjSection; { only used if symbol=nil }
-        typ        : TObjRelocationType;
+        ftype      : byte;
         size       : byte;
+        flags      : byte;
         constructor CreateSymbol(ADataOffset:aword;s:TObjSymbol;Atyp:TObjRelocationType);
         constructor CreateSection(ADataOffset:aword;aobjsec:TObjSection;Atyp:TObjRelocationType);
+        constructor CreateRaw(ADataOffset:aword;s:TObjSymbol;ARawType:byte);
+        function TargetName:TSymStr;
+        property typ: TObjRelocationType read GetType write SetType;
      end;
 
      TObjSection = class(TFPHashObject)
@@ -219,6 +235,7 @@ interface
        procedure alloc(l:aword);
        procedure addsymReloc(ofs:aword;p:TObjSymbol;Reloctype:TObjRelocationType);
        procedure addsectionReloc(ofs:aword;aobjsec:TObjSection;Reloctype:TObjRelocationType);
+       procedure addrawReloc(ofs:aword;p:TObjSymbol;RawReloctype:byte);
        procedure ReleaseData;
        function  FullName:string;
        property  Data:TDynamicArray read FData;
@@ -327,7 +344,8 @@ interface
 
       TVTableEntry=record
         ObjRelocation : TObjRelocation;
-        orgreloctype  : TObjRelocationType;
+        orgreloctype,
+        orgrelocflags : byte;
         Enabled,
         Used  : Boolean;
       end;
@@ -627,7 +645,7 @@ implementation
         Symbol:=s;
         OrgSize:=0;
         ObjSection:=nil;
-        Typ:=Atyp;
+        ftype:=ord(Atyp);
       end;
 
 
@@ -639,10 +657,50 @@ implementation
         Symbol:=nil;
         OrgSize:=0;
         ObjSection:=aobjsec;
-        Typ:=Atyp;
+        ftype:=ord(Atyp);
       end;
 
 
+    constructor TObjRelocation.CreateRaw(ADataOffset:aword;s:TObjSymbol;ARawType:byte);
+      begin
+        if not assigned(s) then
+          internalerror(2012091701);
+        DataOffset:=ADataOffset;
+        Symbol:=s;
+        ObjSection:=nil;
+        orgsize:=0;
+        ftype:=ARawType;
+        flags:=rf_raw;
+      end;
+
+
+    function TObjRelocation.GetType:TObjRelocationType;
+      begin
+        if (flags and rf_raw)=0 then
+          result:=TObjRelocationType(ftype)
+        else
+          result:=RELOC_RAW;
+      end;
+
+
+    procedure TObjRelocation.SetType(v:TObjRelocationType);
+      begin
+        ftype:=ord(v);
+        flags:=flags and (not rf_raw);
+      end;
+
+
+    function TObjRelocation.TargetName:TSymStr;
+      begin
+        if assigned(symbol) then
+          if symbol.typ=AT_SECTION then
+            result:=symbol.objsection.name
+          else
+            result:=symbol.Name
+        else
+          result:=objsection.Name;
+      end;
+
 {****************************************************************************
                               TObjSection
 ****************************************************************************}
@@ -781,6 +839,12 @@ implementation
       end;
 
 
+    procedure TObjSection.addrawReloc(ofs:aword;p:TObjSymbol;RawReloctype:byte);
+      begin
+        ObjRelocations.Add(TObjRelocation.CreateRaw(ofs,p,RawReloctype));
+      end;
+
+
     procedure TObjSection.ReleaseData;
       begin
         if assigned(FData) then
@@ -1419,7 +1483,8 @@ implementation
             if objreloc.dataoffset=vtblentryoffset then
               begin
                 EntryArray[VTableIdx].ObjRelocation:=objreloc;
-                EntryArray[VTableIdx].OrgRelocType:=objreloc.typ;
+                EntryArray[VTableIdx].OrgRelocType:=objreloc.ftype;
+                EntryArray[VTableIdx].OrgRelocFlags:=objreloc.flags;
                 objreloc.typ:=RELOC_ZERO;
                 break;
               end;
@@ -1447,7 +1512,8 @@ implementation
         { Restore relocation if available }
         if assigned(EntryArray[VTableIdx].ObjRelocation) then
           begin
-            EntryArray[VTableIdx].ObjRelocation.typ:=EntryArray[VTableIdx].OrgRelocType;
+            EntryArray[VTableIdx].ObjRelocation.ftype:=EntryArray[VTableIdx].OrgRelocType;
+            EntryArray[VTableIdx].ObjRelocation.flags:=EntryArray[VTableIdx].OrgRelocFlags;
             result:=EntryArray[VTableIdx].ObjRelocation;
           end;
         EntryArray[VTableIdx].Used:=true;

+ 33 - 13
compiler/ogelf.pas

@@ -80,7 +80,6 @@ interface
          procedure createsymtab(data: TObjData);
          procedure writesectionheader(s:TElfObjSection);
          procedure section_write_symbol(p:TObject;arg:pointer);
-         procedure section_write_sh_string(p:TObject;arg:pointer);
          procedure section_count_sections(p:TObject;arg:pointer);
          procedure section_create_relocsec(p:TObject;arg:pointer);
          procedure section_write_sechdr(p:TObject;arg:pointer);
@@ -1056,7 +1055,10 @@ implementation
           AB_EXTERNAL :
             elfsym.st_info:=STB_GLOBAL shl 4;
           AB_WEAK_EXTERNAL :
-            elfsym.st_info:=STB_WEAK shl 4;
+            begin
+              elfsym.st_info:=STB_WEAK shl 4;
+              elfsym.st_value:=objsym.address;
+            end;
           AB_GLOBAL :
             begin
               elfsym.st_value:=objsym.address;
@@ -1072,6 +1074,10 @@ implementation
                 elfsym.st_info:=elfsym.st_info or STT_FUNC;
               AT_DATA :
                 elfsym.st_info:=elfsym.st_info or STT_OBJECT;
+              AT_TLS:
+                elfsym.st_info:=elfsym.st_info or STT_TLS;
+              AT_GNU_IFUNC:
+                elfsym.st_info:=elfsym.st_info or STT_GNU_IFUNC;
             end;
           end;
         if objsym.bind<>AB_COMMON then
@@ -1196,19 +1202,33 @@ implementation
       end;
 
 
-    procedure TElfObjectOutput.section_write_sh_string(p:TObject;arg:pointer);
-      begin
-        TElfObjSection(p).shstridx:=shstrtabsect.writestr(TObjSection(p).name);
-      end;
-
-
     procedure TElfObjectOutput.createshstrtab(data: TObjData);
+      var
+        i,prefixlen:longint;
+        objsec,target:TElfObjSection;
       begin
-        with data do
-         begin
-           shstrtabsect.writezeros(1);
-           ObjSectionList.ForEachCall(@section_write_sh_string,nil);
-         end;
+        shstrtabsect.writezeros(1);
+        prefixlen:=length('.rel')+ord(relocs_use_addend);
+        for i:=0 to data.ObjSectionList.Count-1 do
+          begin
+            objsec:=TElfObjSection(data.ObjSectionList[i]);
+            { Alias section names into names of corresponding reloc sections,
+              this is allowed by ELF specs and saves good half of .shstrtab space. }
+            if objsec.shtype=relsec_shtype[relocs_use_addend] then
+              begin
+                target:=TElfObjSection(data.ObjSectionList[objsec.shinfo-1]);
+                if (target.ObjRelocations.Count=0) or
+                   (target.shstridx<prefixlen) then
+                  InternalError(2012101204);
+                objsec.shstridx:=target.shstridx-prefixlen;
+              end
+            else
+              begin
+                if objsec.ObjRelocations.Count<>0 then
+                  shstrtabsect.write(relsec_prefix[true][1],prefixlen);
+                objsec.shstridx:=shstrtabsect.writestr(objsec.name);
+              end;
+          end;
       end;
 
 

+ 3 - 0
compiler/pdecsub.pas

@@ -2930,6 +2930,9 @@ const
            else
             break;
          end;
+         if (po_nostackframe in pd.procoptions) and
+            not (po_assembler in pd.procoptions) then
+           message(parser_w_nostackframe_without_assembler);
       end;
 
 

+ 7 - 0
compiler/x86/cgx86.pas

@@ -150,6 +150,8 @@ unit cgx86;
       winstackpagesize = 4096;
 {$endif NOTARGETWIN}
 
+    function UseAVX: boolean;
+
   implementation
 
     uses
@@ -158,6 +160,11 @@ unit cgx86;
        tgobj,ncgutil,
        fmodule,symsym;
 
+    function UseAVX: boolean;
+      begin
+        Result:=current_settings.fputype in [fpu_avx];
+      end;
+
     const
       TOpCG2AsmOp: Array[topcg] of TAsmOp = (A_NONE,A_MOV,A_ADD,A_AND,A_DIV,
                             A_IDIV,A_IMUL,A_MUL,A_NEG,A_NOT,A_OR,

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini