diff options
Diffstat (limited to 'compiler')
134 files changed, 2077 insertions, 1246 deletions
diff --git a/compiler/aasmtai.pas b/compiler/aasmtai.pas index d9bc5c2d9a..5a2188d2b0 100644 --- a/compiler/aasmtai.pas +++ b/compiler/aasmtai.pas @@ -68,10 +68,6 @@ interface ait_stab, ait_force_line, ait_function_name, - { Used for .ent .end pair used for .dpr section in MIPS - and probably also for Alpha } - ait_ent, - ait_ent_end, {$ifdef alpha} { the follow is for the DEC Alpha } ait_frame, @@ -140,7 +136,8 @@ interface aitconst_32bit_unaligned, aitconst_64bit_unaligned, { i8086 far pointer; emits: 'DW symbol, SEG symbol' } - aitconst_farptr + aitconst_farptr, + aitconst_got ); const @@ -186,8 +183,6 @@ interface 'stab', 'force_line', 'function_name', - 'ent', - 'ent_end', {$ifdef alpha} { the follow is for the DEC Alpha } 'frame', @@ -297,7 +292,7 @@ interface SkipInstr = [ait_comment, ait_symbol,ait_section ,ait_stab, ait_function_name, ait_force_line ,ait_regalloc, ait_tempalloc, ait_symbol_end - ,ait_ent, ait_ent_end, ait_directive + ,ait_directive ,ait_varloc, {$ifdef JVM} ait_jvar, ait_jcatch, @@ -311,7 +306,6 @@ interface ait_stab,ait_function_name, ait_cutobject,ait_marker,ait_varloc,ait_align,ait_section,ait_comment, ait_const,ait_directive, - ait_ent, ait_ent_end, {$ifdef arm} ait_thumb_func, ait_thumb_set, @@ -357,7 +351,9 @@ interface asd_reference,asd_no_dead_strip,asd_weak_reference,asd_lazy_reference, asd_weak_definition, { for Jasmin } - asd_jclass,asd_jinterface,asd_jsuper,asd_jfield,asd_jlimit,asd_jline + asd_jclass,asd_jinterface,asd_jsuper,asd_jfield,asd_jlimit,asd_jline, + { .ent/.end for MIPS and Alpha } + asd_ent,asd_ent_end ); TAsmSehDirective=( @@ -384,7 +380,9 @@ interface 'extern','nasm_import', 'tc', 'reference', 'no_dead_strip','weak_reference','lazy_reference','weak_definition', { for Jasmin } - 'class','interface','super','field','limit','line' + 'class','interface','super','field','limit','line', + { .ent/.end for MIPS and Alpha } + 'ent','end' ); sehdirectivestr : array[TAsmSehDirective] of string[16]=( '.seh_proc','.seh_endproc', @@ -464,16 +462,6 @@ interface procedure derefimpl;override; end; - tai_ent = class(tai) - Name : string; - Constructor Create (const ProcName : String); - end; - - tai_ent_end = class(tai) - Name : string; - Constructor Create (const ProcName : String); - end; - tai_directive = class(tailineinfo) name : ansistring; directive : TAsmDirective; @@ -485,7 +473,6 @@ interface { Generates an assembler label } tai_label = class(tai) labsym : tasmlabel; - is_global : boolean; {$ifdef arm} { set to true when the label has been moved by insertpcrelativedata to the correct location so one label can be used multiple times } @@ -572,7 +559,9 @@ interface constructor Create_sym(_sym:tasmsymbol); constructor Create_type_sym(_typ:taiconst_type;_sym:tasmsymbol); constructor Create_sym_offset(_sym:tasmsymbol;ofs:aint); + constructor Create_type_sym_offset(_typ:taiconst_type;_sym:tasmsymbol;ofs:aint); constructor Create_rel_sym(_typ:taiconst_type;_sym,_endsym:tasmsymbol); + constructor Create_rel_sym_offset(_typ : taiconst_type; _sym,_endsym : tasmsymbol; _ofs : int64); constructor Create_rva_sym(_sym:tasmsymbol); constructor Createname(const name:string;ofs:aint); constructor Createname(const name:string;_symtyp:Tasmsymtype;ofs:aint); @@ -1288,6 +1277,10 @@ implementation typ:=ait_symbol; sym:=_sym; size:=siz; + { don't redefine global/external symbols as local, as code to access + such symbols is different on some platforms } + if not(sym.bind in [AB_NONE,AB_LOCAL]) then + internalerror(2013081601); sym.bind:=AB_LOCAL; is_global:=false; end; @@ -1426,26 +1419,6 @@ implementation ppufile.putbyte(byte(directive)); end; -{**************************************************************************** - TAI_ENT / TAI_ENT_END - ****************************************************************************} - - Constructor tai_ent.Create (const ProcName : String); - - begin - Inherited Create; - Name:=ProcName; - typ:=ait_ent; - end; - - Constructor tai_ent_end.Create (const ProcName : String); - - begin - Inherited Create; - Name:=ProcName; - typ:=ait_ent_end; - end; - {**************************************************************************** TAI_CONST @@ -1680,6 +1653,24 @@ implementation end; + constructor tai_const.Create_type_sym_offset(_typ : taiconst_type;_sym : tasmsymbol; ofs : aint); + begin + inherited Create; + typ:=ait_const; + consttype:=_typ; + { sym is allowed to be nil, this is used to write nil pointers } + sym:=_sym; + endsym:=nil; + { store the original offset in symofs so that we can recalculate the + value field in the assembler } + symofs:=ofs; + value:=ofs; + { update sym info } + if assigned(sym) then + sym.increfs; + end; + + constructor tai_const.Create_rel_sym(_typ:taiconst_type;_sym,_endsym:tasmsymbol); begin self.create_sym_offset(_sym,0); @@ -1689,6 +1680,15 @@ implementation end; + constructor tai_const.Create_rel_sym_offset(_typ: taiconst_type; _sym,_endsym: tasmsymbol; _ofs: int64); + begin + self.create_sym_offset(_sym,_ofs); + consttype:=_typ; + endsym:=_endsym; + endsym.increfs; + end; + + constructor tai_const.Create_rva_sym(_sym:tasmsymbol); begin self.create_sym_offset(_sym,0); @@ -2046,7 +2046,6 @@ implementation typ:=ait_label; labsym:=_labsym; labsym.is_set:=true; - is_global:=(labsym.bind in [AB_GLOBAL,AB_PRIVATE_EXTERN]); end; @@ -2054,7 +2053,7 @@ implementation begin inherited ppuload(t,ppufile); labsym:=tasmlabel(ppufile.getasmsymbol); - is_global:=boolean(ppufile.getbyte); + ppufile.getbyte; { was is_global flag, now unused } end; @@ -2062,7 +2061,7 @@ implementation begin inherited ppuwrite(ppufile); ppufile.putasmsymbol(labsym); - ppufile.putbyte(byte(is_global)); + ppufile.putbyte(0); { was is_global flag, now unused } end; diff --git a/compiler/aggas.pas b/compiler/aggas.pas index e698078940..2e99604817 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -956,6 +956,11 @@ implementation AsmLn; end; {$endif cpu64bitaddr} + aitconst_got: + begin + AsmWrite(#9'.word'#9+tai_const(hp).sym.name+'(GOT)'); + Asmln; + end; aitconst_uleb128bit, aitconst_sleb128bit, {$ifdef cpu64bitaddr} @@ -1337,23 +1342,7 @@ implementation begin AsmWriteLn(#9'.weak '+tai_weak(hp).sym^); end; - ait_ent: - begin - AsmWrite(#9'.ent'#9); - if replaceforbidden then - AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_ent(hp).Name)) - else - AsmWriteLn(tai_ent(hp).Name); - end; - ait_ent_end: - begin - AsmWrite(#9'.end'#9); - if replaceforbidden then - AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_ent_end(hp).Name)) - else - AsmWriteLn(tai_ent_end(hp).Name); - end; - ait_symbol_end : + ait_symbol_end : begin if tf_needs_symbol_size in target_info.flags then begin diff --git a/compiler/aoptobj.pas b/compiler/aoptobj.pas index 4f78498501..664fc993d2 100644 --- a/compiler/aoptobj.pas +++ b/compiler/aoptobj.pas @@ -289,13 +289,23 @@ Unit AoptObj; { returns true if the operands o1 and o2 are completely equal } Function OpsEqual(const o1,o2:toper): Boolean; - { Returns the next ait_alloc object with ratype ra_dealloc for + { Returns the next ait_alloc object with ratype ra_alloc for Reg is found in the block of Tai's starting with StartPai and ending with the next "real" instruction. If none is found, it returns - nil } + nil + } Function FindRegAlloc(Reg: TRegister; StartPai: Tai): tai_regalloc; + { Returns the last ait_alloc object with ratype ra_alloc for + Reg is found in the block + of Tai's starting with StartPai and ending with the next "real" + instruction. If none is found, it returns + nil + } + Function FindRegAllocBackward(Reg : TRegister; StartPai : Tai) : tai_regalloc; + + { Returns the next ait_alloc object with ratype ra_dealloc for Reg which is found in the block of Tai's starting with StartPai and ending with the next "real" instruction. If none is found, it returns @@ -1048,6 +1058,33 @@ Unit AoptObj; End; + Function TAOptObj.FindRegAllocBackward(Reg: TRegister; StartPai: Tai): tai_regalloc; + Begin + Result:=nil; + Repeat + While Assigned(StartPai) And + ((StartPai.typ in (SkipInstr - [ait_regAlloc])) Or + ((StartPai.typ = ait_label) and + Not(Tai_Label(StartPai).labsym.Is_Used))) Do + StartPai := Tai(StartPai.Previous); + If Assigned(StartPai) And + (StartPai.typ = ait_regAlloc) Then + Begin + if (tai_regalloc(StartPai).ratype=ra_alloc) and + (getregtype(tai_regalloc(StartPai).Reg) = getregtype(Reg)) and + (getsupreg(tai_regalloc(StartPai).Reg) = getsupreg(Reg)) then + begin + Result:=tai_regalloc(StartPai); + exit; + end; + StartPai := Tai(StartPai.Previous); + End + else + exit; + Until false; + End; + + function TAOptObj.FindRegDeAlloc(Reg: TRegister; StartPai: Tai): tai_regalloc; Begin Result:=nil; diff --git a/compiler/arm/aasmcpu.pas b/compiler/arm/aasmcpu.pas index da8a592ba9..e87fdd578a 100644 --- a/compiler/arm/aasmcpu.pas +++ b/compiler/arm/aasmcpu.pas @@ -644,6 +644,8 @@ implementation op:=A_FLDD; R_SUBFS: op:=A_FLDS; + R_SUBNONE: + op:=A_VLDR; else internalerror(2009112905); end; @@ -674,6 +676,8 @@ implementation op:=A_FSTD; R_SUBFS: op:=A_FSTS; + R_SUBNONE: + op:=A_VSTR; else internalerror(2009112904); end; @@ -715,7 +719,8 @@ implementation A_FTOUIS,A_FTOUID,A_FUITOS,A_FUITOD, A_SXTB16,A_UXTB16, A_UXTB,A_UXTH,A_SXTB,A_SXTH, - A_NEG: + A_NEG, + A_VABS,A_VADD,A_VCVT,A_VDIV,A_VLDR,A_VMOV,A_VMUL,A_VNEG,A_VSQRT,A_VSUB: if opnr=0 then result:=operand_write else @@ -724,7 +729,8 @@ implementation A_CMN,A_CMP,A_TEQ,A_TST, A_CMF,A_CMFE,A_WFS,A_CNF, A_FCMPS,A_FCMPD,A_FCMPES,A_FCMPED,A_FCMPEZS,A_FCMPEZD, - A_FCMPZS,A_FCMPZD: + A_FCMPZS,A_FCMPZD, + A_VCMP,A_VCMPE: result:=operand_read; A_SMLAL,A_UMLAL: if opnr in [0,1] then @@ -739,7 +745,8 @@ implementation result:=operand_read; A_STR,A_STRB,A_STRBT, A_STRH,A_STRT,A_STF,A_SFM, - A_FSTS,A_FSTD: + A_FSTS,A_FSTD, + A_VSTR: { important is what happens with the involved registers } if opnr=0 then result := operand_read @@ -885,7 +892,7 @@ implementation lastinspos:=-1; curinspos:=0; extradataoffset:=0; - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin multiplier:=2; limit:=504; @@ -915,7 +922,7 @@ implementation begin { create a new copy of a data entry on arm thumb if the entry has been inserted already before because arm thumb does not allow pc relative negative offsets } - if (current_settings.cputype in cpu_thumb) and + if (GenerateThumbCode) and tai_label(curdatatai).inserted then begin current_asmdata.getjumplabel(l); @@ -1026,21 +1033,57 @@ implementation end; { special case for case jump tables } if SimpleGetNextInstruction(curtai,hp) and - (tai(hp).typ=ait_instruction) and - (taicpu(hp).opcode=A_LDR) and - (taicpu(hp).oper[0]^.typ=top_reg) and - (taicpu(hp).oper[0]^.reg=NR_PC) then + (tai(hp).typ=ait_instruction) then begin - penalty:=1*multiplier; - hp:=tai(hp.next); - { skip register allocations and comments inserted by the optimizer } - while assigned(hp) and (hp.typ in [ait_comment,ait_regalloc]) do - hp:=tai(hp.next); - while assigned(hp) and (hp.typ=ait_const) do - begin - inc(penalty,multiplier); - hp:=tai(hp.next); - end; + case taicpu(hp).opcode of + A_BX, + A_LDR: + { approximation if we hit a case jump table } + if ((taicpu(hp).opcode=A_LDR) and not(GenerateThumbCode or GenerateThumb2Code) and + (taicpu(hp).oper[0]^.typ=top_reg) and + (taicpu(hp).oper[0]^.reg=NR_PC)) or + ((taicpu(hp).opcode=A_BX) and (GenerateThumbCode) and + (taicpu(hp).oper[0]^.typ=top_reg)) + then + begin + penalty:=multiplier; + hp:=tai(hp.next); + { skip register allocations and comments inserted by the optimizer as well as a label + as jump tables for thumb might have } + while assigned(hp) and (hp.typ in [ait_comment,ait_regalloc,ait_label]) do + hp:=tai(hp.next); + while assigned(hp) and (hp.typ=ait_const) do + begin + inc(penalty,multiplier); + hp:=tai(hp.next); + end; + end; + A_IT: + if GenerateThumb2Code then + penalty:=multiplier; + A_ITE, + A_ITT: + if GenerateThumb2Code then + penalty:=2*multiplier; + A_ITEE, + A_ITTE, + A_ITET, + A_ITTT: + if GenerateThumb2Code then + penalty:=3*multiplier; + A_ITEEE, + A_ITTEE, + A_ITETE, + A_ITTTE, + A_ITEET, + A_ITTET, + A_ITETT, + A_ITTTT: + if GenerateThumb2Code then + penalty:=4*multiplier; + else + penalty:=0; + end; end else penalty:=0; @@ -1049,7 +1092,8 @@ implementation if SimpleGetNextInstruction(curtai,hp) and (tai(hp).typ=ait_instruction) and ((taicpu(hp).opcode=A_FLDS) or - (taicpu(hp).opcode=A_FLDD)) then + (taicpu(hp).opcode=A_FLDD) or + (taicpu(hp).opcode=A_VLDR)) then limit:=254; { don't miss an insert } @@ -1071,7 +1115,7 @@ implementation ) and ( { do not insert data after a B instruction due to their limited range } - not((current_settings.cputype in cpu_thumb) and + not((GenerateThumbCode) and (taicpu(curtai).opcode=A_B) ) ) then @@ -1079,15 +1123,15 @@ implementation lastinspos:=-1; extradataoffset:=0; - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then limit:=502 else limit:=1016; - { on arm thumb, insert the date always after all labels etc. following an instruction so it + { on arm thumb, insert the data always after all labels etc. following an instruction so it is prevent that a bxx yyy; bl xxx; yyyy: sequence gets separated ( we never insert on arm thumb after bxx) and the distance of bxx gets too long } - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then while assigned(tai(curtai.Next)) and (tai(curtai.Next).typ in SkipInstr+[ait_label]) do curtai:=tai(curtai.next); @@ -1095,7 +1139,7 @@ implementation current_asmdata.getjumplabel(l); { align thumb in thumb .text section to 4 bytes } - if not(curdata.empty) and (current_settings.cputype in cpu_thumb) then + if not(curdata.empty) and (GenerateThumbCode) then curdata.Insert(tai_align.Create(4)); curdata.insert(taicpu.op_sym(A_B,l)); curdata.concat(tai_label.create(l)); @@ -1123,7 +1167,7 @@ implementation curtai:=tai(curtai.next); end; { align thumb in thumb .text section to 4 bytes } - if not(curdata.empty) and (current_settings.cputype in cpu_thumb+cpu_thumb2) then + if not(curdata.empty) and (GenerateThumbCode or GenerateThumb2Code) then curdata.Insert(tai_align.Create(4)); list.concatlist(curdata); curdata.free; @@ -1285,7 +1329,7 @@ implementation procedure finalizearmcode(list, listtoinsert: TAsmList); begin { Do Thumb-2 16bit -> 32bit transformations } - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then begin ensurethumb2encodings(list); foldITInstructions(list); diff --git a/compiler/arm/agarmgas.pas b/compiler/arm/agarmgas.pas index b1be01eae1..f30c007132 100644 --- a/compiler/arm/agarmgas.pas +++ b/compiler/arm/agarmgas.pas @@ -110,9 +110,9 @@ unit agarmgas; if (current_settings.fputype = fpu_fpv4_s16) then result:='-mfpu=fpv4-sp-d16 '+result; - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then result:='-march='+cputype_to_gas_march[current_settings.cputype]+' -mthumb -mthumb-interwork '+result - else if current_settings.cputype in cpu_thumb then + else if GenerateThumbCode then result:='-march='+cputype_to_gas_march[current_settings.cputype]+' -mthumb -mthumb-interwork '+result // EDSP instructions in RTL require armv5te at least to not generate error else if current_settings.cputype >= cpu_armv5te then @@ -126,7 +126,7 @@ unit agarmgas; procedure TArmGNUAssembler.WriteExtraHeader; begin inherited WriteExtraHeader; - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then AsmWriteLn(#9'.syntax unified'); end; @@ -164,10 +164,10 @@ unit agarmgas; if (base<>NR_NO) and not(is_pc(base)) then internalerror(200309011); s:=symbol.name; - if offset<0 then - s:=s+tostr(offset) - else if offset>0 then - s:=s+'+'+tostr(offset); + if offset<>0 then + s:=s+tostr_with_plus(offset); + if refaddr=addr_pic then + s:=s+'(PLT)'; end else begin @@ -289,7 +289,7 @@ unit agarmgas; sep: string[3]; begin op:=taicpu(hp).opcode; - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then begin postfix:=''; if taicpu(hp).wideformat then diff --git a/compiler/arm/aoptcpu.pas b/compiler/arm/aoptcpu.pas index c71a939d30..1ae46b125e 100644 --- a/compiler/arm/aoptcpu.pas +++ b/compiler/arm/aoptcpu.pas @@ -86,7 +86,7 @@ Implementation function CanBeCond(p : tai) : boolean; begin result:= - not(current_settings.cputype in cpu_thumb) and + not(GenerateThumbCode) and (p.typ=ait_instruction) and (taicpu(p).condition=C_None) and ((taicpu(p).opcode<A_IT) or (taicpu(p).opcode>A_ITTTT)) and @@ -284,7 +284,7 @@ Implementation function isValidConstLoadStoreOffset(const aoffset: longint; const pf: TOpPostfix) : boolean; begin - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then result := (aoffset<4096) and (aoffset>-256) else result := ((pf in [PF_None,PF_B]) and @@ -375,9 +375,8 @@ Implementation { taicpu(p).oper[0]^.reg is not used anymore, try to find its allocation and remove it if possible } - GetLastInstruction(p,hp1); asml.Remove(dealloc); - alloc:=FindRegAlloc(taicpu(p).oper[0]^.reg,tai(hp1.Next)); + alloc:=FindRegAllocBackward(taicpu(p).oper[0]^.reg,tai(p.previous)); if assigned(alloc) then begin asml.Remove(alloc); @@ -420,7 +419,7 @@ Implementation var hp1: tai; begin - if (current_settings.cputype in cpu_arm) and + if GenerateARMCode and (p.ops=3) and MatchOperand(p.oper[0]^, p.oper[1]^.reg) and GetNextInstructionUsingReg(p, hp1, p.oper[0]^.reg) and @@ -500,7 +499,7 @@ Implementation { don't apply the optimization if the (new) index register is loaded } (p.oper[0]^.reg<>taicpu(hp1).oper[2]^.reg) and not(RegModifiedBetween(taicpu(hp1).oper[2]^.reg,p,hp1)) and - (current_settings.cputype in cpu_arm) then + GenerateARMCode then begin DebugMsg('Peephole Str/LdrAdd/Sub2Str/Ldr Postindex done', p); p.oper[1]^.ref^.addressmode:=AM_POSTINDEXED; @@ -641,7 +640,8 @@ Implementation into strd reg1,ref } - else if (CPUARM_HAS_EDSP in cpu_capabilities[current_settings.cputype]) and + else if (GenerateARMCode or GenerateThumb2Code) and + (CPUARM_HAS_EDSP in cpu_capabilities[current_settings.cputype]) and (taicpu(p).oppostfix=PF_None) and (taicpu(p).oper[1]^.ref^.addressmode=AM_OFFSET) and GetNextInstruction(p,hp1) and @@ -705,7 +705,8 @@ Implementation ... ldrd reg1,ref } - else if (CPUARM_HAS_EDSP in cpu_capabilities[current_settings.cputype]) and + else if (GenerateARMCode or GenerateThumb2Code) and + (CPUARM_HAS_EDSP in cpu_capabilities[current_settings.cputype]) and { ldrd does not allow any postfixes ... } (taicpu(p).oppostfix=PF_None) and not(odd(getsupreg(taicpu(p).oper[0]^.reg))) and @@ -736,7 +737,8 @@ Implementation ldrb dst2, [ref] } - if (taicpu(p).oppostfix=PF_B) and + if not(GenerateThumbCode) and + (taicpu(p).oppostfix=PF_B) and GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and MatchInstruction(hp1, A_AND, [taicpu(p).condition], [PF_NONE]) and (taicpu(hp1).oper[1]^.reg = taicpu(p).oper[0]^.reg) and @@ -838,10 +840,10 @@ Implementation SM_LSR, SM_LSL: begin - hp1:=taicpu.op_reg_const(A_MOV,taicpu(p).oper[0]^.reg,0); - InsertLLItem(p.previous, p.next, hp1); + hp2:=taicpu.op_reg_const(A_MOV,taicpu(p).oper[0]^.reg,0); + InsertLLItem(p.previous, p.next, hp2); p.free; - p:=hp1; + p:=hp2; end; else internalerror(2008072803); @@ -1085,7 +1087,12 @@ Implementation will also be in hp1 then. } if (taicpu(hp1).ops > I) and - MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[I]^.reg) then + MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[I]^.reg) and + { prevent certain combinations on thumb(2), this is only a safe approximation } + (not(GenerateThumbCode or GenerateThumb2Code) or + ((getsupreg(taicpu(p).oper[1]^.reg)<>RS_R13) and + (getsupreg(taicpu(p).oper[1]^.reg)<>RS_R15)) + ) then begin DebugMsg('Peephole RedundantMovProcess done', hp1); taicpu(hp1).oper[I]^.reg := taicpu(p).oper[1]^.reg; @@ -1116,7 +1123,7 @@ Implementation A_AND, A_BIC, A_EOR, A_ORR, A_TEQ, A_TST, A_CMP, A_CMN], [taicpu(p).condition], [PF_None]) and - (not ((current_settings.cputype in cpu_thumb2) and + (not ((GenerateThumb2Code) and (taicpu(hp1).opcode in [A_SBC]) and (((taicpu(hp1).ops=3) and MatchOperand(taicpu(p).oper[0]^, taicpu(hp1).oper[1]^.reg)) or @@ -1217,7 +1224,8 @@ Implementation add r1, r3, #imm ldr r0, [r1, r2, lsl #2] } - if (taicpu(p).opcode = A_MOV) and + if (not(GenerateThumbCode)) and + (taicpu(p).opcode = A_MOV) and (taicpu(p).ops = 3) and (taicpu(p).oper[1]^.typ = top_reg) and (taicpu(p).oper[2]^.typ = top_shifterop) and @@ -1225,6 +1233,12 @@ Implementation it is also extremly unlikely to be emitted this way} (taicpu(p).oper[2]^.shifterop^.shiftmode <> SM_RRX) and (taicpu(p).oper[2]^.shifterop^.shiftimm <> 0) and + { thumb2 allows only lsl #0..#3 } + (not(GenerateThumb2Code) or + ((taicpu(p).oper[2]^.shifterop^.shiftimm in [0..3]) and + (taicpu(p).oper[2]^.shifterop^.shiftmode=SM_LSL) + ) + ) and (taicpu(p).oppostfix = PF_NONE) and GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and {Only LDR, LDRB, STR, STRB can handle scaled register indexing} @@ -1894,7 +1908,7 @@ Implementation case taicpu(p).opcode Of A_B: if (taicpu(p).condition<>C_None) and - not(current_settings.cputype in cpu_thumb) then + not(GenerateThumbCode) then begin { check for Bxx xxx @@ -2142,7 +2156,7 @@ Implementation { TODO : schedule also forward } { TODO : schedule distance > 1 } var - hp1,hp2,hp3,hp4,hp5 : tai; + hp1,hp2,hp3,hp4,hp5,insertpos : tai; list : TAsmList; begin result:=true; @@ -2233,11 +2247,22 @@ Implementation end; asml.Remove(hp1); + { if there are address labels associated with hp2, those must + stay with hp2 (e.g. for GOT-less PIC) } + insertpos:=hp2; + while assigned(hp2.previous) and + (tai(hp2.previous).typ<>ait_instruction) do + begin + hp2:=tai(hp2.previous); + if (hp2.typ=ait_label) and + (tai_label(hp2).labsym.typ=AT_ADDR) then + insertpos:=hp2; + end; {$ifdef DEBUG_PREREGSCHEDULER} - asml.insertbefore(tai_comment.Create(strpnew('Rescheduled')),hp2); + asml.insertbefore(tai_comment.Create(strpnew('Rescheduled')),insertpos); {$endif DEBUG_PREREGSCHEDULER} - asml.InsertBefore(hp1,hp2); - asml.InsertListBefore(hp2,list); + asml.InsertBefore(hp1,insertpos); + asml.InsertListBefore(insertpos,list); p:=tai(p.next) end else if p.typ=ait_instruction then diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index 47e0e7a084..ff17a91dd0 100644 --- a/compiler/arm/cgcpu.pas +++ b/compiler/arm/cgcpu.pas @@ -74,6 +74,7 @@ unit cgcpu; procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);override; procedure g_proc_exit(list : TAsmList;parasize : longint;nostackframe:boolean); override; + procedure g_maybe_got_init(list : TAsmList); override; procedure a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister);override; @@ -111,7 +112,9 @@ unit cgcpu; { clear out potential overflow bits from 8 or 16 bit operations } { the upper 24/16 bits of a register after an operation } procedure maybeadjustresult(list: TAsmList; op: TOpCg; size: tcgsize; dst: tregister); - function get_darwin_call_stub(const s: string; weak: boolean): tasmsymbol; + + { mla for thumb requires that none of the registers is equal to r13/r15, this method ensures this } + procedure safe_mla(list: TAsmList;op1,op2,op3,op4 : TRegister); end; { tcgarm is shared between normal arm and thumb-2 } @@ -624,19 +627,30 @@ unit cgcpu; procedure tbasecgarm.a_call_name(list : TAsmList;const s : string; weak: boolean); var branchopcode: tasmop; + r : treference; + sym : TAsmSymbol; begin { check not really correct: should only be used for non-Thumb cpus } if CPUARM_HAS_BLX_LABEL in cpu_capabilities[current_settings.cputype] then branchopcode:=A_BLX else branchopcode:=A_BL; - if target_info.system<>system_arm_darwin then - if not weak then - list.concat(taicpu.op_sym(branchopcode,current_asmdata.RefAsmSymbol(s))) - else - list.concat(taicpu.op_sym(branchopcode,current_asmdata.WeakRefAsmSymbol(s))) + if not(weak) then + sym:=current_asmdata.RefAsmSymbol(s) + else + sym:=current_asmdata.WeakRefAsmSymbol(s); + reference_reset_symbol(r,sym,0,sizeof(pint)); + + if (tf_pic_uses_got in target_info.flags) and + (cs_create_pic in current_settings.moduleswitches) then + begin + include(current_procinfo.flags,pi_needs_got); + r.refaddr:=addr_pic + end else - list.concat(taicpu.op_sym(branchopcode,get_darwin_call_stub(s,weak))); + r.refaddr:=addr_full; + + list.concat(taicpu.op_ref(branchopcode,r)); { the compiler does not properly set this flag anymore in pass 1, and for now we only need it after pass 2 (I hope) (JM) @@ -1173,7 +1187,7 @@ unit cgcpu; ((abs(ref.offset) mod 4)<>0) ) ) or - ((current_settings.cputype in cpu_thumb) and + ((GenerateThumbCode) and (((oppostfix in [PF_SB,PF_SH]) and (ref.offset<>0)) or ((oppostfix=PF_None) and ((ref.offset<0) or ((ref.base<>NR_STACK_POINTER_REG) and (ref.offset>124)) or ((ref.base=NR_STACK_POINTER_REG) and (ref.offset>1020)) or ((ref.offset mod 4)<>0))) or @@ -1185,7 +1199,7 @@ unit cgcpu; fixref(list,ref); end; - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin { certain thumb load require base and index } if (oppostfix in [PF_SB,PF_SH]) and @@ -1401,9 +1415,25 @@ unit cgcpu; procedure do_shift(shiftmode : tshiftmode; shiftimm : byte; reg : tregister); begin - so.shiftmode:=shiftmode; - so.shiftimm:=shiftimm; - list.concat(taicpu.op_reg_reg_shifterop(A_MOV,reg2,reg,so)); + if GenerateThumbCode then + begin + case shiftmode of + SM_ASR: + a_op_const_reg_reg(list,OP_SAR,OS_32,shiftimm,reg,reg2); + SM_LSR: + a_op_const_reg_reg(list,OP_SHR,OS_32,shiftimm,reg,reg2); + SM_LSL: + a_op_const_reg_reg(list,OP_SHL,OS_32,shiftimm,reg,reg2); + else + internalerror(2013090301); + end; + end + else + begin + so.shiftmode:=shiftmode; + so.shiftimm:=shiftimm; + list.concat(taicpu.op_reg_reg_shifterop(A_MOV,reg2,reg,so)); + end; end; var @@ -1423,7 +1453,10 @@ unit cgcpu; if current_settings.cputype<cpu_armv6 then case fromsize of OS_8: - list.concat(taicpu.op_reg_reg_const(A_AND,reg2,reg1,$ff)); + if GenerateThumbCode then + a_op_const_reg_reg(list,OP_AND,OS_32,$ff,reg1,reg2) + else + list.concat(taicpu.op_reg_reg_const(A_AND,reg2,reg1,$ff)); OS_S8: begin do_shift(SM_LSL,24,reg1); @@ -1451,7 +1484,7 @@ unit cgcpu; else case fromsize of OS_8: - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then list.concat(taicpu.op_reg_reg(A_UXTB,reg2,reg1)) else list.concat(taicpu.op_reg_reg_const(A_AND,reg2,reg1,$ff)); @@ -1586,12 +1619,12 @@ unit cgcpu; b : byte; begin a_reg_alloc(list,NR_DEFAULTFLAGS); - if (not(current_settings.cputype in cpu_thumb) and is_shifter_const(a,b)) or - ((current_settings.cputype in cpu_thumb) and is_thumb_imm(a)) then + if (not(GenerateThumbCode) and is_shifter_const(a,b)) or + ((GenerateThumbCode) and is_thumb_imm(a)) then list.concat(taicpu.op_reg_const(A_CMP,reg,a)) { CMN reg,0 and CMN reg,$80000000 are different from CMP reg,$ffffffff and CMP reg,$7fffffff regarding the flags according to the ARM manual } - else if (a<>$7fffffff) and (a<>-1) and not(current_settings.cputype in cpu_thumb) and is_shifter_const(-a,b) then + else if (a<>$7fffffff) and (a<>-1) and not(GenerateThumbCode) and is_shifter_const(-a,b) then list.concat(taicpu.op_reg_const(A_CMN,reg,-a)) else begin @@ -1620,7 +1653,7 @@ unit cgcpu; list.Concat(taicpu.op_reg_reg(A_CLZ,dst,dst)); a_reg_alloc(list,NR_DEFAULTFLAGS); list.Concat(taicpu.op_reg_const(A_CMP,dst,32)); - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then list.Concat(taicpu.op_cond(A_IT, C_EQ)); list.Concat(setcondition(taicpu.op_reg_const(A_MOV,dst,$ff),C_EQ)); a_reg_dealloc(list,NR_DEFAULTFLAGS); @@ -1642,7 +1675,7 @@ unit cgcpu; ai : taicpu; begin { generate far jump, leave it to the optimizer to get rid of it } - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then ai:=taicpu.op_sym(A_BL,current_asmdata.RefAsmSymbol(s)) else ai:=taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(s)); @@ -1656,7 +1689,7 @@ unit cgcpu; ai : taicpu; begin { generate far jump, leave it to the optimizer to get rid of it } - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then ai:=taicpu.op_sym(A_BL,l) else ai:=taicpu.op_sym(A_B,l); @@ -1671,7 +1704,7 @@ unit cgcpu; inv_flags : TResFlags; hlabel : TAsmLabel; begin - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin inv_flags:=f; inverse_flags(inv_flags); @@ -1715,6 +1748,7 @@ unit cgcpu; LocalSize:=align(LocalSize,4); { call instruction does not put anything on the stack } stackmisalignment:=0; + tarmprocinfo(current_procinfo).stackpaddingreg:=High(TSuperRegister); if not(nostackframe) then begin firstfloatreg:=RS_NO; @@ -1773,6 +1807,18 @@ unit cgcpu; for r:=RS_R0 to RS_R15 do if r in regs then inc(stackmisalignment,4); + + { if the stack is not 8 byte aligned, try to add an extra register, + so we can avoid the extra sub/add ...,#4 later (KB) } + if ((stackmisalignment mod current_settings.alignment.localalignmax) <> 0) then + for r:=RS_R3 downto RS_R0 do + if not(r in regs) then + begin + regs:=regs+[r]; + inc(stackmisalignment,4); + tarmprocinfo(current_procinfo).stackpaddingreg:=r; + break; + end; list.concat(setoppostfix(taicpu.op_ref_regset(A_STM,ref,R_INTREGISTER,R_SUBWHOLE,regs),PF_FD)); end; @@ -1921,6 +1967,7 @@ unit cgcpu; saveregs, regs : tcpuregisterset; stackmisalignment: pint; + paddingreg: TSuperRegister; mmpostfix: toppostfix; imm1, imm2: DWord; begin @@ -2004,7 +2051,7 @@ unit cgcpu; end; end; - regs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall) ; + regs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall); if (pi_do_call in current_procinfo.flags) or (regs<>[]) or ((target_info.system in systems_darwin) and @@ -2043,6 +2090,18 @@ unit cgcpu; for r:=RS_R0 to RS_R15 do if r in regs then inc(stackmisalignment,4); + + { reapply the stack padding reg, in case there was one, see the complimentary + comment in g_proc_entry() (KB) } + paddingreg:=tarmprocinfo(current_procinfo).stackpaddingreg; + if paddingreg < RS_R4 then + if paddingreg in regs then + internalerror(201306190) + else + begin + regs:=regs+[paddingreg]; + inc(stackmisalignment,4); + end; stackmisalignment:=stackmisalignment mod current_settings.alignment.localalignmax; if (current_procinfo.framepointer=NR_STACK_POINTER_REG) or (target_info.system in systems_darwin) then @@ -2104,6 +2163,30 @@ unit cgcpu; end; + procedure tbasecgarm.g_maybe_got_init(list : TAsmList); + var + ref : treference; + l : TAsmLabel; + begin + if (cs_create_pic in current_settings.moduleswitches) and + (pi_needs_got in current_procinfo.flags) and + (tf_pic_uses_got in target_info.flags) then + begin + reference_reset(ref,4); + current_asmdata.getdatalabel(l); + cg.a_label(current_procinfo.aktlocaldata,l); + ref.symbol:=l; + ref.base:=NR_PC; + ref.symboldata:=current_procinfo.aktlocaldata.last; + list.concat(Taicpu.op_reg_ref(A_LDR,current_procinfo.got,ref)); + current_asmdata.getaddrlabel(l); + current_procinfo.aktlocaldata.concat(tai_const.Create_rel_sym_offset(aitconst_32bit,l,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_'),-8)); + cg.a_label(list,l); + list.concat(Taicpu.op_reg_reg_reg(A_ADD,current_procinfo.got,NR_PC,current_procinfo.got)); + end; + end; + + procedure tbasecgarm.a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister); var b : byte; @@ -2164,9 +2247,9 @@ unit cgcpu; procedure tbasecgarm.fixref(list : TAsmList;var ref : treference); var - tmpreg : tregister; + tmpreg, tmpreg2 : tregister; tmpref : treference; - l : tasmlabel; + l, piclabel : tasmlabel; indirection_done : boolean; begin { absolute symbols can't be handled directly, we've to store the symbol reference @@ -2184,6 +2267,7 @@ unit cgcpu; current_asmdata.getjumplabel(l); cg.a_label(current_procinfo.aktlocaldata,l); tmpref.symboldata:=current_procinfo.aktlocaldata.last; + piclabel:=nil; indirection_done:=false; if assigned(ref.symbol) then @@ -2196,6 +2280,28 @@ unit cgcpu; a_op_const_reg(list,OP_ADD,OS_ADDR,ref.offset,tmpreg); indirection_done:=true; end + else if (cs_create_pic in current_settings.moduleswitches) then + if (tf_pic_uses_got in target_info.flags) then + current_procinfo.aktlocaldata.concat(tai_const.Create_type_sym_offset(aitconst_got,ref.symbol,ref.offset)) + else + begin + { ideally, we would want to generate + + ldr r1, LPICConstPool + LPICLocal: + ldr/str r2,[pc,r1] + + ... + LPICConstPool: + .long _globsym-(LPICLocal+8) + + However, we cannot be sure that the ldr/str will follow + right after the call to fixref, so we have to load the + complete address already in a register. + } + current_asmdata.getaddrlabel(piclabel); + current_procinfo.aktlocaldata.concat(tai_const.Create_rel_sym_offset(aitconst_ptr,piclabel,ref.symbol,ref.offset-8)); + end else current_procinfo.aktlocaldata.concat(tai_const.create_sym_offset(ref.symbol,ref.offset)) end @@ -2209,6 +2315,24 @@ unit cgcpu; tmpref.symbol:=l; tmpref.base:=NR_PC; list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref)); + + if (cs_create_pic in current_settings.moduleswitches) and + (tf_pic_uses_got in target_info.flags) and + assigned(ref.symbol) then + begin + reference_reset(tmpref,4); + tmpref.base:=current_procinfo.got; + tmpref.index:=tmpreg; + list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref)); + end; + end; + + if assigned(piclabel) then + begin + cg.a_label(list,piclabel); + tmpreg2:=getaddressregister(list); + a_op_reg_reg_reg(list,OP_ADD,OS_ADDR,tmpreg,NR_PC,tmpreg2); + tmpreg:=tmpreg2 end; { This routine can be called with PC as base/index in case the offset @@ -2440,7 +2564,7 @@ unit cgcpu; begin if len=0 then exit; - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then maxtmpreg:=maxtmpreg_thumb else maxtmpreg:=maxtmpreg_arm; @@ -2573,7 +2697,7 @@ unit cgcpu; {if aligned then genloop(len,4) else} - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then genloop_thumb(len,1) else genloop(len,1); @@ -2667,7 +2791,7 @@ unit cgcpu; ai : taicpu; hlabel : TAsmLabel; begin - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin { the optimizer has to fix this if jump range is sufficient short } current_asmdata.getjumplabel(hlabel); @@ -2952,7 +3076,7 @@ unit cgcpu; l : TAsmLabel; begin reference_reset_base(href,NR_R0,0,sizeof(pint)); - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin if (href.offset in [0..124]) and ((href.offset mod 4)=0) then begin @@ -2994,7 +3118,7 @@ unit cgcpu; begin if (procdef.extnumber=$ffff) then Internalerror(200006139); - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin reference_reset_base(href,NR_R0,tobjectdef(procdef.struct).vmtmethodoffset(procdef.extnumber),sizeof(pint)); if (href.offset in [0..124]) and ((href.offset mod 4)=0) then @@ -3073,7 +3197,7 @@ unit cgcpu; op_onr12methodaddr; end { case 0 } - else if current_settings.cputype in cpu_thumb then + else if GenerateThumbCode then begin { bl cannot be used here because it destroys lr } @@ -3115,47 +3239,27 @@ unit cgcpu; end; - function tbasecgarm.get_darwin_call_stub(const s: string; weak: boolean): tasmsymbol; - var - stubname: string; - l1: tasmsymbol; - href: treference; - begin - stubname := 'L'+s+'$stub'; - result := current_asmdata.getasmsymbol(stubname); - if assigned(result) then - exit; - - if current_asmdata.asmlists[al_imports]=nil then - current_asmdata.asmlists[al_imports]:=TAsmList.create; - - new_section(current_asmdata.asmlists[al_imports],sec_stub,'',4); - result := current_asmdata.RefAsmSymbol(stubname); - current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0)); - { register as a weak symbol if necessary } - if weak then - current_asmdata.weakrefasmsymbol(s); - current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); + procedure tbasecgarm.safe_mla(list : TAsmList; op1,op2,op3,op4 : TRegister); - if not(cs_create_pic in current_settings.moduleswitches) then - begin - l1 := current_asmdata.RefAsmSymbol('L'+s+'$slp'); - reference_reset_symbol(href,l1,0,sizeof(pint)); - href.refaddr:=addr_full; - current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LDR,NR_R12,href)); - reference_reset_base(href,NR_R12,0,sizeof(pint)); - current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LDR,NR_R15,href)); - current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0)); - l1 := current_asmdata.RefAsmSymbol('L'+s+'$lazy_ptr'); - current_asmdata.asmlists[al_imports].concat(tai_const.create_sym(l1)); - end - else - internalerror(2008100401); + procedure checkreg(var reg : TRegister); + var + tmpreg : TRegister; + begin + if ((GenerateThumbCode or GenerateThumb2Code) and (getsupreg(reg)=RS_R13)) or + (getsupreg(reg)=RS_R15) then + begin + tmpreg:=getintregister(list,OS_INT); + a_load_reg_reg(list,OS_INT,OS_INT,reg,tmpreg); + reg:=tmpreg; + end; + end; - new_section(current_asmdata.asmlists[al_imports],sec_data_lazy,'',sizeof(pint)); - current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0)); - current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); - current_asmdata.asmlists[al_imports].concat(tai_const.createname('dyld_stub_binding_helper',0)); + begin + checkreg(op1); + checkreg(op2); + checkreg(op3); + checkreg(op4); + list.concat(taicpu.op_reg_reg_reg_reg(A_MLA,op1,op2,op3,op4)); end; @@ -3572,12 +3676,14 @@ unit cgcpu; shift : byte; saveregs, regs : tcpuregisterset; + registerarea : DWord; stackmisalignment: pint; imm1, imm2: DWord; + stack_parameters : Boolean; begin if not(nostackframe) then begin - stackmisalignment:=0; + stack_parameters:=current_procinfo.procdef.stack_tainting_parameter(calleeside); regs:=rg[R_INTREGISTER].used_in_proc-paramanager.get_volatile_registers_int(pocall_stdcall); include(regs,RS_R15); @@ -3585,12 +3691,19 @@ unit cgcpu; if current_procinfo.framepointer<>NR_STACK_POINTER_REG then include(regs,getsupreg(current_procinfo.framepointer)); + registerarea:=0; for r:=RS_R0 to RS_R15 do if r in regs then - inc(stackmisalignment,4); - stackmisalignment:=stackmisalignment mod current_settings.alignment.localalignmax; + inc(registerarea,4); + + stackmisalignment:=registerarea mod current_settings.alignment.localalignmax; + LocalSize:=current_procinfo.calc_stackframe_size; - localsize:=align(localsize+stackmisalignment,current_settings.alignment.localalignmax)-stackmisalignment; + if stack_parameters then + localsize:=tarmprocinfo(current_procinfo).stackframesize-registerarea + else + localsize:=align(localsize+stackmisalignment,current_settings.alignment.localalignmax)-stackmisalignment; + if (current_procinfo.framepointer=NR_STACK_POINTER_REG) or (target_info.system in systems_darwin) then begin @@ -3993,7 +4106,7 @@ unit cgcpu; list.concat(taicpu.op_reg_reg_const(op_reg_reg_opcg2asmop[op],dst,dst,imm2)); end {$endif DUMMY} - else if (op in [OP_SHL, OP_SHR, OP_SAR, OP_ROR]) then + else if (op in [OP_SHL, OP_SHR, OP_SAR]) then begin list.concat(taicpu.op_reg_reg_const(op_reg_opcg2asmop[op],dst,dst,a)); end @@ -4019,17 +4132,20 @@ unit cgcpu; procedure tthumbcgarm.g_flags2reg(list: TAsmList; size: TCgSize; const f: TResFlags; reg: TRegister); var - l : tasmlabel; + l1,l2 : tasmlabel; ai : taicpu; begin - current_asmdata.getjumplabel(l); - list.concat(taicpu.op_reg_const(A_MOV,reg,1)); - ai:=setcondition(taicpu.op_sym(A_B,l),flags_to_cond(f)); + current_asmdata.getjumplabel(l1); + current_asmdata.getjumplabel(l2); + ai:=setcondition(taicpu.op_sym(A_B,l1),flags_to_cond(f)); ai.is_jmp:=true; list.concat(ai); list.concat(taicpu.op_reg_const(A_MOV,reg,0)); + list.concat(taicpu.op_sym(A_B,l2)); + cg.a_label(list,l1); + list.concat(taicpu.op_reg_const(A_MOV,reg,1)); a_reg_dealloc(list,NR_DEFAULTFLAGS); - cg.a_label(list,l); + cg.a_label(list,l2); end; @@ -4430,7 +4546,7 @@ unit cgcpu; {else if (op = OP_AND) and is_shifter_const(not(dword(a)),shift) then list.concat(taicpu.op_reg_reg_const(A_BIC,dst,src,not(dword(a))))} else if (op = OP_AND) and is_thumb32_imm(a) then - list.concat(taicpu.op_reg_reg_const(A_MOV,dst,src,dword(a))) + list.concat(taicpu.op_reg_reg_const(A_AND,dst,src,dword(a))) else if (op = OP_AND) and (a = $FFFF) then list.concat(taicpu.op_reg_reg(A_UXTH,dst,src)) else if (op = OP_AND) and is_thumb32_imm(not(dword(a))) then @@ -4543,6 +4659,24 @@ unit cgcpu; begin if cgsetflags or setflags then a_reg_alloc(list,NR_DEFAULTFLAGS); +{$ifdef dummy} + { R13 is not allowed for certain instruction operands } + if op_reg_reg_opcg2asmopThumb2[op] in [A_ADD,A_SUB,A_AND,A_BIC,A_EOR] then + begin + if getsupreg(dst)=RS_R13 then + begin + tmpreg:=getintregister(list,OS_INT); + a_load_reg_reg(list,OS_INT,OS_INT,dst,tmpreg); + dst:=tmpreg; + end; + if getsupreg(src1)=RS_R13 then + begin + tmpreg:=getintregister(list,OS_INT); + a_load_reg_reg(list,OS_INT,OS_INT,src1,tmpreg); + src1:=tmpreg; + end; + end; +{$endif} list.concat(setoppostfix( taicpu.op_reg_reg_reg(op_reg_reg_opcg2asmopThumb2[op],dst,src2,src1),toppostfix(ord(cgsetflags or setflags)*ord(PF_S)))); end; @@ -5160,14 +5294,14 @@ unit cgcpu; procedure create_codegen; begin - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then begin cg:=tthumb2cgarm.create; cg64:=tthumb2cg64farm.create; casmoptimizer:=TCpuThumb2AsmOptimizer; end - else if current_settings.cputype in cpu_thumb then + else if GenerateThumbCode then begin cg:=tthumbcgarm.create; cg64:=tthumbcg64farm.create; diff --git a/compiler/arm/cpubase.pas b/compiler/arm/cpubase.pas index 66fde1929c..0ded5cf53f 100644 --- a/compiler/arm/cpubase.pas +++ b/compiler/arm/cpubase.pas @@ -374,6 +374,10 @@ unit cpubase; function IsIT(op: TAsmOp) : boolean; function GetITLevels(op: TAsmOp) : longint; + function GenerateARMCode : boolean; + function GenerateThumbCode : boolean; + function GenerateThumb2Code : boolean; + implementation uses @@ -526,7 +530,7 @@ unit cpubase; var i : longint; begin - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then begin for i:=0 to 24 do begin @@ -616,7 +620,7 @@ unit cpubase; begin Result:=false; {Thumb2 is not supported (YET?)} - if current_settings.cputype in cpu_thumb2 then exit; + if GenerateThumb2Code then exit; d:=DWord(value); for i:=0 to 15 do begin @@ -707,4 +711,24 @@ unit cpubase; end; end; + + function GenerateARMCode : boolean; + begin + Result:=current_settings.instructionset=is_arm; + end; + + + function GenerateThumbCode : boolean; + begin + Result:=(current_settings.instructionset=is_thumb) and not(CPUARM_HAS_THUMB2 in cpu_capabilities[current_settings.cputype]); + end; + + + function GenerateThumb2Code : boolean; + begin + Result:=(current_settings.instructionset=is_thumb) and (CPUARM_HAS_THUMB2 in cpu_capabilities[current_settings.cputype]); + end; + + end. + diff --git a/compiler/arm/cpuinfo.pas b/compiler/arm/cpuinfo.pas index 1fd502750d..ba2da2b640 100644 --- a/compiler/arm/cpuinfo.pas +++ b/compiler/arm/cpuinfo.pas @@ -51,10 +51,7 @@ Type cpu_armv7em ); -Const - cpu_arm = [cpu_none,cpu_armv3,cpu_armv4,cpu_armv4t,cpu_armv5]; - cpu_thumb = [cpu_armv6m]; - cpu_thumb2 = [cpu_armv7m,cpu_armv7em]; + tinstructionset = (is_thumb,is_arm); Type tfputype = @@ -665,7 +662,8 @@ Const CPUARM_HAS_RBIT, { CPU supports the RBIT instruction } CPUARM_HAS_DMB, { CPU has memory barrier instructions (DMB, DSB, ISB) } CPUARM_HAS_LDREX, - CPUARM_HAS_IDIV + CPUARM_HAS_IDIV, + CPUARM_HAS_THUMB2 ); const @@ -680,17 +678,20 @@ Const { cpu_armv5tej } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP], { cpu_armv6 } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_LDREX], { cpu_armv6k } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_LDREX], - { cpu_armv6t2 } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX], + { cpu_armv6t2 } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_THUMB2], { cpu_armv6z } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_LDREX], { cpu_armv6m } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_REV], { the identifier armv7 is should not be used, it is considered being equal to armv7a } - { cpu_armv7 } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB], - { cpu_armv7a } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB], - { cpu_armv7r } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB], - { cpu_armv7m } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_IDIV,CPUARM_HAS_DMB], - { cpu_armv7em } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_IDIV,CPUARM_HAS_DMB] + { cpu_armv7 } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2], + { cpu_armv7a } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2], + { cpu_armv7r } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_BLX_LABEL,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2], + { cpu_armv7m } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2], + { cpu_armv7em } [CPUARM_HAS_BX,CPUARM_HAS_BLX,CPUARM_HAS_CLZ,CPUARM_HAS_EDSP,CPUARM_HAS_REV,CPUARM_HAS_RBIT,CPUARM_HAS_LDREX,CPUARM_HAS_IDIV,CPUARM_HAS_DMB,CPUARM_HAS_THUMB2] ); + { contains all CPU supporting any kind of thumb instruction set } + cpu_has_thumb = [cpu_armv4t,cpu_armv5t,cpu_armv5te,cpu_armv5tej,cpu_armv6t2,cpu_armv6z,cpu_armv6m,cpu_armv7a,cpu_armv7r,cpu_armv7m,cpu_armv7em]; + Implementation end. diff --git a/compiler/arm/cpupara.pas b/compiler/arm/cpupara.pas index 8bdc12a55b..7d7a51c6d3 100644 --- a/compiler/arm/cpupara.pas +++ b/compiler/arm/cpupara.pas @@ -298,7 +298,7 @@ unit cpupara; curfloatreg:=RS_F0; curmmreg:=RS_D0; - if (current_settings.cputype in cpu_thumb) and (side=calleeside) then + if GenerateThumbCode and (side=calleeside) then cur_stack_offset:=(p as tprocdef).total_stackframe_size else cur_stack_offset:=0; @@ -581,7 +581,7 @@ unit cpupara; begin if paraloc^.loc=LOC_REFERENCE then begin - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin paraloc^.reference.index:=NR_STACK_POINTER_REG; end diff --git a/compiler/arm/cpupi.pas b/compiler/arm/cpupi.pas index 011fa79148..9087a3944a 100644 --- a/compiler/arm/cpupi.pas +++ b/compiler/arm/cpupi.pas @@ -29,7 +29,8 @@ unit cpupi; uses globtype,cutils, - procinfo,cpuinfo,psub; + procinfo,cpuinfo,psub,cgbase, + aasmdata; type tarmprocinfo = class(tcgprocinfo) @@ -39,12 +40,14 @@ unit cpupi; if this size is too little the procedure must be compiled again with a larger value } stackframesize, floatregstart : aint; + stackpaddingreg: TSuperRegister; // procedure handle_body_start;override; // procedure after_pass1;override; procedure set_first_temp_offset;override; function calc_stackframe_size:longint;override; procedure init_framepointer; override; procedure generate_parameter_info;override; + procedure allocate_got_register(list : TAsmList);override; end; @@ -55,7 +58,7 @@ unit cpupi; cpubase, tgobj, symconst,symtype,symsym,paramgr, - cgbase,cgutils, + cgutils, cgobj, defutil; @@ -96,7 +99,7 @@ unit cpupi; tg.setfirsttemp(maxpushedparasize); { estimate stack frame size } - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin stackframesize:=maxpushedparasize+32; localsize:=0; @@ -138,7 +141,7 @@ unit cpupi; floatsavesize : aword; regs: tcpuregisterset; begin - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then result:=stackframesize else begin @@ -192,7 +195,7 @@ unit cpupi; procedure tarmprocinfo.init_framepointer; begin - if (target_info.system in systems_darwin) or (current_settings.cputype in cpu_thumb) then + if (target_info.system in systems_darwin) or GenerateThumbCode then begin RS_FRAME_POINTER_REG:=RS_R7; NR_FRAME_POINTER_REG:=NR_R7; @@ -212,6 +215,14 @@ unit cpupi; end; + procedure tarmprocinfo.allocate_got_register(list: TAsmList); + begin + { darwin doesn't use a got } + if tf_pic_uses_got in target_info.flags then + got := cg.getaddressregister(list); + end; + + begin cprocinfo:=tarmprocinfo; end. diff --git a/compiler/arm/narmadd.pas b/compiler/arm/narmadd.pas index 8cdc86492a..7212b51285 100644 --- a/compiler/arm/narmadd.pas +++ b/compiler/arm/narmadd.pas @@ -53,7 +53,7 @@ interface defutil,htypechk,cgbase,cgutils, cpuinfo,pass_1,pass_2,procinfo, ncon,nadd,ncnv,ncal,nmat, - ncgutil,cgobj, + ncgutil,cgobj,cgcpu, hlcgobj ; @@ -332,7 +332,7 @@ interface (* Try to keep right as a constant *) if (right.location.loc <> LOC_CONSTANT) or not(is_shifter_const(right.location.value, b)) or - ((current_settings.cputype in cpu_thumb) and not(is_thumb_imm(right.location.value))) then + ((GenerateThumbCode) and not(is_thumb_imm(right.location.value))) then hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true); hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true); @@ -386,22 +386,9 @@ interface pass_left_right; + { pass_left_right moves possible consts to the right, the only + remaining case with left consts (currency) can take this path too (KB) } if (nodetype in [equaln,unequaln]) and - (left.nodetype=ordconstn) and (tordconstnode(left).value=0) then - begin - location_reset(location,LOC_FLAGS,OS_NO); - location.resflags:=getresflags(unsigned); - if not(right.location.loc in [LOC_CREGISTER,LOC_REGISTER]) then - hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,true); - dummyreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size); - cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS); - - if current_settings.cputype in cpu_thumb then - cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,right.location.register64.reglo,right.location.register64.reghi,dummyreg) - else - current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ORR,dummyreg,right.location.register64.reglo,right.location.register64.reghi),PF_S)); - end - else if (nodetype in [equaln,unequaln]) and (right.nodetype=ordconstn) and (tordconstnode(right).value=0) then begin location_reset(location,LOC_FLAGS,OS_NO); @@ -411,7 +398,7 @@ interface dummyreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size); cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS); - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,left.location.register64.reglo,left.location.register64.reghi,dummyreg) else current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_ORR,dummyreg,left.location.register64.reglo,left.location.register64.reghi),PF_S)); @@ -428,7 +415,7 @@ interface location.resflags:=getresflags(unsigned); cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi)); - if current_settings.cputype in (cpu_thumb+cpu_thumb2) then + if GenerateThumbCode or GenerateThumb2Code then begin current_asmdata.getjumplabel(l); cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,l); @@ -509,7 +496,7 @@ interface tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_32); asmList.concat(taicpu.op_reg_reg_reg(A_MUL,tmpreg,ll.reglo,rl.reghi)); asmList.concat(taicpu.op_reg_reg_reg_reg(A_UMULL,res.reglo,res.reghi,rl.reglo,ll.reglo)); - asmList.concat(taicpu.op_reg_reg_reg_reg(A_MLA,tmpreg,rl.reglo,ll.reghi,tmpreg)); + tbasecgarm(cg).safe_mla(asmList,tmpreg,rl.reglo,ll.reghi,tmpreg); asmList.concat(taicpu.op_reg_reg_reg(A_ADD,res.reghi,tmpreg,res.reghi)); end else @@ -524,7 +511,7 @@ interface if (not(cs_check_overflow in current_settings.localswitches)) and (nodetype in [muln]) and (is_64bitint(left.resultdef)) and - (not (current_settings.cputype in cpu_thumb)) then + (not (GenerateThumbCode)) then begin result := nil; firstpass(left); @@ -639,8 +626,8 @@ interface cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS); if right.location.loc = LOC_CONSTANT then begin - if (not(current_settings.cputype in cpu_thumb) and is_shifter_const(right.location.value,b)) or - ((current_settings.cputype in cpu_thumb) and is_thumb_imm(right.location.value)) then + if (not(GenerateThumbCode) and is_shifter_const(right.location.value,b)) or + ((GenerateThumbCode) and is_thumb_imm(right.location.value)) then current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMP,left.location.register,right.location.value)) else begin diff --git a/compiler/arm/narminl.pas b/compiler/arm/narminl.pas index c7676c3d0b..a540cd63f5 100644 --- a/compiler/arm/narminl.pas +++ b/compiler/arm/narminl.pas @@ -342,7 +342,7 @@ implementation ref : treference; r : tregister; begin - if CPUARM_HAS_EDSP in cpu_capabilities[current_settings.cputype] then + if not(GenerateThumbCode) and (CPUARM_HAS_EDSP in cpu_capabilities[current_settings.cputype]) then begin secondpass(left); case left.location.loc of diff --git a/compiler/arm/narmmat.pas b/compiler/arm/narmmat.pas index 9df9617dc9..c40e7facd9 100644 --- a/compiler/arm/narmmat.pas +++ b/compiler/arm/narmmat.pas @@ -91,13 +91,14 @@ implementation ispowerof2(tordconstnode(right).value,power) and (tordconstnode(right).value<=256) and (tordconstnode(right).value>0) then - result:=caddnode.create(andn,left,cordconstnode.create(tordconstnode(right).value-1,sinttype,false)) + result:=caddnode.create_internal(andn,left,cordconstnode.create(tordconstnode(right).value-1,sinttype,false)) else begin - result:=caddnode.create(subn,left,caddnode.create(muln,right.getcopy, cmoddivnode.Create(divn,left.getcopy,right.getcopy))); + result:=caddnode.create_internal(subn,left,caddnode.create_internal(muln,right,cmoddivnode.Create(divn,left.getcopy,right.getcopy))); right:=nil; end; left:=nil; + firstpass(result); end else if (nodetype=modn) and (is_signed(left.resultdef)) and @@ -105,13 +106,18 @@ implementation (tordconstnode(right).value=2) then begin // result:=(0-(left and 1)) and (1+(sarlongint(left,31) shl 1)) - result:=caddnode.create(andn,caddnode.create(subn,cordconstnode.create(0,sinttype,false),caddnode.create(andn,left,cordconstnode.create(1,sinttype,false))), - caddnode.create(addn,cordconstnode.create(1,sinttype,false), + result:=caddnode.create_internal(andn,caddnode.create_internal(subn,cordconstnode.create(0,sinttype,false),caddnode.create_internal(andn,left,cordconstnode.create(1,sinttype,false))), + caddnode.create_internal(addn,cordconstnode.create(1,sinttype,false), cshlshrnode.create(shln,cinlinenode.create(in_sar_x_y,false,ccallparanode.create(cordconstnode.create(31,sinttype,false),ccallparanode.Create(left.getcopy,nil))),cordconstnode.create(1,sinttype,false)))); left:=nil; + firstpass(result); end else result:=inherited first_moddivint; + + { we may not change the result type here } + if assigned(result) and (torddef(result.resultdef).ordtype<>torddef(resultdef).ordtype) then + inserttypeconv(result,resultdef); end; @@ -150,7 +156,7 @@ implementation cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,numerator,helper1) else cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SAR,OS_INT,31,numerator,helper1); - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SAR,OS_INT,32-power,helper1); current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ADD,helper2,numerator,helper1)); @@ -431,7 +437,7 @@ implementation function tarmshlshrnode.first_shlshr64bitint: tnode; begin - if (current_settings.cputype in cpu_thumb+cpu_thumb2) then + if GenerateThumbCode or GenerateThumb2Code then result:=inherited else result := nil; @@ -506,7 +512,7 @@ implementation end; begin - if (current_settings.cputype in cpu_thumb+cpu_thumb2) then + if GenerateThumbCode or GenerateThumb2Code then begin inherited; exit; diff --git a/compiler/arm/narmmem.pas b/compiler/arm/narmmem.pas index 999f6e919f..cdda16413b 100644 --- a/compiler/arm/narmmem.pas +++ b/compiler/arm/narmmem.pas @@ -42,7 +42,7 @@ interface implementation uses - cutils,verbose,globals,aasmdata,aasmcpu,cgobj, + cutils,verbose,globals,aasmdata,aasmcpu,cgobj,cgcpu, cpuinfo, cgutils, procinfo; @@ -54,7 +54,7 @@ implementation procedure tarmloadparentfpnode.pass_generate_code; begin { normally, we cannot use the stack pointer as normal register on arm thumb } - if (current_settings.cputype in cpu_thumb) and + if (GenerateThumbCode) and (getsupreg(current_procinfo.framepointer) in [RS_R8..RS_R15]) and (current_procinfo.procdef.parast.symtablelevel=parentpd.parast.symtablelevel) then begin @@ -76,7 +76,7 @@ implementation hl : longint; begin if ((location.reference.base=NR_NO) and (location.reference.index=NR_NO)) or - (current_settings.cputype in cpu_thumb) or + (GenerateThumbCode) or { simple constant? } (l=1) or ispowerof2(l,hl) or ispowerof2(l+1,hl) or ispowerof2(l-1,hl) then inherited update_reference_reg_mul(maybe_const_reg,l) @@ -84,7 +84,7 @@ implementation begin hreg:=cg.getaddressregister(current_asmdata.CurrAsmList); cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_ADDR,l,hreg); - current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg_reg(A_MLA,hreg,maybe_const_reg,hreg,location.reference.base)); + tbasecgarm(cg).safe_mla(current_asmdata.CurrAsmList,hreg,maybe_const_reg,hreg,location.reference.base); location.reference.base:=hreg; { update alignment } if (location.reference.alignment=0) then @@ -95,7 +95,7 @@ implementation begin hreg:=cg.getaddressregister(current_asmdata.CurrAsmList); cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_ADDR,l,hreg); - current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg_reg(A_MLA,hreg,maybe_const_reg,hreg,location.reference.index)); + tbasecgarm(cg).safe_mla(current_asmdata.CurrAsmList,hreg,maybe_const_reg,hreg,location.reference.index); location.reference.base:=hreg; location.reference.index:=NR_NO; { update alignment } diff --git a/compiler/arm/narmset.pas b/compiler/arm/narmset.pas index a8f5167614..4cc11a7edf 100644 --- a/compiler/arm/narmset.pas +++ b/compiler/arm/narmset.pas @@ -84,7 +84,7 @@ implementation begin location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=F_NE; - if (left.location.loc=LOC_CONSTANT) and not(current_settings.cputype in cpu_thumb) then + if (left.location.loc=LOC_CONSTANT) and not(GenerateThumbCode) then begin hlcg.location_force_reg(current_asmdata.CurrAsmList, right.location, right.resultdef, right.resultdef, true); @@ -104,7 +104,7 @@ implementation hregister:=cg.getintregister(current_asmdata.CurrAsmList, uopsize); current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_MOV,hregister,1)); - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode or GenerateThumb2Code then begin current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_LSL,hregister,left.location.register)); cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS); @@ -144,8 +144,9 @@ implementation basereg, indexreg : tregister; href : treference; - tablelabel: TAsmLabel; + tablelabel, piclabel : TAsmLabel; opcgsize : tcgsize; + picoffset : int64; procedure genitem(list:TAsmList;t : pcaselabel); var @@ -155,9 +156,15 @@ implementation genitem(list,t^.less); { fill possible hole } for i:=last.svalue+1 to t^._low.svalue-1 do - list.concat(Tai_const.Create_sym(elselabel)); + if cs_create_pic in current_settings.moduleswitches then + list.concat(Tai_const.Create_rel_sym_offset(aitconst_ptr,piclabel,elselabel,picoffset)) + else + list.concat(Tai_const.Create_sym(elselabel)); for i:=t^._low.svalue to t^._high.svalue do - list.concat(Tai_const.Create_sym(blocklabel(t^.blockid))); + if cs_create_pic in current_settings.moduleswitches then + list.concat(Tai_const.Create_rel_sym_offset(aitconst_ptr,piclabel,blocklabel(t^.blockid),picoffset)) + else + list.concat(Tai_const.Create_sym(blocklabel(t^.blockid))); last:=t^._high.svalue; if assigned(t^.greater) then genitem(list,t^.greater); @@ -192,8 +199,10 @@ implementation indexreg:=cg.makeregsize(current_asmdata.CurrAsmList,hregister,OS_INT); cg.a_load_reg_reg(current_asmdata.CurrAsmList,opcgsize,OS_INT,hregister,indexreg); - if current_settings.cputype in cpu_thumb2 then + if GenerateThumb2Code then begin + if cs_create_pic in current_settings.moduleswitches then + internalerror(2013082101); { adjust index } cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_ADDR,min_,indexreg,indexreg); { create reference and generate jump table } @@ -209,8 +218,10 @@ implementation last:=min_; genitem_thumb2(current_asmdata.CurrAsmList,hp); end - else if current_settings.cputype in cpu_thumb then + else if GenerateThumbCode then begin + if cs_create_pic in current_settings.moduleswitches then + internalerror(2013082102); cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_ADDR,min_+1,indexreg,indexreg); current_asmdata.getaddrlabel(tablelabel); @@ -232,14 +243,26 @@ implementation else begin { adjust index } - cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_ADDR,min_+1,indexreg,indexreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_ADDR, + min_+ord(not(cs_create_pic in current_settings.moduleswitches)), + indexreg,indexreg); { create reference and generate jump table } reference_reset(href,4); href.base:=NR_PC; href.index:=indexreg; href.shiftmode:=SM_LSL; href.shiftimm:=2; - cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,NR_PC); + if cs_create_pic in current_settings.moduleswitches then + begin + picoffset:=-8; + current_asmdata.getaddrlabel(piclabel); + indexreg:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,indexreg); + cg.a_label(current_asmdata.CurrAsmList,piclabel); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_ADD,OS_ADDR,indexreg,NR_PC); + end + else + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,NR_PC); { generate jump table } last:=min_; genitem(current_asmdata.CurrAsmList,hp); diff --git a/compiler/arm/rgcpu.pas b/compiler/arm/rgcpu.pas index 031563e95d..87d900699b 100644 --- a/compiler/arm/rgcpu.pas +++ b/compiler/arm/rgcpu.pas @@ -92,7 +92,11 @@ unit rgcpu; for hr := RS_R8 to RS_R15 do add_edge(getsupreg(taicpu(p).oper[0]^.reg), hr); end; - A_ADD: + A_ADD, + A_SUB, + A_AND, + A_BIC, + A_EOR: begin if taicpu(p).ops = 3 then begin @@ -121,6 +125,23 @@ unit rgcpu; end; end; end; + A_MLA, + A_MUL: + begin + if current_settings.cputype<cpu_armv6 then + add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(taicpu(p).oper[1]^.reg)); + add_edge(getsupreg(taicpu(p).oper[0]^.reg),RS_R13); + add_edge(getsupreg(taicpu(p).oper[0]^.reg),RS_R15); + add_edge(getsupreg(taicpu(p).oper[1]^.reg),RS_R13); + add_edge(getsupreg(taicpu(p).oper[1]^.reg),RS_R15); + add_edge(getsupreg(taicpu(p).oper[2]^.reg),RS_R13); + add_edge(getsupreg(taicpu(p).oper[2]^.reg),RS_R15); + if taicpu(p).opcode=A_MLA then + begin + add_edge(getsupreg(taicpu(p).oper[3]^.reg),RS_R13); + add_edge(getsupreg(taicpu(p).oper[3]^.reg),RS_R15); + end; + end; A_LDRB, A_STRB, A_STR, @@ -165,7 +186,7 @@ unit rgcpu; { Lets remove the bits we can fold in later and check if the result can be easily with an add or sub } a:=abs(spilltemp.offset); - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin {$ifdef DEBUG_SPILLING} helplist.concat(tai_comment.create(strpnew('Spilling: Use a_load_const_reg to fix spill offset'))); @@ -222,7 +243,7 @@ unit rgcpu; function fix_spilling_offset(offset : ASizeInt) : boolean; begin result:=(abs(offset)>4095) or - ((current_settings.cputype in cpu_thumb) and ((offset<0) or (offset>1020))); + ((GenerateThumbCode) and ((offset<0) or (offset>1020))); end; @@ -486,8 +507,15 @@ unit rgcpu; case taicpu(p).opcode of A_MLA, A_MUL: - if current_settings.cputype<cpu_armv6 then - add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(taicpu(p).oper[1]^.reg)); + begin + if current_settings.cputype<cpu_armv6 then + add_edge(getsupreg(taicpu(p).oper[0]^.reg),getsupreg(taicpu(p).oper[1]^.reg)); + add_edge(getsupreg(taicpu(p).oper[0]^.reg),RS_R15); + add_edge(getsupreg(taicpu(p).oper[1]^.reg),RS_R15); + add_edge(getsupreg(taicpu(p).oper[2]^.reg),RS_R15); + if taicpu(p).opcode=A_MLA then + add_edge(getsupreg(taicpu(p).oper[3]^.reg),RS_R15); + end; A_UMULL, A_UMLAL, A_SMULL, diff --git a/compiler/assemble.pas b/compiler/assemble.pas index b4110a2cd8..0f51767c24 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -42,7 +42,7 @@ interface AsmOutSize=32768*4; type - TAssembler=class(TAbstractAssembler) + TAssembler=class(TObject) public {filenames} path : TPathStr; diff --git a/compiler/cresstr.pas b/compiler/cresstr.pas index a0a08172e0..3daa04a2ea 100644 --- a/compiler/cresstr.pas +++ b/compiler/cresstr.pas @@ -152,8 +152,8 @@ uses { Write unitname entry } namelab:=emit_ansistring_const(current_asmdata.asmlists[al_const],@current_module.localsymtable.name^[1],length(current_module.localsymtable.name^),getansistringcodepage,False); current_asmdata.asmlists[al_resourcestrings].concat(tai_const.Create_sym_offset(namelab.lab,namelab.ofs)); - current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil)); - current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil)); + current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_nil_dataptr); + current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_nil_dataptr); current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_32bit(0)); {$ifdef cpu64bitaddr} current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_32bit(0)); diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index db00ab3d09..af702c01f4 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -921,10 +921,10 @@ implementation begin if not assigned(def.typesym) then internalerror(200610011); - def.dwarf_lab:=current_asmdata.RefAsmSymbol(make_mangledname('DBG',def.owner,symname(def.typesym))); - def.dwarf_ref_lab:=current_asmdata.RefAsmSymbol(make_mangledname('DBGREF',def.owner,symname(def.typesym))); + def.dwarf_lab:=current_asmdata.RefAsmSymbol(make_mangledname('DBG',def.owner,symname(def.typesym)),AT_DATA); + def.dwarf_ref_lab:=current_asmdata.RefAsmSymbol(make_mangledname('DBGREF',def.owner,symname(def.typesym)),AT_DATA); if is_class_or_interface_or_dispinterface(def) or is_objectpascal_helper(def) then - tobjectdef(def).dwarf_struct_lab:=current_asmdata.RefAsmSymbol(make_mangledname('DBG2',def.owner,symname(def.typesym))); + tobjectdef(def).dwarf_struct_lab:=current_asmdata.RefAsmSymbol(make_mangledname('DBG2',def.owner,symname(def.typesym)),AT_DATA); def.dbg_state:=dbg_state_written; end else @@ -1251,7 +1251,7 @@ implementation else begin AddConstToAbbrev(ord(DW_FORM_ref4)); - current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_info0'),sym)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_DATA),sym)); end; end; @@ -1785,7 +1785,10 @@ implementation finish_children; { now the data array } - current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(arr,0)); + if arr.bind=AB_GLOBAL then + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(arr,0)) + else + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(arr,0)); append_entry(DW_TAG_array_type,true,[ DW_AT_byte_size,DW_FORM_udata,def.size, DW_AT_byte_stride,DW_FORM_udata,1 @@ -1916,7 +1919,10 @@ implementation finish_children; - current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(proc,0)); + if proc.bind=AB_GLOBAL then + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(proc,0)) + else + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(proc,0)); doappend; end else @@ -1931,10 +1937,14 @@ implementation current_asmdata.asmlists[al_dwarf_info].concat(tai_comment.Create(strpnew('Definition '+def.typename))); labsym:=def_dwarf_lab(def); - if ds_dwarf_dbg_info_written in def.defstates then - current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(labsym,0)) - else - current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(labsym,0)); + case labsym.bind of + AB_GLOBAL: + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(labsym,0)); + AB_LOCAL: + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(labsym,0)); + else + internalerror(2013082001); + end; { On Darwin, dwarf info is not linked in the final binary, but kept in the individual object files. This allows for @@ -2013,10 +2023,14 @@ implementation { create a derived reference type for pass-by-reference parameters } { (gdb doesn't support DW_AT_variable_parameter yet) } labsym:=def_dwarf_ref_lab(def); - if ds_dwarf_dbg_info_written in def.defstates then - current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(labsym,0)) - else - current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(labsym,0)); + case labsym.bind of + AB_GLOBAL: + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(labsym,0)); + AB_LOCAL: + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(labsym,0)); + else + internalerror(2013082002); + end; append_entry(DW_TAG_reference_type,false,[]); append_labelentry_ref(DW_AT_type,def_dwarf_lab(def)); finish_entry; @@ -2383,7 +2397,7 @@ implementation else begin templist.concat(tai_const.create_8bit(ord(DW_OP_addr))); - templist.concat(tai_const.Create_type_name(offsetabstype,sym.mangledname,offset)); + templist.concat(tai_const.Create_type_name(aitconst_ptr,sym.mangledname,offset)); blocksize:=1+sizeof(puint); end; end; @@ -2844,7 +2858,7 @@ implementation toasm : begin templist.concat(tai_const.create_8bit(3)); - templist.concat(tai_const.create_type_name(offsetabstype,sym.mangledname,0)); + templist.concat(tai_const.create_type_name(aitconst_ptr,sym.mangledname,0)); blocksize:=1+sizeof(puint); end; tovar: @@ -2960,7 +2974,7 @@ implementation if use_64bit_headers then linelist.concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF))); linelist.concat(tai_const.create_rel_sym(offsetreltype, - lbl,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'edebug_line0'))); + lbl,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'edebug_line0',AB_LOCAL,AT_DATA))); linelist.concat(tai_label.create(lbl)); { version } @@ -2969,7 +2983,7 @@ implementation { header length } current_asmdata.getlabel(lbl,alt_dbgfile); linelist.concat(tai_const.create_rel_sym(offsetreltype, - lbl,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'ehdebug_line0'))); + lbl,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'ehdebug_line0',AB_LOCAL,AT_DATA))); linelist.concat(tai_label.create(lbl)); { minimum_instruction_length } @@ -3078,6 +3092,7 @@ implementation def: tdef; dbgname: string; vardatatype: ttypesym; + bind: tasmsymbind; begin current_module.flags:=current_module.flags or uf_has_dwarf_debuginfo; storefilepos:=current_filepos; @@ -3109,7 +3124,7 @@ implementation if use_64bit_headers then current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF))); current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype, - lenstartlabel,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'edebug_info0'))); + lenstartlabel,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'edebug_info0',AB_LOCAL,AT_DATA))); current_asmdata.asmlists[al_dwarf_info].concat(tai_label.create(lenstartlabel)); { version } @@ -3117,11 +3132,11 @@ implementation { abbrev table (=relative from section start)} if not(tf_dwarf_relative_addresses in target_info.flags) then current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(offsetabstype, - current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_abbrev0'))) + current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrev0',AB_LOCAL,AT_DATA))) else current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(offsetreltype, - current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_abbrevsection0'), - current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_abbrev0'))); + current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrevsection0',AB_LOCAL,AT_DATA), + current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_abbrev0',AB_LOCAL,AT_DATA))); { address size } current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(sizeof(pint))); @@ -3136,23 +3151,28 @@ implementation { reference to line info section } if not(tf_dwarf_relative_addresses in target_info.flags) then - append_labelentry_dataptr_abs(DW_AT_stmt_list,current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_line0')) + append_labelentry_dataptr_abs(DW_AT_stmt_list,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_DATA)) else append_labelentry_dataptr_rel(DW_AT_stmt_list, - current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_linesection0'), - current_asmdata.RefAsmSymbol(target_asm.labelprefix+'debug_line0')); + current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_linesection0',AB_LOCAL,AT_DATA), + current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_line0',AB_LOCAL,AT_DATA)); if (m_objectivec1 in current_settings.modeswitches) then append_attribute(DW_AT_APPLE_major_runtime_vers,DW_FORM_data1,[1]); dbgname:=make_mangledname('DEBUGSTART',current_module.localsymtable,''); if (target_info.system in systems_darwin) then - dbgname:='L'+dbgname; - append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(dbgname)); + begin + bind:=AB_LOCAL; + dbgname:='L'+dbgname; + end + else + bind:=AB_GLOBAL; + append_labelentry(DW_AT_low_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_DATA)); dbgname:=make_mangledname('DEBUGEND',current_module.localsymtable,''); if (target_info.system in systems_darwin) then dbgname:='L'+dbgname; - append_labelentry(DW_AT_high_pc,current_asmdata.RefAsmSymbol(dbgname)); + append_labelentry(DW_AT_high_pc,current_asmdata.DefineAsmSymbol(dbgname,bind,AT_DATA)); finish_entry; @@ -3641,7 +3661,10 @@ implementation current_asmdata.getaddrlabel(lab); append_labelentry_ref(DW_AT_type,lab); finish_entry; - current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(lab,0)); + if lab.bind=AB_GLOBAL then + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(lab,0)) + else + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(lab,0)); { Sets of e.g. [1..5] are actually stored as a set of [0..7], so write the exact boundaries of the set here. Let's hope no debugger ever rejects this because this "subrange" type can diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index c3891a55cb..16e77eb894 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -2119,8 +2119,8 @@ implementation function proc_to_procvar_equal(def1:tabstractprocdef;def2:tprocvardef;checkincompatibleuniv: boolean):tequaltype; var - eq : tequaltype; - po_comp : tprocoptions; + eq: tequaltype; + po_comp: tprocoptions; pa_comp: tcompare_paras_options; begin proc_to_procvar_equal:=te_incompatible; @@ -2154,8 +2154,10 @@ implementation if checkincompatibleuniv then include(pa_comp,cpo_warn_incompatible_univ); { check return value and options, methodpointer is already checked } - po_comp:=[po_staticmethod,po_interrupt, - po_iocheck,po_varargs]; + po_comp:=[po_interrupt,po_iocheck,po_varargs]; + { check static only if we compare method pointers } + if def1.is_methodpointer then + include(po_comp,po_staticmethod); if (m_delphi in current_settings.modeswitches) then exclude(po_comp,po_varargs); if (def1.proccalloption=def2.proccalloption) and diff --git a/compiler/fppu.pas b/compiler/fppu.pas index 85f57ef9a5..ffe0c3ccc6 100644 --- a/compiler/fppu.pas +++ b/compiler/fppu.pas @@ -230,6 +230,33 @@ var Message(unit_u_ppu_invalid_target,@queuecomment); exit; end; +{$ifdef i8086} + { check i8086 memory model flags } + if ((ppufile.header.flags and uf_i8086_far_code)<>0) xor + (current_settings.x86memorymodel in [mm_medium,mm_large,mm_huge]) then + begin + ppufile.free; + ppufile:=nil; + Message(unit_u_ppu_invalid_memory_model,@queuecomment); + exit; + end; + if ((ppufile.header.flags and uf_i8086_far_data)<>0) xor + (current_settings.x86memorymodel in [mm_compact,mm_large]) then + begin + ppufile.free; + ppufile:=nil; + Message(unit_u_ppu_invalid_memory_model,@queuecomment); + exit; + end; + if ((ppufile.header.flags and uf_i8086_huge_data)<>0) xor + (current_settings.x86memorymodel=mm_huge) then + begin + ppufile.free; + ppufile:=nil; + Message(unit_u_ppu_invalid_memory_model,@queuecomment); + exit; + end; +{$endif i8086} {$ifdef cpufpemu} { check if floating point emulation is on? fpu emulation isn't unit levelwise because it affects calling convention } @@ -1061,6 +1088,14 @@ var flags:=flags or uf_release; if assigned(localsymtable) then flags:=flags or uf_local_symtable; +{$ifdef i8086} + if current_settings.x86memorymodel in [mm_medium,mm_large,mm_huge] then + flags:=flags or uf_i8086_far_code; + if current_settings.x86memorymodel in [mm_compact,mm_large] then + flags:=flags or uf_i8086_far_data; + if current_settings.x86memorymodel=mm_huge then + flags:=flags or uf_i8086_huge_data; +{$endif i8086} {$ifdef cpufpemu} if (cs_fp_emulation in current_settings.moduleswitches) then flags:=flags or uf_fpu_emulation; diff --git a/compiler/globals.pas b/compiler/globals.pas index bf43743967..caa34b468e 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -154,11 +154,17 @@ interface disabledircache : boolean; +{$if defined(i8086)} x86memorymodel : tx86memorymodel; +{$endif defined(i8086)} + +{$if defined(ARM)} + instructionset : tinstructionset; +{$endif defined(ARM)} { CPU targets with microcontroller support can add a controller specific unit } {$if defined(ARM) or defined(AVR)} - controllertype : tcontrollertype; + controllertype : tcontrollertype; {$endif defined(ARM) or defined(AVR)} { WARNING: this pointer cannot be written as such in record token } pmessage : pmessagestaterecord; @@ -479,7 +485,12 @@ interface minfpconstprec : s32real; disabledircache : false; +{$if defined(i8086)} x86memorymodel : mm_small; +{$endif defined(i8086)} +{$if defined(ARM)} + instructionset : is_arm; +{$endif defined(ARM)} {$if defined(ARM) or defined(AVR)} controllertype : ct_none; {$endif defined(ARM) or defined(AVR)} @@ -511,7 +522,8 @@ interface function SetAktProcCall(const s:string; var a:tproccalloption):boolean; function Setabitype(const s:string;var a:tabi):boolean; - function Setcputype(const s:string;var a:tcputype):boolean; + function Setoptimizecputype(const s:string;var a:tcputype):boolean; + function Setcputype(const s:string;var a:tsettings):boolean; function SetFpuType(const s:string;var a:tfputype):boolean; {$if defined(arm) or defined(avr)} function SetControllerType(const s:string;var a:tcontrollertype):boolean; @@ -1107,7 +1119,7 @@ implementation end; - function Setcputype(const s:string;var a:tcputype):boolean; + function Setoptimizecputype(const s:string;var a:tcputype):boolean; var t : tcputype; hs : string; @@ -1124,6 +1136,33 @@ implementation end; + function Setcputype(const s:string;var a:tsettings):boolean; + var + t : tcputype; + hs : string; + begin + result:=false; + hs:=Upper(s); + for t:=low(tcputype) to high(tcputype) do + if cputypestr[t]=hs then + begin + a.cputype:=t; + result:=true; + break; + end; +{$ifdef arm} + { set default instruction set for arm } + if result then + begin + if a.cputype in [cpu_armv6m,cpu_armv6t2,cpu_armv7m] then + a.instructionset:=is_thumb + else + a.instructionset:=is_arm; + end; +{$endif arm} + end; + + function SetFpuType(const s:string;var a:tfputype):boolean; var t : tfputype; diff --git a/compiler/globtype.pas b/compiler/globtype.pas index 1a0da4a6b2..167cee59c3 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -232,7 +232,14 @@ interface these strings as prefixes for the generated getters/setter names } ts_auto_getter_prefix, ts_auto_setter_predix, - ts_thumb_interworking + ts_thumb_interworking, + { lowercase the first character of routine names, used to generate + names that are compliant with Java coding standards from code + written according to Delphi coding standards } + ts_lowercase_proc_start, + { initialise local variables on the JVM target so you won't get + accidental uses of uninitialised values } + ts_init_locals ); ttargetswitches = set of ttargetswitch; @@ -313,7 +320,9 @@ interface (name: 'ENUMFIELDINIT'; hasvalue: false; isglobal: true ), (name: 'AUTOGETTERPREFIX'; hasvalue: true ; isglobal: false), (name: 'AUTOSETTERPREFIX'; hasvalue: true ; isglobal: false), - (name: 'THUMBINTERWORKING'; hasvalue: false; isglobal: true ) + (name: 'THUMBINTERWORKING'; hasvalue: false; isglobal: true ), + (name: 'LOWERCASEPROCSTART'; hasvalue: false; isglobal: true ), + (name: 'INITLOCALS'; hasvalue: false; isglobal: true ) ); { switches being applied to all CPUs at the given level } diff --git a/compiler/hlcgobj.pas b/compiler/hlcgobj.pas index 51e434fee4..e0e77ed488 100644 --- a/compiler/hlcgobj.pas +++ b/compiler/hlcgobj.pas @@ -3888,7 +3888,7 @@ implementation while assigned(item) do begin {$ifdef arm} - if current_settings.cputype in cpu_thumb2+cpu_thumb then + if GenerateThumbCode or GenerateThumb2Code then list.concat(tai_thumb_func.create); {$endif arm} { "double link" all procedure entry symbols via .reference } @@ -3911,15 +3911,15 @@ implementation previtem:=item; item := TCmdStrListItem(item.next); end; - if (use_ent) then - list.concat(Tai_ent.create(current_procinfo.procdef.mangledname)); + if (use_ent) then + list.concat(Tai_directive.create(asd_ent,current_procinfo.procdef.mangledname)); current_procinfo.procdef.procstarttai:=tai(list.last); end; procedure thlcgobj.gen_proc_symbol_end(list: TAsmList); begin - if (use_ent) then - list.concat(Tai_ent_end.create(current_procinfo.procdef.mangledname)); + if (use_ent) then + list.concat(Tai_directive.create(asd_ent_end,current_procinfo.procdef.mangledname)); list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname)); current_procinfo.procdef.procendtai:=tai(list.last); diff --git a/compiler/i8086/cpuinfo.pas b/compiler/i8086/cpuinfo.pas index 2ad7fa1332..31ec0d7888 100644 --- a/compiler/i8086/cpuinfo.pas +++ b/compiler/i8086/cpuinfo.pas @@ -125,7 +125,7 @@ Const level1optimizerswitches = genericlevel1optimizerswitches + [cs_opt_peephole]; level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches + - [cs_opt_regvar,cs_opt_stackframe,cs_opt_tailrecursion,cs_opt_nodecse]; + [{cs_opt_regvar,}cs_opt_stackframe,cs_opt_tailrecursion,cs_opt_nodecse]; level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}]; level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [cs_useebp]; diff --git a/compiler/jvm/hlcgcpu.pas b/compiler/jvm/hlcgcpu.pas index 844a0a1632..43ba820671 100644 --- a/compiler/jvm/hlcgcpu.pas +++ b/compiler/jvm/hlcgcpu.pas @@ -559,8 +559,6 @@ implementation begin maybepreparedivu32(list,op,size,trunc32); case op of - OP_NEG,OP_NOT: - ; OP_SHL,OP_SHR,OP_SAR: if not is_64bitint(size) then a_load_reg_stack(list,size,reg) @@ -590,8 +588,6 @@ implementation internalerror(2010121102); maybepreparedivu32(list,op,size,trunc32); case op of - OP_NEG,OP_NOT: - ; OP_SHL,OP_SHR,OP_SAR: begin if not is_64bitint(size) then @@ -1157,14 +1153,16 @@ implementation procedure thlcgjvm.a_op_ref_reg(list: TAsmList; Op: TOpCG; size: tdef; const ref: TReference; reg: TRegister); begin - a_load_reg_stack(list,size,reg); + if not(op in [OP_NOT,OP_NEG]) then + a_load_reg_stack(list,size,reg); a_op_ref_stack(list,op,size,ref); a_load_stack_reg(list,size,reg); end; procedure thlcgjvm.a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tdef; src1, src2, dst: tregister); begin - a_load_reg_stack(list,size,src2); + if not(op in [OP_NOT,OP_NEG]) then + a_load_reg_stack(list,size,src2); a_op_reg_stack(list,op,size,src1); a_load_stack_reg(list,size,dst); end; diff --git a/compiler/jvm/njvmutil.pas b/compiler/jvm/njvmutil.pas index 9c1cf89ace..d19537874d 100644 --- a/compiler/jvm/njvmutil.pas +++ b/compiler/jvm/njvmutil.pas @@ -26,9 +26,9 @@ unit njvmutil; interface uses - node, + node,nbas, ngenutil, - symtype,symconst,symsym; + symtype,symconst,symsym,symdef; type @@ -38,6 +38,11 @@ interface class function force_init: boolean; override; class procedure insertbssdata(sym: tstaticvarsym); override; class function create_main_procdef(const name: string; potype: tproctypeoption; ps: tprocsym): tdef; override; + + class function check_insert_trashing(pd: tprocdef): boolean; override; + class function trashable_sym(p: tsym): boolean; override; + class procedure maybe_trash_variable(var stat: tstatementnode; p: tabstractnormalvarsym; trashn: tnode); override; + class procedure InsertInitFinalTable; override; class procedure InsertThreadvarTablesTable; override; class procedure InsertThreadvars; override; @@ -56,8 +61,8 @@ implementation uses verbose,cutils,globtype,globals,constexp,fmodule, aasmdata,aasmtai,cpubase,aasmcpu, - symdef,symbase,symtable,defutil,jvmdef, - nbas,ncnv,ncon,ninl,ncal,nld,nmem, + symbase,symtable,defutil,jvmdef, + ncnv,ncon,ninl,ncal,nld,nmem, ppu, pass_1; @@ -301,6 +306,73 @@ implementation end; + class function tjvmnodeutils.check_insert_trashing(pd: tprocdef): boolean; + begin + { initialise locals with 0 } + if ts_init_locals in current_settings.targetswitches then + localvartrashing:=high(trashintvalues); + result:=inherited; + end; + + + class function tjvmnodeutils.trashable_sym(p: tsym): boolean; + begin + result:= + inherited and + not jvmimplicitpointertype(tabstractnormalvarsym(p).vardef); + end; + + + class procedure tjvmnodeutils.maybe_trash_variable(var stat: tstatementnode; p: tabstractnormalvarsym; trashn: tnode); + var + enumdef: tenumdef; + trashintval: int64; + trashenumval: longint; + trashable: boolean; + begin + trashable:=trashable_sym(p); + trashintval:=trashintvalues[localvartrashing]; + { widechar is a separate type in the JVM, can't cast left hand to integer + like in common code } + if trashable and + is_widechar(tabstractvarsym(p).vardef) then + trash_small(stat,trashn, + cordconstnode.create(word(trashintval),tabstractvarsym(p).vardef,false)) + { enums are class instances in the JVM -> create a valid instance } + else if trashable and + is_enum(tabstractvarsym(p).vardef) then + begin + enumdef:=tenumdef(tabstractvarsym(p).vardef); + trashenumval:=longint(trashintval); + if not assigned(enumdef.int2enumsym(trashenumval)) then + trashintval:=longint(enumdef.min); + trash_small(stat,trashn, + cordconstnode.create(trashintval,enumdef,false)) + end + { can't init pointers with arbitrary values; procvardef and objectdef are + always pointer-sized here because tjvmnodeutils.trashablesym returns + false for jvm implicit pointer types } + else if trashable and + (tabstractvarsym(p).vardef.typ in [pointerdef,classrefdef,objectdef,procvardef]) then + trash_small(stat,trashn,cnilnode.create) + else if trashable and + is_real(tabstractvarsym(p).vardef) then + trash_small(stat,trashn,crealconstnode.create(trashintval,tabstractvarsym(p).vardef)) + { don't use inherited routines because it typecasts left to the target + type, and that doesn't always work in the JVM } + else if trashable and + (is_integer(tabstractvarsym(p).vardef) or + is_cbool(tabstractvarsym(p).vardef) or + is_anychar(tabstractvarsym(p).vardef) or + is_currency(tabstractvarsym(p).vardef)) then + trash_small(stat,trashn,cordconstnode.create(trashintval,tabstractvarsym(p).vardef,false)) + else if trashable and + is_pasbool(tabstractvarsym(p).vardef) then + trash_small(stat,trashn,cordconstnode.create(trashintval and 1,tabstractvarsym(p).vardef,false)) + else + inherited; + end; + class procedure tjvmnodeutils.InsertInitFinalTable; var hp : tused_unit; diff --git a/compiler/link.pas b/compiler/link.pas index 2972a2dcd9..6c8d47a424 100644 --- a/compiler/link.pas +++ b/compiler/link.pas @@ -46,7 +46,7 @@ interface DynamicLinker : string[100]; end; - TLinker = class(TAbstractLinker) + TLinker = class(TObject) public HasResources, HasExports : boolean; @@ -132,6 +132,8 @@ interface procedure AddImportSymbol(const libname,symname,symmangledname:TCmdStr;OrdNr: longint;isvar:boolean);override; end; + TLinkerClass = class of Tlinker; + var Linker : TLinker; @@ -139,6 +141,8 @@ interface function FindLibraryFile(s:TCmdStr;const prefix,ext:TCmdStr;var foundfile : TCmdStr) : boolean; function FindDLL(const s:TCmdStr;var founddll:TCmdStr):boolean; + procedure RegisterLinker(id:tlink;c:TLinkerClass); + procedure InitLinker; procedure DoneLinker; @@ -154,8 +158,8 @@ Implementation aasmbase,aasmtai,aasmdata,aasmcpu, owbase,owar,ogmap; - type - TLinkerClass = class of Tlinker; + var + CLinker : array[tlink] of TLinkerClass; {***************************************************************************** Helpers @@ -1033,6 +1037,8 @@ Implementation exit; Comment(V_Tried,'Opening library '+para); objreader:=TArObjectreader.create(para,true); + if ErrorCount>0 then + exit; if objreader.isarchive then TFPObjectList(FGroupStack.Last).Add(TStaticLibrary.Create(para,objreader,CObjInput)) else @@ -1518,21 +1524,23 @@ Implementation Init/Done *****************************************************************************} + procedure RegisterLinker(id:tlink;c:TLinkerClass); + begin + CLinker[id]:=c; + end; + + procedure InitLinker; - var - lk : TlinkerClass; begin if (cs_link_extern in current_settings.globalswitches) and - assigned(target_info.linkextern) then + assigned(CLinker[target_info.linkextern]) then begin - lk:=TlinkerClass(target_info.linkextern); - linker:=lk.Create; + linker:=CLinker[target_info.linkextern].Create; end else - if assigned(target_info.link) then + if assigned(CLinker[target_info.link]) then begin - lk:=TLinkerClass(target_info.link); - linker:=lk.Create; + linker:=CLinker[target_info.link].Create; end else linker:=Tlinker.Create; diff --git a/compiler/msg/errorct.msg b/compiler/msg/errorct.msg index 63b8d6f06f..8a1a4a2f48 100644 --- a/compiler/msg/errorct.msg +++ b/compiler/msg/errorct.msg @@ -1273,8 +1273,8 @@ sym_e_forward_type_not_resolved=05009_E_No s'ha resolt el tipus posterior "$1" % A symbolwas forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Només les variables estàtiques poden ser utilitzades en mètodes estàtics o fora dels mètodes % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_S'esperava un tipus de registre o classe -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_No es permeten les instàncies de les classes o els objectes amb un mètode abstracte % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errord.msg b/compiler/msg/errord.msg index 23b887d06e..15de47979e 100644 --- a/compiler/msg/errord.msg +++ b/compiler/msg/errord.msg @@ -1984,8 +1984,8 @@ sym_e_forward_type_not_resolved=05009_E_Forward-Typ "$1" nicht gefunden % The compiler encountered an unknown type. sym_e_only_static_in_static=05010_E_Nur statische Variablen k”nnen in statischen oder „usseren Methoden verwendet werden % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Record- oder Klassen-Typ erwartet -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instanzen von Klassen oder Objekten mit abstrakten Methoden sind unzul„ssig % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorda.msg b/compiler/msg/errorda.msg index 1180490943..f40ca7465b 100644 --- a/compiler/msg/errorda.msg +++ b/compiler/msg/errorda.msg @@ -1326,8 +1326,8 @@ sym_e_forward_type_not_resolved=05009_E_Forward-type ikke erklæret: "$1" % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Kun statiske variabler kan bruges i statiske metoder, eller uden for metoder % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Struktur- eller klassetype forventet -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instancer af klasser eller objekter med abstrakte metoder er ikke tilladt % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errordu.msg b/compiler/msg/errordu.msg index 2e6258d86a..c735cb3e1c 100644 --- a/compiler/msg/errordu.msg +++ b/compiler/msg/errordu.msg @@ -1984,8 +1984,8 @@ sym_e_forward_type_not_resolved=05009_E_Forward-Typ "$1" nicht gefunden % The compiler encountered an unknown type. sym_e_only_static_in_static=05010_E_Nur statische Variablen können in statischen oder äusseren Methoden verwendet werden % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Record- oder Klassen-Typ erwartet -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instanzen von Klassen oder Objekten mit abstrakten Methoden sind unzulässig % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errore.msg b/compiler/msg/errore.msg index 557916edd5..254db57915 100644 --- a/compiler/msg/errore.msg +++ b/compiler/msg/errore.msg @@ -1,6 +1,6 @@ # # This file is part of the Free Pascal Compiler -# Copyright (c) 1999-2009 by the Free Pascal Development team +# Copyright (c) 1999-2013 by the Free Pascal Development team # # English (default) Language File for Free Pascal # @@ -1969,8 +1969,8 @@ sym_e_forward_type_not_resolved=05009_E_Forward type not resolved "$1" % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Only static variables can be used in static methods or outside methods % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_record or class type expected -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instances of classes or objects with an abstract method are not allowed % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. @@ -3055,6 +3055,9 @@ unit_u_indirect_crc_changed=10062_U_Indirect interface (objects/classes) CRC cha % in the interfaces of units directly or indirectly used by this unit in the interface) has been changed after the % implementation has been parsed. % \end{description} +unit_u_ppu_invalid_memory_model=10063_U_PPU is compiled for another i8086 memory model +% This unit file was compiled for a different i8086 memory model and +% cannot be read. # EndOfTeX # @@ -3398,7 +3401,7 @@ S*2Aas_Assemble using GNU AS **2bl_Generate local symbol info **1B_Build all modules **1C<x>_Code generation options: -**2C3<x>_Turn on ieee error checking for constants +**2C3_Turn on ieee error checking for constants **2Ca<x>_Select ABI, see fpc -i for possible values **2Cb_Generate code for a big-endian variant of the target architecture **2Cc<x>_Set default calling convention to <x> @@ -3409,6 +3412,7 @@ S*2Aas_Assemble using GNU AS **2Cg_Generate PIC code **2Ch<n>_<n> bytes heap (between 1023 and 67107840) **2Ci_IO-checking +A*2CI<x>_Select instruction set on ARM: ARM or THUMB **2Cn_Omit linking stage P*2CN_Generate nil-pointer checks (AIX-only) **2Co_Check overflow of integer operations @@ -3426,10 +3430,12 @@ J*2CT<x>_Target-specific code generation options A*2CT<x>_Target-specific code generation options p*3CTsmalltoc_ Generate smaller TOCs at the expense of execution speed (AIX) P*3CTsmalltoc_ Generate smaller TOCs at the expense of execution speed (AIX) +J*3CTautogetterprefix=X_ Automatically create getters for properties with prefix X (empty string disables) +J*3CTautosetterprefix=X_ Automatically create setters for properties with prefix X (empty string disables) J*3CTcompactintarrayinit_ Generate smaller (but potentially slower) code for initializing integer array constants -J*3CTenumfieldinit_ Initialize enumeration fields in constructors to enumtype(0), after calling inherited constructors -J*3CTautogetterprefix=X_ Automatically create getters for properties with prefix X (empty string disables) -J*3CTautosetterprefix=X_ Automatically create setters for properties with prefix X (empty string disables) +J*3CTenumfieldinit_ Initialize enumeration fields in constructors to enumtype(0), after calling inherited constructors +J*3CTinitlocals_ Initialize local variables that trigger a JVM bytecode verification error if used uninitialized (slows down code) +J*3CTlowercaseprocstart_ Lowercase the first character of procedure/function/method names A*3CTthumbinterworking_ Generate Thumb interworking-safe code if possible J*2Cv_Var/out parameter copy-out checking **2CX_Create also smartlinked library diff --git a/compiler/msg/errores.msg b/compiler/msg/errores.msg index 21bbe7ddbf..a582303e34 100644 --- a/compiler/msg/errores.msg +++ b/compiler/msg/errores.msg @@ -1276,8 +1276,8 @@ sym_e_forward_type_not_resolved=05009_E_Tipo posterior no resuelto "$1" % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Solo las variables estáticas pueden ser usadas en métodos estáticos o fuera de métodos % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_tipo record o class esperado -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_No se permiten instancias de clases u objetos con un métodos abstractos % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorf.msg b/compiler/msg/errorf.msg index 3f0ac34411..22ebaf6187 100644 --- a/compiler/msg/errorf.msg +++ b/compiler/msg/errorf.msg @@ -1058,8 +1058,8 @@ sym_e_invalid_call_tvarsymmangledname=05011_E_Invalid call to tvarsym.manglednam % An internal error occurred in the compiler; If you encounter such an error, % please contact the developers and try to provide an exact description of % the circumstances in which the error occurs. -sym_f_type_must_be_rec_or_class=05012_F_record or class type expected -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instances of classes or objects with an abstract method are not allowed % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorfi.msg b/compiler/msg/errorfi.msg index f7edde2fa6..c2bc204f33 100644 --- a/compiler/msg/errorfi.msg +++ b/compiler/msg/errorfi.msg @@ -1358,8 +1358,8 @@ sym_e_forward_type_not_resolved=05009_E_Déclaration forward "$1" non résolue % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Seules les variables statiques peuvent être utilisées dans les méthodes statiques ou en dehors des méthodes % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Type record ou classe attendu -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Les instances de classes ou les objets avec une méthode abstraite ne sont pas autorisés % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorhe.msg b/compiler/msg/errorhe.msg index a4e3e62b48..0d573e2f5b 100644 --- a/compiler/msg/errorhe.msg +++ b/compiler/msg/errorhe.msg @@ -1457,8 +1457,8 @@ sym_e_forward_type_not_resolved=05009_E_äâãøú äèéôåñ ìà äåùìä "$1" % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_ø÷ îùúðéí ñèèééí éëåìéí ìäéåú áùéîåù òí îúåãåú ñèèéåú àå îçåõ ìîèåãåú % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_îöôä ìèéôåñ ùì øùåîä àå èéôåñ ùì îçì÷ä -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_àãâí ùì îçì÷åú àå àåáéé÷èéí òí îúåãåú abstract àéðí îåøùéí % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorheu.msg b/compiler/msg/errorheu.msg index 6d9eac9b5a..4a9365c890 100644 --- a/compiler/msg/errorheu.msg +++ b/compiler/msg/errorheu.msg @@ -1457,8 +1457,8 @@ sym_e_forward_type_not_resolved=05009_E_הגדרת הטיפוס ×œ× ×”×•×©×œ×” % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_רק ×ž×©×ª× ×™× ×¡×˜×˜×™×™× ×™×›×•×œ×™× ×œ×”×™×•×ª בשימוש ×¢× ×ž×ª×•×“×•×ª סטטיות ×ו מחוץ למטודות % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_מצפה לטיפוס של רשומה ×ו טיפוס של מחלקה -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_××“×’× ×©×œ מחלקות ×ו ××•×‘×™×™×§×˜×™× ×¢× ×ž×ª×•×“×•×ª abstract ××™× × ×ž×•×¨×©×™× % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorid.msg b/compiler/msg/errorid.msg index ce7d23ddf8..3ca163dab4 100644 --- a/compiler/msg/errorid.msg +++ b/compiler/msg/errorid.msg @@ -1476,8 +1476,8 @@ sym_e_forward_type_not_resolved=05009_E_Tipe forward tidak memecahkan "$1" % Simbol forward didefinisikan, tapi tidak ada deklarasi yang ditemukan. sym_e_only_static_in_static=05010_E_Hanya variabel statis bisa dipakai dalam metode statis atau di luar metode % Metode statis pada obyek hanya bisa mengakses variabel statis. -sym_f_type_must_be_rec_or_class=05012_F_tipe record atau class diharapkan -% Variabel atau ekspresi bukan tipe \var{record} atau \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Turunan kelas atau obyek dengan metode abstrak tidak dibolehkan % Anda mencoba untuk membuat turunan kelas yang memiliki metode abstrak yang % tidak diganti. diff --git a/compiler/msg/erroriu.msg b/compiler/msg/erroriu.msg index 857688cd6b..261a8ba18f 100644 --- a/compiler/msg/erroriu.msg +++ b/compiler/msg/erroriu.msg @@ -1568,8 +1568,8 @@ sym_e_forward_type_not_resolved=05009_E_Tipo "$1" dichiarato ma non implementato % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Al di fuori dei metodi o nei metodi statici si possono usare solo variabli statiche % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Qui era atteso un tipo record o classe -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Non sono permesse istanze di classi o di oggetti con un metodo astratto % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorn.msg b/compiler/msg/errorn.msg index fe49115dbd..24951fe8b3 100644 --- a/compiler/msg/errorn.msg +++ b/compiler/msg/errorn.msg @@ -1331,8 +1331,8 @@ sym_e_forward_type_not_resolved=05009_E_Forward declaratie niet opgelost $1 % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Alleen statische variabelen kunnen gebruikt worden in statische methoden % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Record- of klassetype verwacht -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_U kunt geen vertegenwoordiger van een klasse met abstracte methoden instantieren % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorpl.msg b/compiler/msg/errorpl.msg index 9166c9072f..0149cf2b8f 100644 --- a/compiler/msg/errorpl.msg +++ b/compiler/msg/errorpl.msg @@ -1281,8 +1281,8 @@ sym_e_forward_type_not_resolved=05009_E_Brak definicji typu $1 % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Tylko zmienne statyczne mog¥ by† u¾ywane w metodach statycznych % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Oczekiwano rekordu lub klasy -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instancje klas i obiekt¢w z metodami abstrakcyjnymi niedozwolone % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorpli.msg b/compiler/msg/errorpli.msg index 25a7d7bd37..ea4cee4bdf 100644 --- a/compiler/msg/errorpli.msg +++ b/compiler/msg/errorpli.msg @@ -1281,8 +1281,8 @@ sym_e_forward_type_not_resolved=05009_E_Brak definicji typu $1 % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Tylko zmienne statyczne mog± byæ u¿ywane w metodach statycznych % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Oczekiwano rekordu lub klasy -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instancje klas i obiektów z metodami abstrakcyjnymi niedozwolone % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorpt.msg b/compiler/msg/errorpt.msg index 083581a6ec..6965ab9622 100644 --- a/compiler/msg/errorpt.msg +++ b/compiler/msg/errorpt.msg @@ -1834,8 +1834,8 @@ sym_e_forward_type_not_resolved=05009_E_Tipo posterior nÆo resolvido "$1" % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Apenas vari veis est ticas podem ser usadas em m‚todos est ticos ou m‚todos externos % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Tipo registro ou classe esperados -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instƒncias de classes ou objetos com m‚todos abstratos nÆo sÆo permitidas % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorptu.msg b/compiler/msg/errorptu.msg index d078e1ca5e..3cdc431570 100644 --- a/compiler/msg/errorptu.msg +++ b/compiler/msg/errorptu.msg @@ -1834,8 +1834,8 @@ sym_e_forward_type_not_resolved=05009_E_Tipo posterior não resolvido "$1" % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Apenas variáveis estáticas podem ser usadas em métodos estáticos ou métodos externos % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_Tipo registro ou classe esperados -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_Instâncias de classes ou objetos com métodos abstratos não são permitidas % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msg/errorr.msg b/compiler/msg/errorr.msg index c2b5814c7b..83de7bdf5b 100644 --- a/compiler/msg/errorr.msg +++ b/compiler/msg/errorr.msg @@ -1446,8 +1446,8 @@ sym_e_forward_type_not_resolved=05009_E_ ¥¥ ®¡ê¥¨¥ ⨯ "$1" ¥ à¥è¥® % ‘¨¬¢®« ¡ë« ®¡ê¥ § à ¥¥, ® ®¯à¥¤¥«¥¨¥ ¤«ï ¥£® ¥ ¡ë«® ®¡ à㦥®. sym_e_only_static_in_static=05010_E_’®«ìª® áâ â¨ç¥áª¨¥ ¯¥à¥¬¥ë¥ ¬®£ã⠨ᯮ«ì§®¢ âìáï ¢ áâ â¨ç¥áª¨å ¬¥â®¤ å ¨«¨ ¢¥ ¬¥â®¤®¢ % ‘â â¨ç¥áª¨© ¬¥â®¤ ®¡ê¥ªâ ¨¬¥¥â ¤®áâ㯠⮫쪮 ª áâ â¨ç¥áª¨¬ ¯¥à¥¬¥ë¬. -sym_f_type_must_be_rec_or_class=05012_F_ަ¨¤ ¥âáï ⨯ record ¨«¨ class -% ¥à¥¬¥ ï ¨«¨ ¢ëà ¦¥¨¥ ¨¬¥¥â ⨯, ®â«¨çë© ®â \var{record} ¨«¨ \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_ަ¨¤ ¥âáï ⨯ record ¨«¨ object ¨«¨ class +% ¥à¥¬¥ ï ¨«¨ ¢ëà ¦¥¨¥ ¨¬¥¥â ⨯, ®â«¨çë© ®â \var{record} ¨«¨ \var{object} ¨«¨ \var{class}. sym_e_no_instance_of_abstract_object=05013_E_ª§¥¬¯«ïàë ª« áᮢ ¨«¨ ®¡ê¥ªâ®¢ á ¡áâp ªâë¬ ¬¥â®¤®¬ ¥ ¤®¯ã᪠îâáï % ®¯ë⪠ᮧ¤ âì íª§¥¬¯«ïà ª« áá á ¡áâà ªâë¬ ¬¥â®¤®¬, ª®â®àë© ¥ ¡ë« ¯¥à¥ªàëâ. sym_w_label_not_defined=05014_W_Œ¥âª "$1" ¥ ®¯p¥¤¥«¥ diff --git a/compiler/msg/errorru.msg b/compiler/msg/errorru.msg index d102d22a3a..cf90653454 100644 --- a/compiler/msg/errorru.msg +++ b/compiler/msg/errorru.msg @@ -1446,8 +1446,8 @@ sym_e_forward_type_not_resolved=05009_E_Раннее объÑвление тип % Символ был объÑвлен заранее, но определение Ð´Ð»Ñ Ð½ÐµÐ³Ð¾ не было обнаружено. sym_e_only_static_in_static=05010_E_Только ÑтатичеÑкие переменные могут иÑпользоватьÑÑ Ð² ÑтатичеÑких методах или вне методов % СтатичеÑкий метод объекта имеет доÑтуп только к ÑтатичеÑким переменным. -sym_f_type_must_be_rec_or_class=05012_F_ОжидаетÑÑ Ñ‚Ð¸Ð¿ record или class -% ÐŸÐµÑ€ÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð¸Ð»Ð¸ выражение имеет тип, отличный от \var{record} или \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_ОжидаетÑÑ Ñ‚Ð¸Ð¿ record или object или class +% ÐŸÐµÑ€ÐµÐ¼ÐµÐ½Ð½Ð°Ñ Ð¸Ð»Ð¸ выражение имеет тип, отличный от \var{record} или \var{object} или \var{class}. sym_e_no_instance_of_abstract_object=05013_E_ÐкземплÑры клаÑÑов или объектов Ñ Ð°Ð±ÑÑ‚pактным методом не допуÑкаютÑÑ % Попытка Ñоздать ÑкземплÑÑ€ клаÑÑа Ñ Ð°Ð±Ñтрактным методом, который не был перекрыт. sym_w_label_not_defined=05014_W_Метка "$1" не опpеделена diff --git a/compiler/msg/errorues.msg b/compiler/msg/errorues.msg index 72c50e441f..7f8103bb2d 100644 --- a/compiler/msg/errorues.msg +++ b/compiler/msg/errorues.msg @@ -1270,8 +1270,8 @@ sym_e_forward_type_not_resolved=05009_E_Tipo posterior no resuelto "$1" % A symbol was forward defined, but no declaration was encountered. sym_e_only_static_in_static=05010_E_Solo las variables estáticas pueden ser usadas en métodos estáticos o fuera de métodos % A static method of an object can only access static variables. -sym_f_type_must_be_rec_or_class=05012_F_tipo record o class esperado -% The variable or expression isn't of the type \var{record} or \var{class}. +sym_e_type_must_be_rec_or_object_or_class=05012_E_Record or object or class type expected +% The variable or expression isn't of the type \var{record} or \var{object} or \var{class}. sym_e_no_instance_of_abstract_object=05013_E_No se permiten instancias de clases u objetos con un métodos abstractos % You are trying to generate an instance of a class which has an abstract % method that wasn't overridden. diff --git a/compiler/msgidx.inc b/compiler/msgidx.inc index e4552ef466..5ec38fae33 100644 --- a/compiler/msgidx.inc +++ b/compiler/msgidx.inc @@ -552,7 +552,7 @@ const sym_e_error_in_type_def=05007; sym_e_forward_type_not_resolved=05009; sym_e_only_static_in_static=05010; - sym_f_type_must_be_rec_or_class=05012; + sym_e_type_must_be_rec_or_object_or_class=05012; sym_e_no_instance_of_abstract_object=05013; sym_w_label_not_defined=05014; sym_e_label_used_and_not_defined=05015; @@ -903,6 +903,7 @@ const unit_u_unload_resunit=10060; unit_e_different_wpo_file=10061; unit_u_indirect_crc_changed=10062; + unit_u_ppu_invalid_memory_model=10063; option_usage=11000; option_only_one_source_support=11001; option_def_only_for_os2=11002; @@ -976,9 +977,9 @@ const option_info=11024; option_help_pages=11025; - MsgTxtSize = 69123; + MsgTxtSize = 69477; MsgIdxMax : array[1..20] of longint=( - 26,95,335,121,88,56,126,27,202,63, + 26,95,335,121,88,56,126,27,202,64, 54,20,1,1,1,1,1,1,1,1 ); diff --git a/compiler/msgtxt.inc b/compiler/msgtxt.inc index b36f6ddb8c..f7ad9a6018 100644 --- a/compiler/msgtxt.inc +++ b/compiler/msgtxt.inc @@ -1,7 +1,7 @@ {$ifdef Delphi} -const msgtxt : array[0..000288] of string[240]=( +const msgtxt : array[0..000289] of string[240]=( {$else Delphi} -const msgtxt : array[0..000288,1..240] of char=( +const msgtxt : array[0..000289,1..240] of char=( {$endif Delphi} '01000_T_Compiler: $1'#000+ '01001_D_Compiler OS: $1'#000+ @@ -692,333 +692,333 @@ const msgtxt : array[0..000288,1..240] of char=( '05009_E_Forward type',' not resolved "$1"'#000+ '05010_E_Only static variables can be used in static methods or outside'+ ' methods'#000+ - '05012_F_record or class type expected'#000+ + '05012_E_Record or object or class type expected'#000+ '05013_E_Instances of classes or objects with an abstract method are no'+ 't allowed'#000+ - '05014_W_Label not define','d "$1"'#000+ + '05014_W_Label ','not defined "$1"'#000+ '05015_E_Label used but not defined "$1"'#000+ '05016_E_Illegal label declaration'#000+ '05017_E_GOTO and LABEL are not supported (use switch -Sg)'#000+ '05018_E_Label not found'#000+ '05019_E_identifier isn'#039't a label'#000+ '05020_E_label already defined'#000+ - '05021_E_illega','l type declaration of set elements'#000+ + '0502','1_E_illegal type declaration of set elements'#000+ '05022_E_Forward class definition not resolved "$1"'#000+ '05023_H_Unit "$1" not used in $2'#000+ '05024_H_Parameter "$1" not used'#000+ '05025_N_Local variable "$1" not used'#000+ - '05026_H_Value parameter "$1" is assigned but never u','sed'#000+ + '05026_H_Value parameter "$1" is assigned b','ut never used'#000+ '05027_N_Local variable "$1" is assigned but never used'#000+ '05028_H_Local $1 "$2" is not used'#000+ '05029_N_Private field "$1.$2" is never used'#000+ '05030_N_Private field "$1.$2" is assigned but never used'#000+ - '05031_N_Private method "$1.$2" never used'#000+ - '0503','2_E_Set type expected'#000+ + '05031_N_Private method "$1.$2" never',' used'#000+ + '05032_E_Set type expected'#000+ '05033_W_Function result does not seem to be set'#000+ '05034_W_Type "$1" is not aligned correctly in current record for C'#000+ '05035_E_Unknown record field identifier "$1"'#000+ - '05036_W_Local variable "$1" does not seem to be initialize','d'#000+ + '05036_W_Local variable "$1" does not seem to be ','initialized'#000+ '05037_W_Variable "$1" does not seem to be initialized'#000+ '05038_E_identifier idents no member "$1"'#000+ '05039_H_Found declaration: $1'#000+ '05040_E_Data element too large'#000+ '05042_E_No matching implementation for interface method "$1" found'#000+ - '05043_W_Symbol ','"$1" is deprecated'#000+ + '05043','_W_Symbol "$1" is deprecated'#000+ '05044_W_Symbol "$1" is not portable'#000+ '05055_W_Symbol "$1" is not implemented'#000+ '05056_E_Can'#039't create unique type from this type'#000+ '05057_H_Local variable "$1" does not seem to be initialized'#000+ - '05058_H_Variable "$1" does not seem to',' be initialized'#000+ + '05058_H_Variable "$1" does n','ot seem to be initialized'#000+ '05059_W_Function result variable does not seem to initialized'#000+ '05060_H_Function result variable does not seem to be initialized'#000+ '05061_W_Variable "$1" read but nowhere assigned'#000+ '05062_H_Found abstract method: $1'#000+ - '05063_W_Symbol ','"$1" is experimental'#000+ + '05063','_W_Symbol "$1" is experimental'#000+ '05064_W_Forward declaration "$1" not resolved, assumed external'#000+ '05065_W_Symbol "$1" is belongs to a library'#000+ '05066_W_Symbol "$1" is deprecated: "$2"'#000+ '05067_E_Cannot find an enumerator for the type "$1"'#000+ - '05068_E_Cannot find',' a "MoveNext" method in enumerator "$1"'#000+ + '05068_E_C','annot find a "MoveNext" method in enumerator "$1"'#000+ '05069_E_Cannot find a "Current" property in enumerator "$1"'#000+ '05070_E_Mismatch between number of declared parameters and number of c'+ 'olons in message string.'#000+ - '05071_N_Private type "$1.$2" never used'#000+ - '05072','_N_Private const "$1.$2" never used'#000+ + '05071_N_Private type "$1.$2" never ','used'#000+ + '05072_N_Private const "$1.$2" never used'#000+ '05073_N_Private property "$1.$2" never used'#000+ '05074_W_Unit "$1" is deprecated'#000+ '05075_W_Unit "$1" is deprecated: "$2"'#000+ '05076_W_Unit "$1" is not portable'#000+ '05077_W_Unit "$1" is belongs to a library'#000+ - '05078_W_Unit "','$1" is not implemented'#000+ + '0507','8_W_Unit "$1" is not implemented'#000+ '05079_W_Unit "$1" is experimental'#000+ '05080_E_No complete definition of the formally declared class "$1" is '+ 'in scope'#000+ '05081_E_Gotos into initialization or finalization blocks of units are '+ 'not allowed'#000+ - '05082_E_Invalid extern','al name "$1" for formal class "$2"'#000+ + '05082_E_Inva','lid external name "$1" for formal class "$2"'#000+ '05083_E_Complete class definition with external name "$1" here'#000+ '05084_W_Possible library conflict: symbol "$1" from library "$2" also '+ 'found in library "$3"'#000+ - '05085_E_Cannot add implicit constructor '#039'Create'#039' b','ecause ide'+ - 'ntifier already used by "$1"'#000+ + '05085_E_Cannot add implicit constructor ',#039'Create'#039' because ident'+ + 'ifier already used by "$1"'#000+ '05086_E_Cannot generate default constructor for class, because parent '+ 'has no parameterless constructor'#000+ '05087_D_Adding helper for $1'#000+ '06009_E_Parameter list size exceeds 65535 bytes'#000+ - '06012_E_File types mu','st be var parameters'#000+ + '06012_E_Fil','e types must be var parameters'#000+ '06013_E_The use of a far pointer isn'#039't allowed there'#000+ '06015_E_EXPORT declared functions can'#039't be called'#000+ '06016_W_Possible illegal call of constructor or destructor'#000+ '06017_N_Inefficient code'#000+ - '06018_W_unreachable code'#000+ - '06020_E','_Abstract methods can'#039't be called directly'#000+ + '06018_W_unreachable co','de'#000+ + '06020_E_Abstract methods can'#039't be called directly'#000+ '06027_DL_Register $1 weight $2 $3'#000+ '06029_DL_Stack frame is omitted'#000+ '06031_E_Object or class methods can'#039't be inline.'#000+ '06032_E_Procvar calls cannot be inline.'#000+ - '06033_E_No code for inline procedure store','d'#000+ + '06033_E_No code for inline proce','dure stored'#000+ '06035_E_Element zero of an ansi/wide- or longstring can'#039't be acces'+ 'sed, use (set)length instead'#000+ '06037_E_Constructors or destructors cannot be called inside a '#039'wit'+ 'h'#039' clause'#000+ '06038_E_Cannot call message handler methods directly'#000+ - '06039_E_Jump i','n or outside of an exception block'#000+ + '0603','9_E_Jump in or outside of an exception block'#000+ '06040_E_Control flow statements aren'#039't allowed in a finally block'#000+ '06041_W_Parameters size exceeds limit for certain cpu'#039's'#000+ '06042_W_Local variable size exceed limit for certain cpu'#039's'#000+ - '06043_E_Local variables ','size exceeds supported limit'#000+ + '06043_E_Local ','variables size exceeds supported limit'#000+ '06044_E_BREAK not allowed'#000+ '06045_E_CONTINUE not allowed'#000+ '06046_F_Unknown compilerproc "$1". Check if you use the correct run ti'+ 'me library.'#000+ - '06047_F_Cannot find system type "$1". Check if you use the correct run'+ - ' tim','e library.'#000+ + '06047_F_Cannot find system type "$1". Check if you use the corre','ct r'+ + 'un time library.'#000+ '06048_H_Inherited call to abstract method ignored'#000+ '06049_E_Goto label "$1" not defined or optimized away'#000+ '06050_F_Cannot find type "$1" in unit "$2". Check if you use the corre'+ 'ct run time library.'#000+ - '06051_E_Interprocedural gotos are ','allowed only to outer subroutines'#000+ + '06051_E_Interprocedural ','gotos are allowed only to outer subroutines'#000+ '06052_E_Label must be defined in the same scope as it is declared'#000+ '06053_E_Leaving procedures containing explicit or implicit exceptions '+ 'frames using goto is not allowed'#000+ - '06054_E_In ISO mode, the mod operator',' is defined only for positive q'+ + '06054_E_In ISO mode, the mo','d operator is defined only for positive q'+ 'uotient'#000+ '06055_DL_Auto inlining: $1'#000+ '07000_DL_Starting $1 styled assembler parsing'#000+ '07001_DL_Finished $1 styled assembler parsing'#000+ '07002_E_Non-label pattern contains @'#000+ - '07004_E_Error building record offset'#000+ - '07005_E_','OFFSET used without identifier'#000+ + '07004_E_Error building record offse','t'#000+ + '07005_E_OFFSET used without identifier'#000+ '07006_E_TYPE used without identifier'#000+ '07007_E_Cannot use local variable or parameters here'#000+ '07008_E_need to use OFFSET here'#000+ '07009_E_need to use $ here'#000+ '07010_E_Cannot use multiple relocatable symbols'#000+ - '07011_E_Relo','catable symbol can only be added'#000+ + '07','011_E_Relocatable symbol can only be added'#000+ '07012_E_Invalid constant expression'#000+ '07013_E_Relocatable symbol is not allowed'#000+ '07014_E_Invalid reference syntax'#000+ '07015_E_You cannot reach $1 from that code'#000+ - '07016_E_Local symbols/labels aren'#039't allowed as refere','nces'#000+ + '07016_E_Local symbols/labels aren'#039't allowed',' as references'#000+ '07017_E_Invalid base and index register usage'#000+ '07018_W_Possible error in object field handling'#000+ '07019_E_Wrong scale factor specified'#000+ '07020_E_Multiple index register usage'#000+ '07021_E_Invalid operand type'#000+ - '07022_E_Invalid string as opcode oper','and: $1'#000+ + '07022_E_Invalid string as o','pcode operand: $1'#000+ '07023_W_@CODE and @DATA not supported'#000+ '07024_E_Null label references are not allowed'#000+ '07025_E_Divide by zero in asm evaluator'#000+ '07026_E_Illegal expression'#000+ '07027_E_escape sequence ignored: $1'#000+ '07028_E_Invalid symbol reference'#000+ - '07029_W_Fwai','t can cause emulation problems with emu387'#000+ + '07','029_W_Fwait can cause emulation problems with emu387'#000+ '07030_W_$1 without operand translated into $1P'#000+ '07031_W_ENTER instruction is not supported by Linux kernel'#000+ '07032_W_Calling an overload function in assembler'#000+ - '07033_E_Unsupported symbol type for opera','nd'#000+ + '07033_E_Unsupported symbol type',' for operand'#000+ '07034_E_Constant value out of bounds'#000+ '07035_E_Error converting decimal $1'#000+ '07036_E_Error converting octal $1'#000+ '07037_E_Error converting binary $1'#000+ '07038_E_Error converting hexadecimal $1'#000+ '07039_H_$1 translated to $2'#000+ - '07040_W_$1 is associated to',' an overloaded function'#000+ + '07040_W_$1 is ass','ociated to an overloaded function'#000+ '07041_E_Cannot use SELF outside a method'#000+ '07042_E_Cannot use OLDEBP outside a nested procedure'#000+ '07043_W_Procedures can'#039't return any value in asm code'#000+ '07044_E_SEG not supported'#000+ - '07045_E_Size suffix and destination or sou','rce size do not match'#000+ + '07045_E_Size suffix and destinat','ion or source size do not match'#000+ '07046_W_Size suffix and destination or source size do not match'#000+ '07047_E_Assembler syntax error'#000+ '07048_E_Invalid combination of opcode and operands'#000+ '07049_E_Assembler syntax error in operand'#000+ - '07050_E_Assembler syntax error',' in constant'#000+ + '07050_E_Assembler sy','ntax error in constant'#000+ '07051_E_Invalid String expression'#000+ '07052_W_constant with symbol $1 for address which is not on a pointer'#000+ '07053_E_Unrecognized opcode $1'#000+ '07054_E_Invalid or missing opcode'#000+ - '07055_E_Invalid combination of prefix and opcode: $1'#000+ - '07056','_E_Invalid combination of override and opcode: $1'#000+ + '07055_E_Invalid combination of prefix and opcode',': $1'#000+ + '07056_E_Invalid combination of override and opcode: $1'#000+ '07057_E_Too many operands on line'#000+ '07058_W_NEAR ignored'#000+ '07059_W_FAR ignored'#000+ '07060_E_Duplicate local symbol $1'#000+ '07061_E_Undefined local symbol $1'#000+ '07062_E_Unknown label identifier $1'#000+ - '07063_E_Inv','alid register name'#000+ + '0','7063_E_Invalid register name'#000+ '07064_E_Invalid floating point register name'#000+ '07066_W_Modulo not supported'#000+ '07067_E_Invalid floating point constant $1'#000+ '07068_E_Invalid floating point expression'#000+ '07069_E_Wrong symbol type'#000+ - '07070_E_Cannot index a local var or ','parameter with a register'#000+ + '07070_E_Cannot index a loc','al var or parameter with a register'#000+ '07071_E_Invalid segment override expression'#000+ '07072_W_Identifier $1 supposed external'#000+ '07073_E_Strings not allowed as constants'#000+ '07074_E_No type of variable specified'#000+ - '07075_E_assembler code not returned to text section',#000+ + '07075_E_assembler code not returned to te','xt section'#000+ '07076_E_Not a directive or local symbol $1'#000+ '07077_E_Using a defined name as a local label'#000+ '07078_E_Dollar token is used without an identifier'#000+ '07079_W_32bit constant created for address'#000+ - '07080_N_.align is target specific, use .balign or .p2ali','gn'#000+ + '07080_N_.align is target specific, use .balign',' or .p2align'#000+ '07081_E_Can'#039't access fields directly for parameters'#000+ '07082_E_Can'#039't access fields of objects/classes directly'#000+ '07083_E_No size specified and unable to determine the size of the oper'+ 'ands'#000+ '07084_E_Cannot use RESULT in this function'#000+ - '07086_W_"$1','" without operand translated into "$1 %st,%st(1)"'#000+ + '0','7086_W_"$1" without operand translated into "$1 %st,%st(1)"'#000+ '07087_W_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000+ '07088_W_"$1 %st(n)" translated into "$1 %st(n),%st"'#000+ '07089_E_Char < not allowed here'#000+ '07090_E_Char > not allowed here'#000+ - '07093_W_ALIGN not supp','orted'#000+ + '07093_W_ALIG','N not supported'#000+ '07094_E_Inc and Dec cannot be together'#000+ '07095_E_Invalid reglist for movem'#000+ '07096_E_Reglist invalid for opcode'#000+ '07097_E_Higher cpu mode required ($1)'#000+ '07098_W_No size specified and unable to determine the size of the oper'+ - 'ands, using DWORD ','as default'#000+ + 'ands, us','ing DWORD as default'#000+ '07099_E_Syntax error while trying to parse a shifter operand'#000+ '07100_E_Address of packed component is not at a byte boundary'#000+ '07101_W_No size specified and unable to determine the size of the oper'+ - 'ands, using BYTE as default'#000+ - '07102_W_','Use of +offset(%ebp) for parameters invalid here'#000+ + 'ands, using BYTE as defaul','t'#000+ + '07102_W_Use of +offset(%ebp) for parameters invalid here'#000+ '07103_W_Use of +offset(%ebp) is not compatible with regcall convention'+ #000+ '07104_W_Use of -offset(%ebp) is not recommended for local variable acc'+ 'ess'#000+ - '07105_W_Use of -offset(%esp), access may cause',' a crash or value may '+ + '07105_W_Use of -offset(%esp), access',' may cause a crash or value may '+ 'be lost'#000+ '07106_E_VMTOffset must be used in combination with a virtual method, a'+ 'nd "$1" is not virtual'#000+ '07107_E_Generating PIC, but reference is not PIC-safe'#000+ - '07108_E_All registers in a register set must be of the same kin','d and'+ + '07108_E_All registers in a register set must be of th','e same kind and'+ ' width'#000+ '07109_E_A register set cannot be empty'#000+ '07110_W_@GOTPCREL is useless and potentially dangereous for local symb'+ 'ols'#000+ '07111_W_Constant with general purpose segment register'#000+ '07112_E_Invalid offset value for $1'#000+ - '07113_E_Invalid register',' for $1'#000+ + '07113_E_Invali','d register for $1'#000+ '07114_E_SEH directives are allowed only in pure assembler procedures'#000+ '07115_E_Directive "$1" is not supported for the current target'#000+ '07116_E_This function'#039's result location cannot be encoded directly'+ - ' in a single operand when "nostack','frame" is used'#000+ + ' in a single operand whe','n "nostackframe" is used'#000+ '07117_E_GOTPCREL references in Intel assembler syntax cannot contain a'+ ' base or index register, and their offset must 0.'#000+ '07118_E_The current target does not support GOTPCREL relocations'#000+ - '07119_W_Exported/global symbols should a','ccessed via the GOT'#000+ + '07119_W_Exported/global symbol','s should accessed via the GOT'#000+ '07120_W_Check size of memory operand "$1"'#000+ '07121_W_Check size of memory operand "$1: memory-operand-size is $2 bi'+ 'ts, but expected [$3 bits]"'#000+ - '07122_W_Check size of memory operand "$1: memory-operand-size is $2 bi'+ - 'ts, but ex','pected [$3 bits + $4 byte offset]"'#000+ + '07122_W_Check size of memory operand "$1: memory-operand-size is $2 bi', + 'ts, but expected [$3 bits + $4 byte offset]"'#000+ '07123_W_Check "$1: offset of memory operand is negative "$2 byte"'#000+ '07124_W_Check "$1: size of memory operand is empty, but es exists diff'+ - 'erent definitions of the memory size =>> map to $2 (smallest option)"', - #000+ + 'erent definitions of the memory size =>> map to $2 (smalles','t option)'+ + '"'#000+ '07125_E_Invalid register used in memory reference expression: "$1"'#000+ '08000_F_Too many assembler files'#000+ '08001_F_Selected assembler output not supported'#000+ '08002_F_Comp not supported'#000+ '08003_F_Direct not support for binary writers'#000+ - '08004_E_Allocating',' of data is only allowed in bss section'#000+ + '08004_E_','Allocating of data is only allowed in bss section'#000+ '08005_F_No binary writer selected'#000+ '08006_E_Asm: Opcode $1 not in table'#000+ '08007_E_Asm: $1 invalid combination of opcode and operands'#000+ '08008_E_Asm: 16 Bit references not supported'#000+ - '08009_E_Asm: Invalid effec','tive address'#000+ + '08009_E_Asm: Inv','alid effective address'#000+ '08010_E_Asm: Immediate or reference expected'#000+ '08011_E_Asm: $1 value exceeds bounds $2'#000+ '08012_E_Asm: Short jump is out of range $1'#000+ '08013_E_Asm: Undefined label $1'#000+ '08014_E_Asm: Comp type not supported for this target'#000+ - '08015_E_Asm: E','xtended type not supported for this target'#000+ + '0801','5_E_Asm: Extended type not supported for this target'#000+ '08016_E_Asm: Duplicate label $1'#000+ '08017_E_Asm: Redefined label $1'#000+ '08018_E_Asm: First defined here'#000+ '08019_E_Asm: Invalid register $1'#000+ '08020_E_Asm: 16 or 32 Bit references not supported'#000+ - '08021_E_Asm: 64 B','it operands not supported'#000+ + '08021_E','_Asm: 64 Bit operands not supported'#000+ '08022_E_Asm: AH,BH,CH or DH cannot be used in an instruction requiring'+ ' REX prefix'#000+ '08023_E_Missing .seh_endprologue directive'#000+ '08024_E_Function prologue exceeds 255 bytes'#000+ - '08025_E_.seh_handlerdata directive without pr','eceding .seh_handler'#000+ + '08025_E_.seh_handlerdata directive ','without preceding .seh_handler'#000+ '08026_F_Relocation count for section $1 exceeds 65535'#000+ '09000_W_Source operating system redefined'#000+ '09001_I_Assembling (pipe) $1'#000+ '09002_E_Can'#039't create assembler file: $1'#000+ - '09003_E_Can'#039't create object file: $1 (error code: $2)'#000, + '09003_E_Can'#039't create object file: $1 (error ','code: $2)'#000+ '09004_E_Can'#039't create archive file: $1'#000+ '09005_E_Assembler $1 not found, switching to external assembling'#000+ '09006_T_Using assembler: $1'#000+ '09007_E_Error while assembling exitcode $1'#000+ - '09008_E_Can'#039't call the assembler, error $1 switching to external a', - 'ssembling'#000+ + '09008_E_Can'#039't call the assembler, error $1 switching to ','external'+ + ' assembling'#000+ '09009_I_Assembling $1'#000+ '09010_I_Assembling with smartlinking $1'#000+ '09011_W_Object $1 not found, Linking may fail !'#000+ '09012_W_Library $1 not found, Linking may fail !'#000+ '09013_E_Error while linking'#000+ - '09014_E_Can'#039't call the linker, switching to',' external linking'#000+ + '09014_E_Can'#039't call the linker, sw','itching to external linking'#000+ '09015_I_Linking $1'#000+ '09016_E_Util $1 not found, switching to external linking'#000+ '09017_T_Using util $1'#000+ '09018_E_Creation of Executables not supported'#000+ '09019_E_Creation of Dynamic/Shared Libraries not supported'#000+ - '09020_I_Closing scr','ipt $1'#000+ + '09020_I_C','losing script $1'#000+ '09021_E_resource compiler "$1" not found, switching to external mode'#000+ '09022_I_Compiling resource $1'#000+ '09023_T_unit $1 can'#039't be statically linked, switching to smart lin'+ 'king'#000+ - '09024_T_unit $1 can'#039't be smart linked, switching to static link','i'+ + '09024_T_unit $1 can'#039't be smart linked, switching to s','tatic linki'+ 'ng'#000+ '09025_T_unit $1 can'#039't be shared linked, switching to static linkin'+ 'g'#000+ '09026_E_unit $1 can'#039't be smart or static linked'#000+ '09027_E_unit $1 can'#039't be shared or static linked'#000+ - '09028_D_Calling resource compiler "$1" with "$2" as command line'#000+ - '09029_','E_Error while compiling resources'#000+ + '09028_D_Calling resource compiler "$1" with "$2" as command l','ine'#000+ + '09029_E_Error while compiling resources'#000+ '09030_E_Can'#039't call the resource compiler "$1", switching to extern'+ 'al mode'#000+ '09031_E_Can'#039't open resource file "$1"'#000+ '09032_E_Can'#039't write resource file "$1"'#000+ - '09033_N_File "$1" not found for backquoted cat command'#000, + '09033_N_File "$1" not found for backquoted ca','t command'#000+ '09034_W_"$1" not found, this will probably cause a linking failure'#000+ '09128_F_Can'#039't post process executable $1'#000+ '09129_F_Can'#039't open executable $1'#000+ '09130_X_Size of Code: $1 bytes'#000+ '09131_X_Size of initialized data: $1 bytes'#000+ - '09132_X_Size of uninitial','ized data: $1 bytes'#000+ + '09132_X_Size of',' uninitialized data: $1 bytes'#000+ '09133_X_Stack space reserved: $1 bytes'#000+ '09134_X_Stack space committed: $1 bytes'#000+ '09200_F_Executable image size is too big for $1 target.'#000+ '09201_W_Object file "$1" contains 32-bit absolute relocation to symbol'+ - ' "$2".'#000+ - '10000_T_','Unitsearch: $1'#000+ + ' "$2"','.'#000+ + '10000_T_Unitsearch: $1'#000+ '10001_T_PPU Loading $1'#000+ '10002_U_PPU Name: $1'#000+ '10003_U_PPU Flags: $1'#000+ @@ -1027,170 +1027,171 @@ const msgtxt : array[0..000288,1..240] of char=( '10006_U_PPU File too short'#000+ '10007_U_PPU Invalid Header (no PPU at the begin)'#000+ '10008_U_PPU Invalid Version $1'#000+ - '10009_U_PPU',' is compiled for another processor'#000+ + '1','0009_U_PPU is compiled for another processor'#000+ '10010_U_PPU is compiled for another target'#000+ '10011_U_PPU Source: $1'#000+ '10012_U_Writing $1'#000+ '10013_F_Can'#039't Write PPU-File'#000+ '10014_F_Error reading PPU-File'#000+ '10015_F_unexpected end of PPU-File'#000+ - '10016_F_Invalid PPU-File ','entry: $1'#000+ + '10016_F_Invalid',' PPU-File entry: $1'#000+ '10017_F_PPU Dbx count problem'#000+ '10018_E_Illegal unit name: $1'#000+ '10019_F_Too much units'#000+ '10020_F_Circular unit reference between $1 and $2'#000+ '10021_F_Can'#039't compile unit $1, no sources available'#000+ - '10022_F_Can'#039't find unit $1 used by $2'#000+ - '10023_W','_Unit $1 was not found but $2 exists'#000+ + '10022_F_Can'#039't find unit $1 used by ','$2'#000+ + '10023_W_Unit $1 was not found but $2 exists'#000+ '10024_F_Unit $1 searched but $2 found'#000+ '10025_W_Compiling the system unit requires the -Us switch'#000+ '10026_F_There were $1 errors compiling module, stopping'#000+ '10027_U_Load from $1 ($2) unit $3'#000+ - '10028_U_Recompili','ng $1, checksum changed for $2'#000+ + '10028_U','_Recompiling $1, checksum changed for $2'#000+ '10029_U_Recompiling $1, source found only'#000+ '10030_U_Recompiling unit, static lib is older than ppufile'#000+ '10031_U_Recompiling unit, shared lib is older than ppufile'#000+ - '10032_U_Recompiling unit, obj and asm are older t','han ppufile'#000+ + '10032_U_Recompiling unit, obj and asm a','re older than ppufile'#000+ '10033_U_Recompiling unit, obj is older than asm'#000+ '10034_U_Parsing interface of $1'#000+ '10035_U_Parsing implementation of $1'#000+ '10036_U_Second load for unit $1'#000+ '10037_U_PPU Check file $1 time $2'#000+ - '10040_W_Can'#039't recompile unit $1, but found mo','difed include files'+ + '10040_W_Can'#039't recompile unit $1, bu','t found modifed include files'+ #000+ '10041_U_File $1 is newer than the one used for creating PPU file $2'#000+ '10042_U_Trying to use a unit which was compiled with a different FPU m'+ 'ode'#000+ '10043_U_Loading interface units from $1'#000+ - '10044_U_Loading implementation units f','rom $1'#000+ + '10044_U_Loading implementati','on units from $1'#000+ '10045_U_Interface CRC changed for unit $1'#000+ '10046_U_Implementation CRC changed for unit $1'#000+ '10047_U_Finished compiling unit $1'#000+ '10048_U_Adding dependency: $1 depends on $2'#000+ '10049_U_No reload, is caller: $1'#000+ - '10050_U_No reload, already in se','cond compile: $1'#000+ + '10050_U_No reload, alr','eady in second compile: $1'#000+ '10051_U_Flag for reload: $1'#000+ '10052_U_Forced reloading'#000+ '10053_U_Previous state of $1: $2'#000+ '10054_U_Already compiling $1, setting second compile'#000+ '10055_U_Loading unit $1'#000+ '10056_U_Finished loading unit $1'#000+ - '10057_U_Registering new uni','t $1'#000+ + '10057_U_Registeri','ng new unit $1'#000+ '10058_U_Re-resolving unit $1'#000+ '10059_U_Skipping re-resolving unit $1, still loading used units'#000+ '10060_U_Unloading resource unit $1 (not needed)'#000+ '10061_E_Unit $1 was compiled using a different whole program optimizat'+ - 'ion feedback input ($2, ','$3); recompile it without wpo or use the sam'+ + 'ion feedback i','nput ($2, $3); recompile it without wpo or use the sam'+ 'e wpo feedback input file for this compilation invocation'#000+ '10062_U_Indirect interface (objects/classes) CRC changed for unit $1'#000+ - '11000_O_$1 [options] <inputfile> [options]'#000+ - '11001_W_Only one source fi','le supported, changing source file to comp'+ - 'ile from "$1" into "$2"'#000+ + '10063_U_PPU is compiled for another i8086 memory model'#000+ + '1100','0_O_$1 [options] <inputfile> [options]'#000+ + '11001_W_Only one source file supported, changing source file to compil'+ + 'e from "$1" into "$2"'#000+ '11002_W_DEF file can be created only for OS/2'#000+ '11003_E_nested response files are not supported'#000+ - '11004_F_No source file name in command line'#000+ - '11005_N_No option inside $1 config f','ile'#000+ + '11004_F_No sour','ce file name in command line'#000+ + '11005_N_No option inside $1 config file'#000+ '11006_E_Illegal parameter: $1'#000+ '11007_H_-? writes help pages'#000+ '11008_F_Too many config files nested'#000+ '11009_F_Unable to open file $1'#000+ '11010_D_Reading further options from $1'#000+ - '11011_W_Target is already set to: $1'#000+ - '11012_W_Shared libs not supporte','d on DOS platform, reverting to stat'+ - 'ic'#000+ + '1101','1_W_Target is already set to: $1'#000+ + '11012_W_Shared libs not supported on DOS platform, reverting to static'+ + #000+ '11013_F_In options file $1 at line $2 too many \var{\#IF(N)DEFs} encou'+ 'ntered'#000+ - '11014_F_In options file $1 at line $2 unexpected \var{\#ENDIFs} encoun'+ - 'tered'#000+ - '11015_F_Open conditional at the end of the optio','ns file'#000+ + '11014_F_In options file $1 at line $2 unexpected \var{\#END','IFs} enco'+ + 'untered'#000+ + '11015_F_Open conditional at the end of the options file'#000+ '11016_W_Debug information generation is not supported by this executab'+ 'le'#000+ '11017_H_Try recompiling with -dGDB'#000+ '11018_W_You are using the obsolete switch $1'#000+ - '11019_W_You are using the obsolete switch $1, please use $2'#000+ - '11020_N_Switching a','ssembler to default source writing assembler'#000+ + '11019_W_You ar','e using the obsolete switch $1, please use $2'#000+ + '11020_N_Switching assembler to default source writing assembler'#000+ '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+ '11022_W_"$1" assembler use forced'#000+ - '11026_T_Reading options from file $1'#000+ + '11026_T_Reading options from ','file $1'#000+ '11027_T_Reading options from environment $1'#000+ - '11028_D_Handl','ing option "$1"'#000+ + '11028_D_Handling option "$1"'#000+ '11029_O_*** press enter ***'#000+ '11030_H_Start of reading config file $1'#000+ '11031_H_End of reading config file $1'#000+ '11032_D_interpreting option "$1"'#000+ - '11036_D_interpreting firstpass option "$1"'#000+ + '11036_D_interpreting',' firstpass option "$1"'#000+ '11033_D_interpreting file option "$1"'#000+ - '1103','4_D_Reading config file "$1"'#000+ + '11034_D_Reading config file "$1"'#000+ '11035_D_found source file name "$1"'#000+ '11039_E_Unknown codepage "$1"'#000+ '11040_F_Config file $1 is a directory'#000+ - '11041_W_Assembler output selected "$1" cannot generate debug info, deb'+ - 'ugging disabled'#000+ - '11042_W_Use of ppc386','.cfg is deprecated, please use fpc.cfg instead'#000+ + '11041_W_Assembler output selected "$1" can','not generate debug info, d'+ + 'ebugging disabled'#000+ + '11042_W_Use of ppc386.cfg is deprecated, please use fpc.cfg instead'#000+ '11043_F_In options file $1 at line $2 \var{\#ELSE} directive without \'+ 'var{\#IF(N)DEF} found'#000+ - '11044_F_Option "$1" is not, or not yet, supported on the current targe'+ - 't platform'#000+ - '11045_F_The feature ','"$1" is not, or not yet, supported on the select'+ - 'ed target platform'#000+ + '11044_F_Option "$1" is not, or not y','et, supported on the current tar'+ + 'get platform'#000+ + '11045_F_The feature "$1" is not, or not yet, supported on the selected'+ + ' target platform'#000+ '11046_N_DWARF debug information cannot be used with smart linking on t'+ - 'his target, switching to static linking'#000+ - '11047_W_Option "$1" is ignored for the current target platform.',#000+ + 'his target, switching to static linkin','g'#000+ + '11047_W_Option "$1" is ignored for the current target platform.'#000+ '11048_W_Disabling external debug information because it is unsupported'+ ' for the selected target/debug format combination.'#000+ - '11049_N_DWARF debug information cannot be used with smart linking with'+ - ' external assembler, disabling static library cr','eation.'#000+ + '11049_N_DWARF debug information cannot be used with s','mart linking wi'+ + 'th external assembler, disabling static library creation.'#000+ '11050_E_Invalid value for MACOSX_DEPLOYMENT_TARGET environment variabl'+ 'e: $1'#000+ '11051_E_Invalid value for IPHONEOS_DEPLOYMENT_TARGET environment varia'+ 'ble: $1'#000+ - '11052_E_You must use a FPU type of VFPV2, VFPV3 or VFPV3_D16 when usin'+ - 'g the EA','BIHF ABI target'#000+ + '11052_E_You m','ust use a FPU type of VFPV2, VFPV3 or VFPV3_D16 when us'+ + 'ing the EABIHF ABI target'#000+ '11053_W_The selected debug format is not supported on the current targ'+ 'et, not changing the current setting'#000+ - '12000_F_Cannot open whole program optimization feedback file "$1"'#000+ - '12001_D_Processing whole program optimization infor','mation in wpo fee'+ - 'dback file "$1"'#000+ + '12000_F_Cannot open whole program optimization feedb','ack file "$1"'#000+ + '12001_D_Processing whole program optimization information in wpo feedb'+ + 'ack file "$1"'#000+ '12002_D_Finished processing the whole program optimization information'+ ' in wpo feedback file "$1"'#000+ - '12003_E_Expected section header, but got "$2" at line $1 of wpo feedba'+ - 'ck file'#000+ - '12004_W_No handler registered fo','r whole program optimization section'+ - ' "$2" at line $1 of wpo feedback file, ignoring'#000+ + '12003_E_Expected section header, but got "$2"',' at line $1 of wpo feed'+ + 'back file'#000+ + '12004_W_No handler registered for whole program optimization section "'+ + '$2" at line $1 of wpo feedback file, ignoring'#000+ '12005_D_Found whole program optimization section "$1" with information'+ ' about "$2"'#000+ - '12006_F_The selected whole program optimizations require a previously '+ - 'gene','rated feedback file (use -Fw to specify)'#000+ + '12006_F_T','he selected whole program optimizations require a previousl'+ + 'y generated feedback file (use -Fw to specify)'#000+ '12007_E_No collected information necessary to perform "$1" whole progr'+ 'am optimization found'#000+ - '12008_F_Specify a whole program optimization feedback file to store th'+ - 'e generated info in (using -FW)'#000+ - '12009','_E_Not generating any whole program optimization information, y'+ - 'et a feedback file was specified (using -FW)'#000+ - '12010_E_Not performing any whole program optimizations, yet an input f'+ - 'eedback file was specified (using -Fw)'#000+ - '12011_D_Skipping whole ','program optimization section "$1", because no'+ - 't needed by the requested optimizations'#000+ + '12008_F_Specify a whole program optimizati','on feedback file to store '+ + 'the generated info in (using -FW)'#000+ + '12009_E_Not generating any whole program optimization information, yet'+ + ' a feedback file was specified (using -FW)'#000+ + '12010_E_Not performing any whole program optimizations, yet an inpu','t'+ + ' feedback file was specified (using -Fw)'#000+ + '12011_D_Skipping whole program optimization section "$1", because not '+ + 'needed by the requested optimizations'#000+ '12012_W_Overriding previously read information for "$1" from feedback '+ - 'input file using information in section "$2"'#000+ - '12013_E_Cannot extract symbol liveness i','nformation from program when'+ - ' stripping symbols, use -Xs-'#000+ + 'input file using inf','ormation in section "$2"'#000+ + '12013_E_Cannot extract symbol liveness information from program when s'+ + 'tripping symbols, use -Xs-'#000+ '12014_E_Cannot extract symbol liveness information from program when w'+ 'hen not linking'#000+ - '12015_F_Cannot find "$1" or "$2" to extract symbol liveness informatio'+ - 'n from linked program'#000+ - '12016','_E_Error during reading symbol liveness information produced by'+ - ' "$1"'#000+ + '12015_F_Cannot find "$1" or "$2"',' to extract symbol liveness informat'+ + 'ion from linked program'#000+ + '12016_E_Error during reading symbol liveness information produced by "'+ + '$1"'#000+ '12017_F_Error executing "$1" (exitcode: $2) to extract symbol informat'+ 'ion from linked program'#000+ - '12018_E_Collection of symbol liveness information can only help when u'+ - 'sing sm','art linking, use -CX -XX'#000+ + '12018_E_Coll','ection of symbol liveness information can only help when'+ + ' using smart linking, use -CX -XX'#000+ '12019_E_Cannot create specified whole program optimisation feedback fi'+ 'le "$1"'#000+ '11023_Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPC'+ - 'CPU'#010+ + 'CP','U'#010+ 'Copyright (c) 1993-2013 by Florian Klaempfl and others'#000+ - '11024_Fr','ee Pascal Compiler version $FPCVERSION'#010+ + '11024_Free Pascal Compiler version $FPCVERSION'#010+ #010+ 'Compiler Date : $FPCDATE'#010+ 'Compiler CPU Target: $FPCCPU'#010+ @@ -1199,11 +1200,11 @@ const msgtxt : array[0..000288,1..240] of char=( ' $OSTARGETS'#010+ #010+ 'Supported CPU instruction sets:'#010+ - ' $INSTRUCTIONSETS'#010+ + ' $INSTRUC','TIONSETS'#010+ #010+ 'Supported FPU instruction sets:'#010+ ' $FPUINSTRUCTIONSETS'#010+ - #010, + #010+ 'Supported ABI targets:'#010+ ' $ABITARGETS'#010+ #010+ @@ -1214,381 +1215,384 @@ const msgtxt : array[0..000288,1..240] of char=( ' All'#010+ ' $WPOPTIMIZATIONS'#010+ #010+ - 'Supported Microcontroller types:'#010+ + 'Supported Microcontroller typ','es:'#010+ ' $CONTROLLERTYPES'#010+ #010+ - 'This program comes under the GNU General ','Public Licence'#010+ + 'This program comes under the GNU General Public Licence'#010+ 'For more information read COPYING.v2'#010+ #010+ 'Please report bugs in our bug tracker on:'#010+ ' http://bugs.freepascal.org'#010+ #010+ - 'More information may be found on our WWW pages (including directions'#010+ - 'for mailing lists useful for as','king questions or discussing potentia'+ - 'l'#010+ + 'More information may be found on ou','r WWW pages (including directions'+ + #010+ + 'for mailing lists useful for asking questions or discussing potential'#010+ 'new features, etc.):'#010+ ' http://www.freepascal.org'#000+ '11025_**0*_Put + after a boolean switch option to enable it, - to disa'+ - 'ble it'#010+ - '**1a_The compiler doesn'#039't delete the generated assembler fil','e'#010+ + 'bl','e it'#010+ + '**1a_The compiler doesn'#039't delete the generated assembler file'#010+ '**2al_List sourcecode lines in assembler file'#010+ '**2an_List node info in assembler file (-dEXTDEBUG compiler)'#010+ '*L2ap_Use pipes instead of creating temporary assembler files'#010+ - '**2ar_List register allocation/release info in assembler file'#010+ - '**2at_L','ist temp allocation/release info in assembler file'#010+ + '**2a','r_List register allocation/release info in assembler file'#010+ + '**2at_List temp allocation/release info in assembler file'#010+ '**1A<x>_Output format:'#010+ '**2Adefault_Use default assembler'#010+ '3*2Aas_Assemble using GNU AS'#010+ - '3*2Amacho_Mach-O (Darwin, Intel 32 bit) using internal writer'#010+ - '3*2Anasmcoff_COFF (Go32v2) file using Nas','m'#010+ + '3*2Amacho_Mach-O (Darwin, Intel 32 bit',') using internal writer'#010+ + '3*2Anasmcoff_COFF (Go32v2) file using Nasm'#010+ '3*2Anasmelf_ELF32 (Linux) file using Nasm'#010+ '3*2Anasmwin32_Win32 object file using Nasm'#010+ '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+ '3*2Awasm_Obj file using Wasm (Watcom)'#010+ - '3*2Anasmobj_Obj file using Nasm'#010+ - '3*2Amasm_Obj file using Masm (Micr','osoft)'#010+ + '3','*2Anasmobj_Obj file using Nasm'#010+ + '3*2Amasm_Obj file using Masm (Microsoft)'#010+ '3*2Atasm_Obj file using Tasm (Borland)'#010+ '3*2Aelf_ELF (Linux) using internal writer'#010+ '3*2Acoff_COFF (Go32v2) using internal writer'#010+ - '3*2Apecoff_PE-COFF (Win32) using internal writer'#010+ + '3*2Apecoff_PE-COFF (Win32) using internal ','writer'#010+ '4*2Aas_Assemble using GNU AS'#010+ - '4*2Agas_Assemble using GNU GA','S'#010+ + '4*2Agas_Assemble using GNU GAS'#010+ '4*2Agas-darwin_Assemble darwin Mach-O64 using GNU GAS'#010+ '4*2Amasm_Win64 object file using ml64 (Microsoft)'#010+ '4*2Apecoff_PE-COFF (Win64) using internal writer'#010+ - '4*2Aelf_ELF (Linux-64bit) using internal writer'#010+ + '4*2Aelf_ELF (Linux-6','4bit) using internal writer'#010+ '6*2Aas_Unix o-file using GNU AS'#010+ - '6*2Ag','as_GNU Motorola assembler'#010+ + '6*2Agas_GNU Motorola assembler'#010+ '6*2Amit_MIT Syntax (old GAS)'#010+ '6*2Amot_Standard Motorola assembler'#010+ 'A*2Aas_Assemble using GNU AS'#010+ 'P*2Aas_Assemble using GNU AS'#010+ - 'S*2Aas_Assemble using GNU AS'#010+ + 'S*2Aas_Assemble using GNU ','AS'#010+ '**1b_Generate browser info'#010+ '**2bl_Generate local symbol info'#010+ - '**','1B_Build all modules'#010+ + '**1B_Build all modules'#010+ '**1C<x>_Code generation options:'#010+ - '**2C3<x>_Turn on ieee error checking for constants'#010+ + '**2C3_Turn on ieee error checking for constants'#010+ '**2Ca<x>_Select ABI, see fpc -i for possible values'#010+ - '**2Cb_Generate code for a big-endian variant of the target architectur'+ - 'e'#010+ - '**2Cc<x>_Se','t default calling convention to <x>'#010+ + '**2Cb_Generate code f','or a big-endian variant of the target architect'+ + 'ure'#010+ + '**2Cc<x>_Set default calling convention to <x>'#010+ '**2CD_Create also dynamic library (not supported)'#010+ '**2Ce_Compilation with emulated floating point opcodes'#010+ - '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+ - 'lues'#010+ - '**2CF<x>_Minimal floatin','g point constant precision (default, 32, 64)'+ - #010+ + '**2Cf<x>_Select fpu instruction set t','o use, see fpc -i for possible '+ + 'values'#010+ + '**2CF<x>_Minimal floating point constant precision (default, 32, 64)'#010+ '**2Cg_Generate PIC code'#010+ '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+ '**2Ci_IO-checking'#010+ + 'A*2CI<x>_Select instruction set on ARM:',' ARM or THUMB'#010+ '**2Cn_Omit linking stage'#010+ 'P*2CN_Generate nil-pointer checks (AIX-only)'#010+ - '**2Co_Check overflow of integer',' operations'#010+ + '**2Co_Check overflow of integer operations'#010+ '**2CO_Check for possible overflow of integer operations'#010+ - '**2Cp<x>_Select instruction set, see fpc -i for possible values'#010+ + '**2Cp<x>_Select instruction set, see fpc -i for possible ','values'#010+ '**2CP<x>=<y>_ packing settings'#010+ '**3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 '+ 'and 8'#010+ - '*','*2Cr_Range checking'#010+ + '**2Cr_Range checking'#010+ '**2CR_Verify object method call validity'#010+ '**2Cs<n>_Set stack checking size to <n>'#010+ - '**2Ct_Stack checking (for testing only, see manual)'#010+ + '**2Ct_Stack checking (fo','r testing only, see manual)'#010+ 'p*2CT<x>_Target-specific code generation options'#010+ - 'P*2CT<x>_Target-specific code generati','on options'#010+ + 'P*2CT<x>_Target-specific code generation options'#010+ 'J*2CT<x>_Target-specific code generation options'#010+ 'A*2CT<x>_Target-specific code generation options'#010+ - 'p*3CTsmalltoc_ Generate smaller TOCs at the expense of execution speed'+ - ' (AIX)'#010+ - 'P*3CTsmalltoc_ Generate smaller TOCs at the expense of',' execution spe'+ + 'p*3CTsmalltoc_ G','enerate smaller TOCs at the expense of execution spe'+ 'ed (AIX)'#010+ + 'P*3CTsmalltoc_ Generate smaller TOCs at the expense of execution speed'+ + ' (AIX)'#010+ + 'J*3CTautogetterprefix=X_ Automatically create getters for properties '+ + 'with prefix X (empty string disa','bles)'#010+ + 'J*3CTautosetterprefix=X_ Automatically create setters for properties '+ + 'with prefix X (empty string disables)'#010+ 'J*3CTcompactintarrayinit_ Generate smaller (but potentially slower) co'+ 'de for initializing integer array constants'#010+ - 'J*3CTenumfieldinit_ Initialize enumeration fields in constructors to e'+ - 'numtype(0), after calling inherit','ed constructors'#010+ - 'J*3CTautogetterprefix=X_ Automatically create getters for properties w'+ - 'ith prefix X (empty string disables)'#010+ - 'J*3CTautosetterprefix=X_ Automatically create setters for properties w'+ - 'ith prefix X (empty string disables)'#010+ - 'A*3CTthumb','interworking_ Generate Thumb interworking-safe code if pos'+ - 'sible'#010+ + 'J*3CTenumfie','ldinit_ Initialize enumeration fields in construct'+ + 'ors to enumtype(0), after calling inherited constructors'#010+ + 'J*3CTinitlocals_ Initialize local variables that trigger a JV'+ + 'M bytecode verification error if used uninitialized (slow','s down code'+ + ')'#010+ + 'J*3CTlowercaseprocstart_ Lowercase the first character of procedure/f'+ + 'unction/method names'#010+ + 'A*3CTthumbinterworking_ Generate Thumb interworking-safe code if possi'+ + 'ble'#010+ 'J*2Cv_Var/out parameter copy-out checking'#010+ - '**2CX_Create also smartlinked library'#010+ + '**2CX_Create also sm','artlinked library'#010+ '**1d<x>_Defines the symbol <x>'#010+ '**1D_Generate a DEF file'#010+ '**2Dd<x>_Set description to <x>'#010+ - '**2Dv<x>','_Set DLL version to <x>'#010+ + '**2Dv<x>_Set DLL version to <x>'#010+ '*O2Dw_PM application'#010+ '**1e<x>_Set path to executable'#010+ '**1E_Same as -Cn'#010+ '**1fPIC_Same as -Cg'#010+ - '**1F<x>_Set file names and paths:'#010+ + '**1F<x>_Set f','ile names and paths:'#010+ '**2Fa<x>[,y]_(for a program) load units <x> and [y] before uses is par'+ 'sed'#010+ - '**2Fc<x>_Set input ','codepage to <x>'#010+ + '**2Fc<x>_Set input codepage to <x>'#010+ '**2FC<x>_Set RC compiler binary name to <x>'#010+ '**2Fd_Disable the compiler'#039's internal directory cache'#010+ - '**2FD<x>_Set the directory where to search for compiler utilities'#010+ + '**2FD<x>_Set',' the directory where to search for compiler utilities'#010+ '**2Fe<x>_Redirect error output to <x>'#010+ - '**2Ff<x>_Add <x> to fr','amework path (Darwin only)'#010+ + '**2Ff<x>_Add <x> to framework path (Darwin only)'#010+ '**2FE<x>_Set exe/unit output path to <x>'#010+ '**2Fi<x>_Add <x> to include path'#010+ - '**2Fl<x>_Add <x> to library path'#010+ + '**2Fl<x>_Add <x> to libra','ry path'#010+ '**2FL<x>_Use <x> as dynamic linker'#010+ '**2Fm<x>_Load unicode conversion table from <x>.txt in the compiler di'+ - 'r',#010+ + 'r'#010+ '**2Fo<x>_Add <x> to object path'#010+ '**2Fr<x>_Load error message file <x>'#010+ '**2FR<x>_Set resource (.res) linker to <x>'#010+ - '**2Fu<x>_Add <x> to unit path'#010+ + '**2Fu<x>_Add ','<x> to unit path'#010+ '**2FU<x>_Set unit output path to <x>, overrides -FE'#010+ - '**2FW<x>_Store generated whole-program optimi','zation feedback in <x>'#010+ + '**2FW<x>_Store generated whole-program optimization feedback in <x>'#010+ '**2Fw<x>_Load previously stored whole-program optimization feedback fr'+ 'om <x>'#010+ - '*g1g_Generate debug information (default format for target)'#010+ + '*g1g_Generate debug inform','ation (default format for target)'#010+ '*g2gc_Generate checks for pointers'#010+ - '*g2gh_Use heaptrace unit (for memory leak/cor','ruption debugging)'#010+ + '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+ '*g2gl_Use line info unit (show more info with backtraces)'#010+ '*g2go<x>_Set debug information options'#010+ - '*g3godwarfsets_ Enable DWARF '#039'set'#039' type debug information (bre'+ - 'aks gdb < 6.5)'#010+ - '*g3gostabsabsincludes_ Store absolute/full incl','ude file paths in Sta'+ - 'bs'#010+ + '*g3godwarf','sets_ Enable DWARF '#039'set'#039' type debug information (b'+ + 'reaks gdb < 6.5)'#010+ + '*g3gostabsabsincludes_ Store absolute/full include file paths in Stabs'+ + #010+ '*g3godwarfmethodclassprefix_ Prefix method names in DWARF with class n'+ 'ame'#010+ - '*g2gp_Preserve case in stabs symbol names'#010+ + '*g2gp_Preserve case in stabs',' symbol names'#010+ '*g2gs_Generate Stabs debug information'#010+ '*g2gt_Trash local variables (to detect uninitialized uses)'#010+ - '*g','2gv_Generates programs traceable with Valgrind'#010+ + '*g2gv_Generates programs traceable with Valgrind'#010+ '*g2gw_Generate DWARFv2 debug information (same as -gw2)'#010+ - '*g2gw2_Generate DWARFv2 debug information'#010+ + '*g2gw2_Generate DWARFv2',' debug information'#010+ '*g2gw3_Generate DWARFv3 debug information'#010+ - '*g2gw4_Generate DWARFv4 debug information (experiment','al)'#010+ + '*g2gw4_Generate DWARFv4 debug information (experimental)'#010+ '**1i_Information'#010+ '**2iD_Return compiler date'#010+ '**2iV_Return short compiler version'#010+ '**2iW_Return full compiler version'#010+ - '**2iSO_Return compiler OS'#010+ + '**2iSO_','Return compiler OS'#010+ '**2iSP_Return compiler host processor'#010+ '**2iTO_Return target OS'#010+ '**2iTP_Return target processor'#010+ - '**','1I<x>_Add <x> to include path'#010+ + '**1I<x>_Add <x> to include path'#010+ '**1k<x>_Pass <x> to the linker'#010+ '**1l_Write logo'#010+ '**1M<x>_Set language mode to <x>'#010+ - '**2Mfpc_Free Pascal dialect (default)'#010+ + '**2Mfpc_Free Pas','cal dialect (default)'#010+ '**2Mobjfpc_FPC mode with Object Pascal support'#010+ '**2Mdelphi_Delphi 7 compatibility mode'#010+ - '**2Mtp','_TP/BP 7.0 compatibility mode'#010+ + '**2Mtp_TP/BP 7.0 compatibility mode'#010+ '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+ - '**1n_Do not read the default config files'#010+ + '**1n_Do not read the default config file','s'#010+ '**1o<x>_Change the name of the executable produced to <x>'#010+ '**1O<x>_Optimizations:'#010+ '**2O-_Disable optimizations'#010+ - '**2','O1_Level 1 optimizations (quick and debugger friendly)'#010+ + '**2O1_Level 1 optimizations (quick and debugger friendly)'#010+ '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+ - '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+ + '**2O3_Level 3 o','ptimizations (-O2 + slow optimizations)'#010+ '**2O4_Level 4 optimizations (-O3 + optimizations which might have unex'+ - 'pect','ed side effects)'#010+ + 'pected side effects)'#010+ '**2Oa<x>=<y>_Set alignment'#010+ '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possible '+ 'values'#010+ - '**2Op<x>_Set target cpu for optimizing, see fpc -i for possible values'+ - #010+ - '**2OW<x>_Generate whole-program optimization fee','dback for optimizati'+ - 'on <x>, see fpc -i for possible values'#010+ - '**2Ow<x>_Perform whole-program optimization <x>, see fpc -i for possib'+ - 'le values'#010+ + '**2Op','<x>_Set target cpu for optimizing, see fpc -i for possible valu'+ + 'es'#010+ + '**2OW<x>_Generate whole-program optimization feedback for optimization'+ + ' <x>, see fpc -i for possible values'#010+ + '**2Ow<x>_Perform whole-program optimization <x>, see fpc -i for pos','s'+ + 'ible values'#010+ '**2Os_Optimize for size rather than speed'#010+ - '**1pg_Generate profile code for gprof (defines FPC_PROFILE)',#010+ + '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+ 'F*1P<x>_Target CPU / compiler related options:'#010+ 'F*2PB_Show default compiler binary'#010+ 'F*2PP_Show default target cpu'#010+ - 'F*2P<x>_Set target CPU (arm,i386,m68k,mips,mipsel,powerpc,powerpc64,sp'+ - 'arc,x86_64'#010+ + 'F*2P<x>_Set t','arget CPU (arm,i386,m68k,mips,mipsel,powerpc,powerpc64,'+ + 'sparc,x86_64'#010+ '**1R<x>_Assembler reading style:'#010+ - '**2Rdefault_U','se default assembler for target'#010+ + '**2Rdefault_Use default assembler for target'#010+ '3*2Ratt_Read AT&T style assembler'#010+ '3*2Rintel_Read Intel style assembler'#010+ - '6*2RMOT_Read motorola style assembler'#010+ + '6*2RMOT_Read motorola s','tyle assembler'#010+ '**1S<x>_Syntax options:'#010+ '**2S2_Same as -Mobjfpc'#010+ '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+ - '**2','Sa_Turn on assertions'#010+ + '**2Sa_Turn on assertions'#010+ '**2Sd_Same as -Mdelphi'#010+ '**2Se<x>_Error options. <x> is a combination of the following:'#010+ - '**3*_<n> : Compiler halts after the <n> errors (default is 1)'#010+ + '**3*_<n> : Compile','r halts after the <n> errors (default is 1)'#010+ '**3*_w : Compiler also halts after warnings'#010+ - '**3*_n : Compiler also hal','ts after notes'#010+ + '**3*_n : Compiler also halts after notes'#010+ '**3*_h : Compiler also halts after hints'#010+ '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+ - '**2Sh_Use reference counted strings (ansistring by default) instead of'+ - ' shortstrings'#010+ - '**2Si_Turn on inlining of procedures/func','tions declared as "inline"'#010+ + '**2Sh_Use r','eference counted strings (ansistring by default) instead '+ + 'of shortstrings'#010+ + '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+ '**2Sk_Load fpcylix unit'#010+ '**2SI<x>_Set interface style to <x>'#010+ - '**3SIcom_COM compatible interface (default)'#010+ + '**3SIcom_COM compatible interface (defa','ult)'#010+ '**3SIcorba_CORBA compatible interface'#010+ '**2Sm_Support macros like C (global)'#010+ '**2So_Same as -Mtp'#010+ - '**2Ss_Construct','or name must be init (destructor must be done)'#010+ + '**2Ss_Constructor name must be init (destructor must be done)'#010+ '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+ - '**2Sy_@<pointer> returns a typed pointer, same as $T+'#010+ + '**2Sy_@<pointe','r> returns a typed pointer, same as $T+'#010+ '**1s_Do not call assembler and linker'#010+ - '**2sh_Generate script to link on hos','t'#010+ + '**2sh_Generate script to link on host'#010+ '**2st_Generate script to link on target'#010+ '**2sr_Skip register allocation phase (use with -alr)'#010+ - '**1T<x>_Target operating system:'#010+ + '**1T<x>_Target operating system',':'#010+ '3*2Tdarwin_Darwin/Mac OS X'#010+ '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+ '3*2Tfreebsd_FreeBSD'#010+ - '3*2Tgo32v2_Vers','ion 2 of DJ Delorie DOS extender'#010+ + '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+ '3*2Tiphonesim_ iPhoneSimulator from iOS SDK 3.2+ (older versions: -Tda'+ 'rwin)'#010+ '3*2Tlinux_Linux'#010+ - '3*2Tnativent_Native NT API (experimental)'#010+ + '3','*2Tnativent_Native NT API (experimental)'#010+ '3*2Tnetbsd_NetBSD'#010+ '3*2Tnetware_Novell Netware Module (clib)'#010+ - '3*2Tnetwlibc_N','ovell Netware Module (libc)'#010+ + '3*2Tnetwlibc_Novell Netware Module (libc)'#010+ '3*2Topenbsd_OpenBSD'#010+ '3*2Tos2_OS/2 / eComStation'#010+ '3*2Tsunos_SunOS/Solaris'#010+ '3*2Tsymbian_Symbian OS'#010+ - '3*2Tsolaris_Solaris'#010+ + '3*2T','solaris_Solaris'#010+ '3*2Twatcom_Watcom compatible DOS extender'#010+ '3*2Twdosx_WDOSX DOS extender'#010+ '3*2Twin32_Windows 32 Bit'#010+ - '3*','2Twince_Windows CE'#010+ + '3*2Twince_Windows CE'#010+ '4*2Tdarwin_Darwin/Mac OS X'#010+ '4*2Tlinux_Linux'#010+ '4*2Twin64_Win64 (64 bit Windows systems)'#010+ - '6*2Tamiga_Commodore Amiga'#010+ + '6*2Tamiga_Commodore Ami','ga'#010+ '6*2Tatari_Atari ST/STe/TT'#010+ '6*2Tlinux_Linux'#010+ '6*2Tpalmos_PalmOS'#010+ 'A*2Tdarwin_Darwin/iPhoneOS/iOS'#010+ 'A*2Tlinux_Linux'#010+ - 'A*2T','wince_Windows CE'#010+ + 'A*2Twince_Windows CE'#010+ 'P*2Tamiga_AmigaOS'#010+ 'P*2Tdarwin_Darwin/Mac OS X'#010+ 'P*2Tlinux_Linux'#010+ 'P*2Tmacos_Mac OS (classic)'#010+ 'P*2Tmorphos_MorphOS'#010+ - 'S*2Tsolaris_Solaris'#010+ + 'S','*2Tsolaris_Solaris'#010+ 'S*2Tlinux_Linux'#010+ '**1u<x>_Undefines the symbol <x>'#010+ '**1U_Unit options:'#010+ - '**2Un_Do not check where th','e unit name matches the file name'#010+ + '**2Un_Do not check where the unit name matches the file name'#010+ '**2Ur_Generate release unit files (never automatically recompiled)'#010+ - '**2Us_Compile a system unit'#010+ + '**2Us_Compile a system un','it'#010+ '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+ - '**2*_e : Show errors (default) 0 : Sho','w nothing (except errors'+ - ')'#010+ + '**2*_e : Show errors (default) 0 : Show nothing (except errors)'#010+ '**2*_w : Show warnings u : Show unit info'#010+ - '**2*_n : Show notes t : Show tried/used files'#010+ + '**2*_n : Show notes t : Sho','w tried/used files'#010+ '**2*_h : Show hints c : Show conditionals'#010+ - '**2*_i : Show general info ',' d : Show debug info'#010+ + '**2*_i : Show general info d : Show debug info'#010+ '**2*_l : Show linenumbers r : Rhide/GCC compatibility mode'#010+ - '**2*_s : Show time stamps q : Show message numbers'#010+ + '**2*_s : Show time stamps ',' q : Show message numbers'#010+ '**2*_a : Show everything x : Executable info (Win32 only)'#010+ - '**2*_b : Write fi','le names messages p : Write tree.log with parse t'+ - 'ree'#010+ + '**2*_b : Write file names messages p : Write tree.log with parse tre'+ + 'e'#010+ '**2*_ with full path v : Write fpcdebug.txt with'#010+ - '**2*_ lots of debugging info'#010+ - '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>',#010+ + '**2*_ ',' lots of debugging info'#010+ + '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+ 'F*1V<x>_Append '#039'-<x>'#039' to the used compiler binary name (e.g. f'+ 'or version)'#010+ '**1W<x>_Target-specific options (targets)'#010+ - '3*2WA_Specify native type application (Windows)'#010+ + '3*2WA_Spe','cify native type application (Windows)'#010+ '4*2WA_Specify native type application (Windows)'#010+ - 'A*2WA_Specify native type a','pplication (Windows)'#010+ + 'A*2WA_Specify native type application (Windows)'#010+ '3*2Wb_Create a bundle instead of a library (Darwin)'#010+ 'P*2Wb_Create a bundle instead of a library (Darwin)'#010+ - 'p*2Wb_Create a bundle instead of a library (Darwin)'#010+ + 'p','*2Wb_Create a bundle instead of a library (Darwin)'#010+ 'A*2Wb_Create a bundle instead of a library (Darwin)'#010+ - '4*2Wb_Creat','e a bundle instead of a library (Darwin)'#010+ + '4*2Wb_Create a bundle instead of a library (Darwin)'#010+ '3*2WB_Create a relocatable image (Windows, Symbian)'#010+ - '3*2WBxxxx_Set image base to xxxx (Windows, Symbian)'#010+ + '3*2WBxxxx_Set image base to xxxx ','(Windows, Symbian)'#010+ '4*2WB_Create a relocatable image (Windows)'#010+ '4*2WBxxxx_Set image base to xxxx (Windows)'#010+ - 'A*2WB_Cre','ate a relocatable image (Windows, Symbian)'#010+ + 'A*2WB_Create a relocatable image (Windows, Symbian)'#010+ 'A*2WBxxxx_Set image base to xxxx (Windows, Symbian)'#010+ - '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+ + '3*2WC_Specify console type appl','ication (EMX, OS/2, Windows)'#010+ '4*2WC_Specify console type application (EMX, OS/2, Windows)'#010+ - 'A*2WC_Specify console typ','e application (Windows)'#010+ + 'A*2WC_Specify console type application (Windows)'#010+ 'P*2WC_Specify console type application (Classic Mac OS)'#010+ - '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+ + '3*2WD_Use DEFFILE to export functions of DLL o','r EXE (Windows)'#010+ '4*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+ - 'A*2WD_Use DEFFILE to export function','s of DLL or EXE (Windows)'#010+ + 'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+ '3*2We_Use external resources (Darwin)'#010+ '4*2We_Use external resources (Darwin)'#010+ - 'A*2We_Use external resources (Darwin)'#010+ + 'A*2We_Use external resou','rces (Darwin)'#010+ 'P*2We_Use external resources (Darwin)'#010+ 'p*2We_Use external resources (Darwin)'#010+ - '3*2WF_Specify full-scree','n type application (EMX, OS/2)'#010+ + '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+ '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+ - '4*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+ + '4*2WG_Specify graphic type applicat','ion (EMX, OS/2, Windows)'#010+ 'A*2WG_Specify graphic type application (Windows)'#010+ - 'P*2WG_Specify graphic type application (','Classic Mac OS)'#010+ + 'P*2WG_Specify graphic type application (Classic Mac OS)'#010+ '3*2Wi_Use internal resources (Darwin)'#010+ '4*2Wi_Use internal resources (Darwin)'#010+ - 'A*2Wi_Use internal resources (Darwin)'#010+ + 'A*2Wi_Use internal resources (Darw','in)'#010+ 'P*2Wi_Use internal resources (Darwin)'#010+ 'p*2Wi_Use internal resources (Darwin)'#010+ - '3*2WI_Turn on/off the usage of imp','ort sections (Windows)'#010+ + '3*2WI_Turn on/off the usage of import sections (Windows)'#010+ '4*2WI_Turn on/off the usage of import sections (Windows)'#010+ - 'A*2WI_Turn on/off the usage of import sections (Windows)'#010+ + 'A*2WI_Turn on/off the usage of import sections',' (Windows)'#010+ '8*2Wm<x>_Set memory model'#010+ '8*3WmTiny_Tiny memory model'#010+ '8*3WmSmall_Small memory model (default)'#010+ - '8*3WmMedi','um_Medium memory model'#010+ + '8*3WmMedium_Medium memory model'#010+ '3*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ 'n)'#010+ - '4*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ - 'n)'#010+ + '4*2WM<x>_Minimum Mac OS X depl','oyment version: 10.4, 10.5.1, ... (Dar'+ + 'win)'#010+ 'p*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ - 'n',')'#010+ + 'n)'#010+ 'P*2WM<x>_Minimum Mac OS X deployment version: 10.4, 10.5.1, ... (Darwi'+ 'n)'#010+ - '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+ - '4*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+ - 'A*2WN_Do not generate rel','ocation code, needed for debugging (Windows'+ + '3*2WN_Do not generate relocation code, needed for d','ebugging (Windows'+ ')'#010+ + '4*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+ + 'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+ 'A*2Wpxxxx_Specify the controller type, see fpc -i for possible values'#010+ - 'V*2Wpxxxx_Specify the controller type, see fpc -i for possible values'#010+ - '3*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ..','. (iphonesim)'+ - #010+ + 'V*2Wpxxxx_S','pecify the controller type, see fpc -i for possible value'+ + 's'#010+ + '3*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... (iphonesim)'#010+ 'A*2WP<x>_Minimum iOS deployment version: 3.0, 5.0.1, ... (Darwin)'#010+ '3*2WR_Generate relocation code (Windows)'#010+ - '4*2WR_Generate relocation code (Windows)'#010+ + '4*2WR','_Generate relocation code (Windows)'#010+ 'A*2WR_Generate relocation code (Windows)'#010+ - 'P*2WT_Specify MPW tool type applicati','on (Classic Mac OS)'#010+ + 'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+ '**2WX_Enable executable stack (Linux)'#010+ '**1X_Executable options:'#010+ - '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+ - 'ux)'#010+ + '**2Xc_Pass --shared/-dynamic to the linker ','(BeOS, Darwin, FreeBSD, L'+ + 'inux)'#010+ '**2Xd_Do not search default library path (sometimes required for cross'+ - '-compiling wh','en not using -XR)'#010+ + '-compiling when not using -XR)'#010+ '**2Xe_Use external linker'#010+ '**2Xg_Create debuginfo in a separate file and add a debuglink section '+ - 'to executable'#010+ + 'to executabl','e'#010+ '**2XD_Try to link units dynamically (defines FPC_LINK_DYNAMIC)'#010+ '**2Xi_Use internal linker'#010+ - '**2Xm_Generate lin','k map'#010+ + '**2Xm_Generate link map'#010+ '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+ 's '#039'main'#039')'#010+ - 'F*2Xp<x>_First search for the compiler binary in the directory <x>'#010+ + 'F*2Xp<x>_First search for the compiler binary in',' the directory <x>'#010+ '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+ - '**2Xr<x>_Set the linker'#039's rlink-path to',' <x> (needed for cross co'+ - 'mpile, see the ld manual for more information) (BeOS, Linux)'#010+ - '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+ - ', Linux, Mac OS, Solaris)'#010+ + '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+ + 'ile, see the ld manual for more information) (BeOS, Linux)'#010+ + '**2XR<x>_Prepend <x> to all linker searc','h paths (BeOS, Darwin, FreeB'+ + 'SD, Linux, Mac OS, Solaris)'#010+ '**2Xs_Strip all symbols from executable'#010+ - '**2XS_Try to link ','units statically (default, defines FPC_LINK_STATIC'+ - ')'#010+ + '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+ '**2Xt_Link with static libraries (-static is passed to linker)'#010+ - '**2XX_Try to smartlink units (defines FPC_LINK_SMART)'#010+ + '**2XX_Try t','o smartlink units (defines FPC_LINK_SMART)'#010+ '**1*_'#010+ '**1?_Show this help'#010+ - '**1h_Shows this help without wait','ing' + '**1h_Shows this help without waiting' ); diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index a100f54f24..41b56f78a3 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -343,7 +343,7 @@ implementation if not(po_virtualmethod in tprocdef(propaccesslist.procdef).procoptions) or is_objectpascal_helper(tprocdef(propaccesslist.procdef).struct) then begin - current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname,0)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(propaccesslist.procdef).mangledname,AT_FUNCTION,0)); typvalue:=1; end else @@ -857,7 +857,7 @@ implementation if not is_objectpascal_helper(def) then if (oo_has_vmt in def.objectoptions) then - current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(def.vmt_mangledname,0)) + current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(def.vmt_mangledname,AT_DATA,0)) else current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_nil_dataptr); @@ -1307,7 +1307,7 @@ implementation function TRTTIWriter.ref_rtti(def:tdef;rt:trttitype):tasmsymbol; begin - result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)); + result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt),AT_DATA); if (cs_create_pic in current_settings.moduleswitches) and assigned(current_procinfo) then include(current_procinfo.flags,pi_needs_got); @@ -1343,7 +1343,7 @@ implementation function TRTTIWriter.get_rtti_label(def:tdef;rt:trttitype):tasmsymbol; begin - result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)); + result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt),AT_DATA); if (cs_create_pic in current_settings.moduleswitches) and assigned(current_procinfo) then include(current_procinfo.flags,pi_needs_got); @@ -1351,7 +1351,7 @@ implementation function TRTTIWriter.get_rtti_label_ord2str(def:tdef;rt:trttitype):tasmsymbol; begin - result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_o2s'); + result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_o2s',AT_DATA); if (cs_create_pic in current_settings.moduleswitches) and assigned(current_procinfo) then include(current_procinfo.flags,pi_needs_got); @@ -1359,7 +1359,7 @@ implementation function TRTTIWriter.get_rtti_label_str2ord(def:tdef;rt:trttitype):tasmsymbol; begin - result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_s2o'); + result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_s2o',AT_DATA); if (cs_create_pic in current_settings.moduleswitches) and assigned(current_procinfo) then include(current_procinfo.flags,pi_needs_got); diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index cc88e85a77..3e466b2156 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -77,7 +77,6 @@ interface function has_alias_name(pd:tprocdef;const s:string):boolean; procedure alloc_proc_symbol(pd: tprocdef); - procedure gen_proc_symbol(list:TAsmList); procedure gen_proc_entry_code(list:TAsmList); procedure gen_proc_exit_code(list:TAsmList); procedure gen_stack_check_size_para(list:TAsmList); @@ -1312,44 +1311,6 @@ implementation end; - procedure gen_proc_symbol(list:TAsmList); - var - item, - previtem : TCmdStrListItem; - begin - previtem:=nil; - item := TCmdStrListItem(current_procinfo.procdef.aliasnames.first); - while assigned(item) do - begin -{$ifdef arm} - if current_settings.cputype in cpu_thumb2+cpu_thumb then - list.concat(tai_thumb_func.create); -{$endif arm} - { "double link" all procedure entry symbols via .reference } - { directives on darwin, because otherwise the linker } - { sometimes strips the procedure if only on of the symbols } - { is referenced } - if assigned(previtem) and - (target_info.system in systems_darwin) then - list.concat(tai_directive.create(asd_reference,item.str)); - if (cs_profile in current_settings.moduleswitches) or - (po_global in current_procinfo.procdef.procoptions) then - list.concat(Tai_symbol.createname_global(item.str,AT_FUNCTION,0)) - else - list.concat(Tai_symbol.createname(item.str,AT_FUNCTION,0)); - if assigned(previtem) and - (target_info.system in systems_darwin) then - list.concat(tai_directive.create(asd_reference,previtem.str)); - if not(af_stabs_use_function_absolute_addresses in target_asm.flags) then - list.concat(Tai_function_name.create(item.str)); - previtem:=item; - item := TCmdStrListItem(item.next); - end; - current_procinfo.procdef.procstarttai:=tai(list.last); - end; - - - procedure gen_proc_entry_code(list:TAsmList); var hitemp, diff --git a/compiler/ncgvmt.pas b/compiler/ncgvmt.pas index c25f6a1de7..5dcad125eb 100644 --- a/compiler/ncgvmt.pas +++ b/compiler/ncgvmt.pas @@ -87,6 +87,7 @@ implementation function genintmsgtab(list : TAsmList) : tasmlabel; function genpublishedmethodstable(list : TAsmList) : tasmlabel; function generate_field_table(list : TAsmList) : tasmlabel; + procedure generate_abstract_stub(list:TAsmList;pd:tprocdef); {$ifdef WITHDMT} { generates a DMT for _class } function gendmt : tasmlabel; @@ -241,7 +242,7 @@ implementation list.concat(cai_align.create(const_align(sizeof(pint)))); list.concat(Tai_const.Create_sym(p^.nl)); list.concat(cai_align.create(const_align(sizeof(pint)))); - list.concat(Tai_const.Createname(p^.data.mangledname,0)); + list.concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0)); if assigned(p^.r) then writestrentry(list,p^.r); @@ -285,7 +286,7 @@ implementation list.concat(cai_align.create(const_align(sizeof(longint)))); list.concat(Tai_const.Create_32bit(p^.data.messageinf.i)); list.concat(cai_align.create(const_align(sizeof(pint)))); - list.concat(Tai_const.Createname(p^.data.mangledname,0)); + list.concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0)); if assigned(p^.r) then writeintentry(list,p^.r); @@ -448,7 +449,7 @@ implementation if po_abstractmethod in pd.procoptions then lists[0].concat(Tai_const.Create_nil_codeptr) else - lists[0].concat(Tai_const.Createname(pd.mangledname,0)); + lists[0].concat(Tai_const.Createname(pd.mangledname,AT_FUNCTION,0)); end; end; end; @@ -546,7 +547,7 @@ implementation if (tf_requires_proper_alignment in target_info.flags) then list.concat(cai_align.Create(sizeof(TConstPtrUInt))); for i:=0 to classtablelist.Count-1 do - list.concat(Tai_const.Createname(tobjectdef(classtablelist[i]).vmt_mangledname,0)); + list.concat(Tai_const.Createname(tobjectdef(classtablelist[i]).vmt_mangledname,AT_DATA,0)); result:=fieldtable; end else @@ -584,7 +585,7 @@ implementation hs:=make_mangledname('WRPR',_class.owner,_class.objname^+'_$_'+AImplIntf.IntfDef.objname^+'_$_'+ tostr(i)+'_$_'+pd.mangledname); { create reference } - rawdata.concat(Tai_const.Createname(hs,0)); + rawdata.concat(Tai_const.Createname(hs,AT_FUNCTION,0)); end; end; rawdata.concat(tai_symbol_end.createname(vtblstr)); @@ -598,12 +599,12 @@ implementation { GUID (or nil for Corba interfaces) } if AImplIntf.IntfDef.objecttype in [odt_interfacecom] then rawdata.concat(Tai_const.CreateName( - make_mangledname('IID',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),0)) + make_mangledname('IID',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0)) else rawdata.concat(Tai_const.Create_nil_dataptr); { VTable } - rawdata.concat(Tai_const.Createname(intf_get_vtbl_name(AImplIntf.VtblImplIntf),0)); + rawdata.concat(Tai_const.Createname(intf_get_vtbl_name(AImplIntf.VtblImplIntf),AT_DATA,0)); { IOffset field } case AImplIntf.VtblImplIntf.IType of etFieldValue, etFieldValueClass, @@ -612,6 +613,7 @@ implementation etStaticMethodResult, etStaticMethodClass: rawdata.concat(Tai_const.Createname( tprocdef(tpropertysym(AImplIntf.ImplementsGetter).propaccesslist[palt_read].procdef).mangledname, + AT_FUNCTION, 0 )); etVirtualMethodResult, etVirtualMethodClass: @@ -625,7 +627,7 @@ implementation { IIDStr } rawdata.concat(Tai_const.CreateName( - make_mangledname('IIDSTR',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),0)); + make_mangledname('IIDSTR',AImplIntf.IntfDef.owner,AImplIntf.IntfDef.objname^),AT_DATA,0)); { IType } rawdata.concat(Tai_const.Create_pint(aint(AImplIntf.VtblImplIntf.IType))); end; @@ -714,6 +716,35 @@ implementation end; + procedure TVMTWriter.generate_abstract_stub(list:TAsmList;pd:tprocdef); + var + sym: TAsmSymbol; + begin + { Generate stubs for abstract methods, so their symbols are present and + can be used e.g. to take address (see issue #24536). } + if (po_global in pd.procoptions) and + (pd.owner.defowner<>self._class) then + exit; + sym:=current_asmdata.GetAsmSymbol(pd.mangledname); + if assigned(sym) and (sym.bind<>AB_EXTERNAL) then + exit; + maybe_new_object_file(list); + new_section(list,sec_code,lower(pd.mangledname),target_info.alignment.procalign); + if (po_global in pd.procoptions) then + begin + sym:=current_asmdata.DefineAsmSymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION); + list.concat(Tai_symbol.Create_global(sym,0)); + end + else + begin + sym:=current_asmdata.DefineAsmSymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION); + list.concat(Tai_symbol.Create(sym,0)); + end; + cg.g_external_wrapper(list,pd,'FPC_ABSTRACTERROR'); + list.concat(Tai_symbol_end.Create(sym)); + end; + + procedure TVMTWriter.writevirtualmethods(List:TAsmList); var vmtpd : tprocdef; @@ -736,12 +767,15 @@ implementation if vmtpd.extnumber<>i then internalerror(200611083); if (po_abstractmethod in vmtpd.procoptions) then - procname:='FPC_ABSTRACTERROR' + begin + procname:='FPC_ABSTRACTERROR'; + generate_abstract_stub(current_asmdata.AsmLists[al_procedures],vmtpd); + end else if (cs_opt_remove_emtpy_proc in current_settings.optimizerswitches) and RedirectToEmpty(vmtpd) then procname:='FPC_EMPTYMETHOD' else if not wpoinfomanager.optimized_name_for_vmt(_class,vmtpd,procname) then procname:=vmtpd.mangledname; - List.concat(Tai_const.createname(procname,0)); + List.concat(Tai_const.createname(procname,AT_FUNCTION,0)); {$ifdef vtentry} hs:='VTENTRY'+'_'+_class.vmt_mangledname+'$$'+tostr(_class.vmtmethodoffset(i) div sizeof(pint)); current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0)); @@ -817,7 +851,7 @@ implementation { it is not written for parents that don't have any vmt !! } if assigned(_class.childof) and (oo_has_vmt in _class.childof.objectoptions) then - current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,0)) + current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,AT_DATA,0)) else current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr); @@ -832,9 +866,15 @@ implementation else current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr); { pointer to method table or nil } - current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(methodnametable)); + if assigned(methodnametable) then + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(methodnametable)) + else + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr); { pointer to field table } - current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(fieldtablelabel)); + if assigned(fieldtablelabel) then + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(fieldtablelabel)) + else + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr); { pointer to type info of published section } current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(RTTIWriter.get_rtti_label(_class,fullrtti))); { inittable for con-/destruction } @@ -850,7 +890,7 @@ implementation else if _class.implements_any_interfaces then current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr) else - current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol('FPC_EMPTYINTF'))); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol('FPC_EMPTYINTF',AT_DATA))); { table for string messages } if (oo_has_msgstr in _class.objectoptions) then current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(strmessagetable)) diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index b0ec85b48d..82b47a6f05 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -3567,11 +3567,11 @@ implementation are smaller than an entire register } if result and { don't try to check the size of an open array } - is_open_array(resultdef) or - (resultdef.size<left.resultdef.size) or - ((resultdef.size=left.resultdef.size) and - (left.resultdef.size<sizeof(aint)) and - (is_signed(resultdef) xor is_signed(left.resultdef))) then + (is_open_array(resultdef) or + (resultdef.size<left.resultdef.size) or + ((resultdef.size=left.resultdef.size) and + (left.resultdef.size<sizeof(aint)) and + (is_signed(resultdef) xor is_signed(left.resultdef)))) then make_not_regable(left,[ra_addr_regable]); end; diff --git a/compiler/ncon.pas b/compiler/ncon.pas index 3ab333b942..b9343e6a27 100644 --- a/compiler/ncon.pas +++ b/compiler/ncon.pas @@ -912,14 +912,16 @@ implementation procedure tstringconstnode.buildderefimpl; begin inherited buildderefimpl; - astringdefderef.build(astringdef); + if cst_type=cst_ansistring then + astringdefderef.build(astringdef); end; procedure tstringconstnode.derefimpl; begin inherited derefimpl; - astringdef:=tdef(astringdefderef.resolve); + if cst_type=cst_ansistring then + astringdef:=tdef(astringdefderef.resolve); end; diff --git a/compiler/ngenutil.pas b/compiler/ngenutil.pas index 0700adbb0d..e18358b457 100644 --- a/compiler/ngenutil.pas +++ b/compiler/ngenutil.pas @@ -55,7 +55,8 @@ interface strict protected { called from wrap_proc_body to insert the trashing for the wrapped routine's local variables and parameters } - class function maybe_insert_trashing(pd: tprocdef; n: tnode): tnode; virtual; + class function maybe_insert_trashing(pd: tprocdef; n: tnode): tnode; + class function check_insert_trashing(pd: tprocdef): boolean; virtual; { callback called for every local variable and parameter by maybe_insert_trashing(), calls through to maybe_trash_variable() } class procedure maybe_trash_variable_callback(p: TObject; statn: pointer); @@ -330,8 +331,7 @@ implementation stat: tstatementnode; begin result:=n; - if (localvartrashing<>-1) and - not(po_assembler in pd.procoptions) then + if check_insert_trashing(pd) then begin result:=internalstatements(stat); pd.parast.SymList.ForEachCall(@maybe_trash_variable_callback,@stat); @@ -340,6 +340,13 @@ implementation end; end; + class function tnodeutils.check_insert_trashing(pd: tprocdef): boolean; + begin + result:= + (localvartrashing<>-1) and + not(po_assembler in pd.procoptions); + end; + class function tnodeutils.trashable_sym(p: tsym): boolean; begin @@ -572,14 +579,14 @@ implementation begin pd := tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_constructor); if assigned(pd) then - unitinits.concat(Tai_const.Createname(pd.mangledname,0)) + unitinits.concat(Tai_const.Createname(pd.mangledname,AT_FUNCTION,0)) else - unitinits.concat(Tai_const.Create_pint(0)); + unitinits.concat(Tai_const.Create_nil_codeptr); pd := tabstractrecorddef(structlist[i]).find_procdef_bytype(potype_class_destructor); if assigned(pd) then - unitinits.concat(Tai_const.Createname(pd.mangledname,0)) + unitinits.concat(Tai_const.Createname(pd.mangledname,AT_FUNCTION,0)) else - unitinits.concat(Tai_const.Create_pint(0)); + unitinits.concat(Tai_const.Create_nil_codeptr); inc(count); end; structlist.free; @@ -598,13 +605,13 @@ implementation if (hp.u.flags and (uf_init or uf_finalize))<>0 then begin if (hp.u.flags and uf_init)<>0 then - unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',hp.u.globalsymtable,''),0)) + unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',hp.u.globalsymtable,''),AT_FUNCTION,0)) else - unitinits.concat(Tai_const.Create_sym(nil)); + unitinits.concat(Tai_const.Create_nil_codeptr); if (hp.u.flags and uf_finalize)<>0 then - unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',hp.u.globalsymtable,''),0)) + unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',hp.u.globalsymtable,''),AT_FUNCTION,0)) else - unitinits.concat(Tai_const.Create_sym(nil)); + unitinits.concat(Tai_const.Create_nil_codeptr); inc(count); end; hp:=tused_unit(hp.next); @@ -616,13 +623,13 @@ implementation if (current_module.flags and (uf_init or uf_finalize))<>0 then begin if (current_module.flags and uf_init)<>0 then - unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',current_module.localsymtable,''),0)) + unitinits.concat(Tai_const.Createname(make_mangledname('INIT$',current_module.localsymtable,''),AT_FUNCTION,0)) else - unitinits.concat(Tai_const.Create_sym(nil)); + unitinits.concat(Tai_const.Create_nil_codeptr); if (current_module.flags and uf_finalize)<>0 then - unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',current_module.localsymtable,''),0)) + unitinits.concat(Tai_const.Createname(make_mangledname('FINALIZE$',current_module.localsymtable,''),AT_FUNCTION,0)) else - unitinits.concat(Tai_const.Create_sym(nil)); + unitinits.concat(Tai_const.Create_nil_codeptr); inc(count); end; { Insert TableCount,InitCount at start } @@ -824,8 +831,8 @@ implementation begin If (hp.flags and uf_has_resourcestrings)=uf_has_resourcestrings then begin - ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'START'),0)); - ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'END'),0)); + ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'START'),AT_DATA,0)); + ResourceStringTables.concat(Tai_const.Createname(make_mangledname('RESSTR',hp.localsymtable,'END'),AT_DATA,0)); inc(count); end; hp:=tmodule(hp.next); diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 224edde123..61e6831e08 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -1553,8 +1553,9 @@ implementation { the shortstring-longint val routine by default } if (sourcepara.resultdef.typ = stringdef) then procname := procname + tstringdef(sourcepara.resultdef).stringtypname - { zero-based arrays (of char) can be implicitely converted to ansistring } - else if is_zero_based_array(sourcepara.resultdef) then + { zero-based arrays (of char) can be implicitely converted to ansistring, but don't do + so if not needed because the array is too short } + else if is_zero_based_array(sourcepara.resultdef) and (sourcepara.resultdef.size>255) then procname := procname + 'ansistr' else procname := procname + 'shortstr'; diff --git a/compiler/options.pas b/compiler/options.pas index 93699fc6cc..3ba1084307 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -892,6 +892,20 @@ begin exclude(init_settings.localswitches,cs_check_io) else include(init_settings.localswitches,cs_check_io); +{$ifdef arm} + 'I' : + begin + if (upper(copy(more,j+1,length(more)-j))='THUMB') and + { does selected CPU really understand thumb? } + (init_settings.cputype in cpu_has_thumb) then + init_settings.instructionset:=is_thumb + else if upper(copy(more,j+1,length(more)-j))='ARM' then + init_settings.instructionset:=is_arm + else + IllegalPara(opt); + break; + end; +{$endif arm} 'n' : If UnsetBool(More, j, opt, false) then exclude(init_settings.globalswitches,cs_link_nolink) @@ -915,7 +929,7 @@ begin 'p' : begin s:=upper(copy(more,j+1,length(more)-j)); - if not(Setcputype(s,init_settings.cputype)) then + if not(Setcputype(s,init_settings)) then IllegalPara(opt); CPUSetExplicitly:=true; break; @@ -1404,7 +1418,7 @@ begin include(init_settings.optimizerswitches,cs_opt_size); 'p' : begin - if not Setcputype(copy(more,j+1,length(more)),init_settings.optimizecputype) then + if not Setoptimizecputype(copy(more,j+1,length(more)),init_settings.optimizecputype) then begin OptCPUSetExplicitly:=true; { Give warning for old i386 switches } @@ -1847,6 +1861,7 @@ begin end; 'm': begin +{$if defined(i8086)} if (target_info.system in [system_i8086_msdos]) then begin case Upper(Copy(More,j+1,255)) of @@ -1862,6 +1877,7 @@ begin break; end else +{$endif defined(i8086)} IllegalPara(opt); end; 'M': @@ -3225,7 +3241,7 @@ begin { Force use of external linker if there is no internal linker or the linking is skipped } if not(cs_link_extern in init_settings.globalswitches) and - (not assigned(target_info.link) or + ((target_info.link=ld_none) or (cs_link_nolink in init_settings.globalswitches)) then include(init_settings.globalswitches,cs_link_extern); @@ -3322,14 +3338,14 @@ if (target_info.abi = abi_eabihf) then {$endif CPUARMV6} end; - if init_settings.cputype in cpu_thumb then + if (init_settings.instructionset=is_thumb) and not(CPUARM_HAS_THUMB2 in cpu_capabilities[init_settings.cputype]) then begin def_system_macro('CPUTHUMB'); if not option.FPUSetExplicitly then init_settings.fputype:=fpu_soft; end; - if init_settings.cputype in cpu_thumb2 then + if (init_settings.instructionset=is_thumb) and (CPUARM_HAS_THUMB2 in cpu_capabilities[init_settings.cputype]) then def_system_macro('CPUTHUMB2'); {$endif arm} @@ -3408,7 +3424,9 @@ if (target_info.abi = abi_eabihf) then { it is determined during system unit compilation if clz is used for bsf or not, this is not perfect but the current implementation bsf/bsr does not allow another solution } - if CPUARM_HAS_CLZ in cpu_capabilities[init_settings.cputype] then + if (CPUARM_HAS_CLZ in cpu_capabilities[init_settings.cputype]) and + ((init_settings.instructionset=is_arm) or + (CPUARM_HAS_THUMB2 in cpu_capabilities[init_settings.cputype])) then begin def_system_macro('FPC_HAS_INTERNAL_BSR'); if CPUARM_HAS_RBIT in cpu_capabilities[init_settings.cputype] then diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index ebb7e37f8c..b01311e9e4 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -103,7 +103,7 @@ implementation { parameter handling } paramgr,cpupara, { pass 1 } - fmodule,node,htypechk,ncon, + fmodule,node,htypechk,ncon,ppu, objcutil, { parser } scanner, @@ -908,6 +908,14 @@ implementation searchagain:=true; end else + if (m_delphi in current_settings.modeswitches) and + (srsym.typ=absolutevarsym) and + ([vo_is_funcret,vo_is_result]*tabstractvarsym(srsym).varoptions=[vo_is_funcret]) then + begin + HideSym(srsym); + searchagain:=true; + end + else begin { we use a different error message for tp7 so it looks more compatible } if (m_fpc in current_settings.modeswitches) then @@ -1078,6 +1086,13 @@ implementation end; single_type(pd.returndef,[stoAllowSpecialization]); +// Issue #24863, commented out for now because it breaks building of RTL and needs extensive +// testing and/or RTL patching. +{ + if ((pd.returndef=cvarianttype) or (pd.returndef=colevarianttype)) and + not(cs_compilesystem in current_settings.moduleswitches) then + current_module.flags:=current_module.flags or uf_uses_variants; +} if is_dispinterface(pd.struct) and not is_automatable(pd.returndef) then Message1(type_e_not_automatable,pd.returndef.typename); diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index a403c0a066..0e0138ac68 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -337,8 +337,8 @@ implementation begin if not(assigned(exit_procinfo.nestedexitlabel)) then begin - include(exit_procinfo.flags,pi_has_nested_exit); - exclude(exit_procinfo.procdef.procoptions,po_inline); + include(current_procinfo.flags,pi_has_nested_exit); + exclude(current_procinfo.procdef.procoptions,po_inline); exit_procinfo.nestedexitlabel:=tlabelsym.create('$nestedexit'); @@ -907,6 +907,8 @@ implementation function maybe_load_methodpointer(st:TSymtable;var p1:tnode):boolean; + var + pd: tprocdef; begin maybe_load_methodpointer:=false; if not assigned(p1) then @@ -920,12 +922,19 @@ implementation ObjectSymtable, recordsymtable: begin - { We are calling from the static class method which has no self node } - if assigned(current_procinfo) and current_procinfo.procdef.no_self_node then - if st.symtabletype=recordsymtable then - p1:=ctypenode.create(current_procinfo.procdef.struct) - else - p1:=cloadvmtaddrnode.create(ctypenode.create(current_procinfo.procdef.struct)) + { Escape nested procedures } + if assigned(current_procinfo) then + begin + pd:=current_procinfo.get_normal_proc.procdef; + { We are calling from the static class method which has no self node } + if assigned(pd) and pd.no_self_node then + if st.symtabletype=recordsymtable then + p1:=ctypenode.create(pd.struct) + else + p1:=cloadvmtaddrnode.create(ctypenode.create(pd.struct)) + else + p1:=load_self_node; + end else p1:=load_self_node; { We are calling a member } @@ -1288,7 +1297,7 @@ implementation if assigned(p1) and ( is_self_node(p1) or - (assigned(current_procinfo) and (current_procinfo.procdef.no_self_node) and + (assigned(current_procinfo) and (current_procinfo.get_normal_proc.procdef.no_self_node) and (current_procinfo.procdef.struct=structh))) then Message(parser_e_only_class_members) else @@ -1400,8 +1409,8 @@ implementation if assigned(srsym) then begin check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg); - consume(_ID); - do_member_read(tabstractrecorddef(hdef),getaddr,srsym,result,again,[]); + consume(_ID); + do_member_read(tabstractrecorddef(hdef),getaddr,srsym,result,again,[]); end else Message1(sym_e_id_no_member,orgpattern); @@ -2404,11 +2413,12 @@ implementation end; var - srsym : tsym; - srsymtable : TSymtable; - hdef : tdef; + srsym: tsym; + srsymtable: TSymtable; + hdef: tdef; + pd: tprocdef; orgstoredpattern, - storedpattern : string; + storedpattern: string; callflags: tcallnodeflags; t : ttoken; unit_found : boolean; @@ -2566,10 +2576,18 @@ implementation else p1:=cloadvmtaddrnode.create(ctypenode.create(hdef)) else - if assigned(current_procinfo) and current_procinfo.procdef.no_self_node then - p1:=cloadvmtaddrnode.create(ctypenode.create(current_procinfo.procdef.struct)) - else - p1:=load_self_node; + begin + if assigned(current_procinfo) then + begin + pd:=current_procinfo.get_normal_proc.procdef; + if assigned(pd) and pd.no_self_node then + p1:=cloadvmtaddrnode.create(ctypenode.create(pd.struct)) + else + p1:=load_self_node; + end + else + p1:=load_self_node; + end; { now, if the field itself is part of an objectsymtab } { (it can be even if it was found in a withsymtable, } { e.g., "with classinstance do field := 5"), then } @@ -2664,12 +2682,10 @@ implementation begin if (srsymtable.symtabletype in [ObjectSymtable,recordsymtable]) then { if we are accessing a owner procsym from the nested } - { class we need to call it as a class member } - if assigned(current_structdef) and (current_structdef<>hdef) and is_owned_by(current_structdef,hdef) then - p1:=cloadvmtaddrnode.create(ctypenode.create(hdef)) - else - if assigned(current_procinfo) and current_procinfo.procdef.no_self_node then - { no self node in static class methods } + { class or from a static class method we need to call } + { it as a class member } + if (assigned(current_structdef) and (current_structdef<>hdef) and is_owned_by(current_structdef,hdef)) or + (assigned(current_procinfo) and current_procinfo.get_normal_proc.procdef.no_self_node) then p1:=cloadvmtaddrnode.create(ctypenode.create(hdef)) else p1:=load_self_node; @@ -2788,6 +2804,15 @@ implementation factor_read_set:=buildp; end; + function can_load_self_node: boolean; + begin + result:=false; + if (block_type in [bt_const,bt_type,bt_const_type,bt_var_type]) or + not assigned(current_structdef) or + not assigned(current_procinfo) then + exit; + result:=not current_procinfo.get_normal_proc.procdef.no_self_node; + end; {--------------------------------------------- Factor (Main) @@ -2822,9 +2847,7 @@ implementation begin again:=true; { Handle references to self } - if (idtoken=_SELF) and - not(block_type in [bt_const,bt_type,bt_const_type,bt_var_type]) and - assigned(current_structdef) then + if (idtoken=_SELF) and can_load_self_node then begin p1:=load_self_node; consume(_ID); diff --git a/compiler/pgenutil.pas b/compiler/pgenutil.pas index 225b2fedc8..af6f34ba94 100644 --- a/compiler/pgenutil.pas +++ b/compiler/pgenutil.pas @@ -1009,6 +1009,10 @@ uses for i:=firstidx to result.count-1 do ttypesym(result[i]).typedef:=basedef; + { we need a typesym in case we do a Delphi-mode inline + specialization with this parameter; so just use the first sym } + if not assigned(basedef.typesym) then + basedef.typesym:=ttypesym(result[firstidx]); firstidx:=result.count; constraintdata.free; diff --git a/compiler/powerpc/agppcmpw.pas b/compiler/powerpc/agppcmpw.pas index 9c03b7e97e..05486a1d4a 100644 --- a/compiler/powerpc/agppcmpw.pas +++ b/compiler/powerpc/agppcmpw.pas @@ -1036,7 +1036,7 @@ interface //Procedure entry points: if not macos_direct_globals then begin - WriteDataHeader(s, tai_label(hp).is_global, true); + WriteDataHeader(s, tai_label(hp).labsym.bind in [AB_GLOBAL,AB_PRIVATE_EXTERN], true); end else begin diff --git a/compiler/ppcgen/cgppc.pas b/compiler/ppcgen/cgppc.pas index 6628a0f002..236a01e371 100644 --- a/compiler/ppcgen/cgppc.pas +++ b/compiler/ppcgen/cgppc.pas @@ -320,13 +320,13 @@ unit cgppc; else stubalign:=16; new_section(current_asmdata.asmlists[al_imports],sec_stub,'',stubalign); - result := current_asmdata.RefAsmSymbol(stubname); + result := current_asmdata.DefineAsmSymbol(stubname,AB_LOCAL,AT_FUNCTION); current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0)); { register as a weak symbol if necessary } if weak then current_asmdata.weakrefasmsymbol(s); current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); - l1 := current_asmdata.RefAsmSymbol('L'+s+'$lazy_ptr'); + l1 := current_asmdata.DefineAsmSymbol('L'+s+'$lazy_ptr',AB_LOCAL,AT_DATA); reference_reset_symbol(href,l1,0,sizeof(pint)); href.refaddr := addr_higha; if (cs_create_pic in current_settings.moduleswitches) then diff --git a/compiler/ppu.pas b/compiler/ppu.pas index 8442182b24..d361fb8c50 100644 --- a/compiler/ppu.pas +++ b/compiler/ppu.pas @@ -43,7 +43,7 @@ type {$endif Test_Double_checksum} const - CurrentPPUVersion = 162; + CurrentPPUVersion = 163; { buffer sizes } maxentrysize = 1024; @@ -162,6 +162,9 @@ const uf_wideinits = $400000; { this unit has winlike widestring typed constants } uf_classinits = $800000; { this unit has class constructors/destructors } uf_resstrinits = $1000000; { this unit has string consts referencing resourcestrings } + uf_i8086_far_code = $2000000; { this unit uses an i8086 memory model with far code (i.e. medium, large or huge) } + uf_i8086_far_data = $4000000; { this unit uses an i8086 memory model with far data (i.e. compact or large) } + uf_i8086_huge_data = $8000000; { this unit uses an i8086 memory model with huge data (i.e. huge) } {$ifdef generic_cpu} { We need to use the correct size of aint and pint for diff --git a/compiler/procinfo.pas b/compiler/procinfo.pas index a697bdad20..dc9fb04acd 100644 --- a/compiler/procinfo.pas +++ b/compiler/procinfo.pas @@ -52,6 +52,9 @@ unit procinfo; { This object gives information on the current routine being compiled. } + + { tprocinfo } + tprocinfo = class(tlinkedlistitem) private { list to store the procinfo's of the nested procedures } @@ -165,6 +168,7 @@ unit procinfo; function get_first_nestedproc: tprocinfo; function has_nestedprocs: boolean; + function get_normal_proc: tprocinfo; { Add to parent's list of nested procedures even if parent is a 'main' procedure } procedure force_nested; @@ -268,6 +272,13 @@ implementation result:=assigned(nestedprocs) and (nestedprocs.count>0); end; + function tprocinfo.get_normal_proc: tprocinfo; + begin + result:=self; + while assigned(result.parent)and(result.procdef.parast.symtablelevel>normal_function_level) do + result:=result.parent; + end; + procedure tprocinfo.save_jump_labels(out saved: tsavedlabels); begin saved[false]:=CurrFalseLabel; diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index 1c384a3cc3..699bf898d1 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -53,7 +53,7 @@ implementation nutils,ngenutil,nbas,nmat,nadd,ncal,nmem,nset,ncnv,ninl,ncon,nld,nflw, { parser } scanner, - pbase,pexpr, + pbase,ptype,pexpr, { codegen } procinfo,cgbase, { assembler reader } @@ -825,6 +825,18 @@ implementation function try_statement : tnode; + + procedure check_type_valid(var def: tdef); + begin + if not (is_class(def) or is_javaclass(def) or + { skip showing error message the second time } + (def.typ=errordef)) then + begin + Message1(type_e_class_type_expected,def.typename); + def:=generrordef; + end; + end; + var p_try_block,p_finally_block,first,last, p_default,p_specific,hp : tnode; @@ -900,22 +912,9 @@ implementation { is a explicit name for the exception given ? } if try_to_consume(_COLON) then begin - consume_sym(srsym,srsymtable); - if (srsym.typ=typesym) and - (is_class(ttypesym(srsym).typedef) or - is_javaclass(ttypesym(srsym).typedef)) then - begin - ot:=ttypesym(srsym).typedef; - sym:=tlocalvarsym.create(objrealname,vs_value,ot,[]); - end - else - begin - sym:=tlocalvarsym.create(objrealname,vs_value,generrordef,[]); - if (srsym.typ=typesym) then - Message1(type_e_class_type_expected,ttypesym(srsym).typedef.typename) - else - Message1(type_e_class_type_expected,ot.typename); - end; + single_type(ot,[]); + check_type_valid(ot); + sym:=tlocalvarsym.create(objrealname,vs_value,ot,[]); end else begin @@ -933,19 +932,19 @@ implementation consume(t); { check if type is valid, must be done here because with "e: Exception" the e is not necessary } - if (srsym.typ=typesym) and - (is_class(ttypesym(srsym).typedef) or - is_javaclass(ttypesym(srsym).typedef)) then - ot:=ttypesym(srsym).typedef + if (srsym.typ=typesym) then + begin + ot:=ttypesym(srsym).typedef; + parse_nested_types(ot,false,nil); + check_type_valid(ot); + end else begin - ot:=generrordef; - if (srsym.typ=typesym) then - Message1(type_e_class_type_expected,ttypesym(srsym).typedef.typename) - else - Message1(type_e_class_type_expected,ot.typename); + Message(type_e_type_id_expected); + ot:=generrordef; end; - { create dummy symbol so we don't need a special + + { create dummy symbol so we don't need a special case in ncgflw, and so that we always know the type } sym:=tlocalvarsym.create('$exceptsym',vs_value,ot,[]); diff --git a/compiler/psub.pas b/compiler/psub.pas index c6f819eb1a..9ca539793f 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -957,7 +957,7 @@ implementation {$if defined(arm)} { frame and stack pointer must be always the same on arm thumb so it makes no sense to fiddle with a frame pointer } - if current_settings.cputype in cpu_thumb then + if GenerateThumbCode then begin framepointer:=NR_STACK_POINTER_REG; tg.direction:=1; diff --git a/compiler/psystem.pas b/compiler/psystem.pas index 6d16983344..2ff946a189 100644 --- a/compiler/psystem.pas +++ b/compiler/psystem.pas @@ -683,8 +683,6 @@ implementation aiclass[ait_stab]:=tai_stab; aiclass[ait_force_line]:=tai_force_line; aiclass[ait_function_name]:=tai_function_name; - aiclass[ait_ent]:=tai_ent; - aiclass[ait_ent_end]:=tai_ent_end; {$ifdef alpha} { the follow is for the DEC Alpha } aiclass[ait_frame]:=tai_frame; diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 3aad0b79e3..5cc93d7d7f 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -49,6 +49,9 @@ interface { reads any type declaration } procedure read_anon_type(var def : tdef;parseprocvardir:boolean); + { parse nested type declaration of the def (typedef) } + procedure parse_nested_types(var def: tdef; isforwarddef: boolean; currentstructstack: tfpobjectlist); + { add a definition for a method to a record/objectdef that will contain all code for initialising typed constants (only for targets in diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 0555b1d4c5..e91820c5a0 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -844,6 +844,150 @@ In case not, the value returned can be arbitrary. current_scanner.preproc_token:=current_scanner.readpreproc; end; + function try_consume_unitsym(var srsym:tsym;var srsymtable:TSymtable;var tokentoconsume:ttoken):boolean; + var + hmodule: tmodule; + ns:ansistring; + nssym:tsym; + begin + result:=false; + tokentoconsume:=_ID; + + if assigned(srsym) and (srsym.typ in [unitsym,namespacesym]) then + begin + if not(srsym.owner.symtabletype in [staticsymtable,globalsymtable]) then + internalerror(200501154); + { only allow unit.symbol access if the name was + found in the current module + we can use iscurrentunit because generic specializations does not + change current_unit variable } + hmodule:=find_module_from_symtable(srsym.Owner); + if not Assigned(hmodule) then + internalerror(201001120); + if hmodule.unit_index=current_filepos.moduleindex then + begin + preproc_consume(_POINT); + current_scanner.skipspace; + if srsym.typ=namespacesym then + begin + ns:=srsym.name; + nssym:=srsym; + while assigned(srsym) and (srsym.typ=namespacesym) do + begin + { we have a namespace. the next identifier should be either a namespace or a unit } + searchsym_in_module(hmodule,ns+'.'+current_scanner.preproc_pattern,srsym,srsymtable); + if assigned(srsym) and (srsym.typ in [namespacesym,unitsym]) then + begin + ns:=ns+'.'+current_scanner.preproc_pattern; + nssym:=srsym; + preproc_consume(_ID); + current_scanner.skipspace; + preproc_consume(_POINT); + current_scanner.skipspace; + end; + end; + { check if there is a hidden unit with this pattern in the namespace } + if not assigned(srsym) and + assigned(nssym) and (nssym.typ=namespacesym) and assigned(tnamespacesym(nssym).unitsym) then + srsym:=tnamespacesym(nssym).unitsym; + if assigned(srsym) and (srsym.typ<>unitsym) then + internalerror(201108260); + if not assigned(srsym) then + begin + result:=true; + srsymtable:=nil; + exit; + end; + end; + case current_scanner.preproc_token of + _ID: + { system.char? (char=widechar comes from the implicit + uuchar unit -> override) } + if (current_scanner.preproc_pattern='CHAR') and + (tmodule(tunitsym(srsym).module).globalsymtable=systemunit) then + begin + if m_default_unicodestring in current_settings.modeswitches then + searchsym_in_module(tunitsym(srsym).module,'WIDECHAR',srsym,srsymtable) + else + searchsym_in_module(tunitsym(srsym).module,'ANSICHAR',srsym,srsymtable) + end + else + searchsym_in_module(tunitsym(srsym).module,current_scanner.preproc_pattern,srsym,srsymtable); + _STRING: + begin + { system.string? } + if tmodule(tunitsym(srsym).module).globalsymtable=systemunit then + begin + if cs_refcountedstrings in current_settings.localswitches then + begin + if m_default_unicodestring in current_settings.modeswitches then + searchsym_in_module(tunitsym(srsym).module,'UNICODESTRING',srsym,srsymtable) + else + searchsym_in_module(tunitsym(srsym).module,'ANSISTRING',srsym,srsymtable) + end + else + searchsym_in_module(tunitsym(srsym).module,'SHORTSTRING',srsym,srsymtable); + tokentoconsume:=_STRING; + end; + end + end; + end + else + begin + srsym:=nil; + srsymtable:=nil; + end; + result:=true; + end; + end; + + procedure try_consume_nestedsym(var srsym:tsym;var srsymtable:TSymtable); + var + def:tdef; + tokentoconsume:ttoken; + found:boolean; + begin + found:=try_consume_unitsym(srsym,srsymtable,tokentoconsume); + if found then + begin + preproc_consume(tokentoconsume); + current_scanner.skipspace; + end; + while (current_scanner.preproc_token=_POINT) do + begin + if assigned(srsym)and(srsym.typ=typesym) then + begin + def:=ttypesym(srsym).typedef; + if is_class_or_object(def) or is_record(def) or is_java_class_or_interface(def) then + begin + preproc_consume(_POINT); + current_scanner.skipspace; + if def.typ=objectdef then + found:=searchsym_in_class(tobjectdef(def),tobjectdef(def),current_scanner.preproc_pattern,srsym,srsymtable,true) + else + found:=searchsym_in_record(trecorddef(def),current_scanner.preproc_pattern,srsym,srsymtable); + if not found then + begin + Message1(sym_e_id_not_found,current_scanner.preproc_pattern); + exit; + end; + preproc_consume(_ID); + current_scanner.skipspace; + end + else + begin + Message(sym_e_type_must_be_rec_or_object_or_class); + exit; + end; + end + else + begin + Message(type_e_type_id_expected); + exit; + end; + end; + end; + function preproc_substitutedtoken(var macroType: TCTETypeSet; eval : Boolean): string; { Currently this parses identifiers as well as numbers. The result from this procedure can either be that the token @@ -941,7 +1085,7 @@ In case not, the value returned can be arbitrary. function read_factor(var factorType: TCTETypeSet; eval : Boolean) : string; var - hs,countstr : string; + hs,countstr,storedpattern: string; mac: tmacro; srsym : tsym; srsymtable : TSymtable; @@ -950,7 +1094,6 @@ In case not, the value returned can be arbitrary. w : integer; hasKlammer: Boolean; setElemType : TCTETypeSet; - begin read_factor:=''; if current_scanner.preproc_token=_ID then @@ -1069,27 +1212,30 @@ In case not, the value returned can be arbitrary. else Message(scan_e_preproc_syntax_error); + storedpattern:=current_scanner.preproc_pattern; + preproc_consume(_ID); + current_scanner.skipspace; + if eval then - if searchsym(current_scanner.preproc_pattern,srsym,srsymtable) then + if searchsym(storedpattern,srsym,srsymtable) then begin + try_consume_nestedsym(srsym,srsymtable); l:=0; - case srsym.typ of - staticvarsym, - localvarsym, - paravarsym : - l:=tabstractvarsym(srsym).getsize; - typesym: - l:=ttypesym(srsym).typedef.size; - else - Message(scan_e_error_in_preproc_expr); - end; + if assigned(srsym) then + case srsym.typ of + staticvarsym, + localvarsym, + paravarsym : + l:=tabstractvarsym(srsym).getsize; + typesym: + l:=ttypesym(srsym).typedef.size; + else + Message(scan_e_error_in_preproc_expr); + end; str(l,read_factor); end else - Message1(sym_e_id_not_found,current_scanner.preproc_pattern); - - preproc_consume(_ID); - current_scanner.skipspace; + Message1(sym_e_id_not_found,storedpattern); if current_scanner.preproc_token =_RKLAMMER then preproc_consume(_RKLAMMER) @@ -1110,23 +1256,29 @@ In case not, the value returned can be arbitrary. else Message(scan_e_preproc_syntax_error); + storedpattern:=current_scanner.preproc_pattern; + preproc_consume(_ID); + current_scanner.skipspace; + if eval then - if searchsym(current_scanner.preproc_pattern,srsym,srsymtable) then + if searchsym(storedpattern,srsym,srsymtable) then begin + try_consume_nestedsym(srsym,srsymtable); hdef:=nil; hs:=''; l:=0; - case srsym.typ of - staticvarsym, - localvarsym, - paravarsym : - hdef:=tabstractvarsym(srsym).vardef; - typesym: - hdef:=ttypesym(srsym).typedef; - else - Message(scan_e_error_in_preproc_expr); - end; - if hdef<>nil then + if assigned(srsym) then + case srsym.typ of + staticvarsym, + localvarsym, + paravarsym : + hdef:=tabstractvarsym(srsym).vardef; + typesym: + hdef:=ttypesym(srsym).typedef; + else + Message(scan_e_error_in_preproc_expr); + end; + if assigned(hdef) then begin if hdef.typ=setdef then hdef:=tsetdef(hdef).elementdef; @@ -1159,10 +1311,7 @@ In case not, the value returned can be arbitrary. read_factor:=hs; end else - Message1(sym_e_id_not_found,current_scanner.preproc_pattern); - - preproc_consume(_ID); - current_scanner.skipspace; + Message1(sym_e_id_not_found,storedpattern); if current_scanner.preproc_token =_RKLAMMER then preproc_consume(_RKLAMMER) @@ -1278,69 +1427,72 @@ In case not, the value returned can be arbitrary. { Default is to return the original symbol } read_factor:=hs; + storedpattern:=current_scanner.preproc_pattern; + preproc_consume(_ID); + current_scanner.skipspace; if eval and ([m_delphi,m_objfpc]*current_settings.modeswitches<>[]) and (ctetString in factorType) then - if searchsym(current_scanner.preproc_pattern,srsym,srsymtable) then + if searchsym(storedpattern,srsym,srsymtable) then begin - case srsym.typ of - constsym : - begin - with tconstsym(srsym) do - begin - case consttyp of - constord : - begin - case constdef.typ of - orddef: - begin - if is_integer(constdef) then - begin - read_factor:=tostr(value.valueord); - factorType:= [ctetInteger]; - end - else if is_boolean(constdef) then - begin - read_factor:=tostr(value.valueord); - factorType:= [ctetBoolean]; - end - else if is_char(constdef) then - begin - read_factor:=char(qword(value.valueord)); - factorType:= [ctetString]; - end - end; - enumdef: - begin - read_factor:=tostr(value.valueord); - factorType:= [ctetInteger]; - end; + try_consume_nestedsym(srsym,srsymtable); + if assigned(srsym) then + case srsym.typ of + constsym : + begin + with tconstsym(srsym) do + begin + case consttyp of + constord : + begin + case constdef.typ of + orddef: + begin + if is_integer(constdef) then + begin + read_factor:=tostr(value.valueord); + factorType:= [ctetInteger]; + end + else if is_boolean(constdef) then + begin + read_factor:=tostr(value.valueord); + factorType:= [ctetBoolean]; + end + else if is_char(constdef) then + begin + read_factor:=char(qword(value.valueord)); + factorType:= [ctetString]; + end + end; + enumdef: + begin + read_factor:=tostr(value.valueord); + factorType:= [ctetInteger]; + end; + end; + end; + conststring : + begin + read_factor := upper(pchar(value.valueptr)); + factorType:= [ctetString]; + end; + constset : + begin + hs:=','; + for l:=0 to 255 do + if l in pconstset(tconstsym(srsym).value.valueptr)^ then + hs:=hs+tostr(l)+','; + read_factor := hs; + factorType:= [ctetSet]; end; - end; - conststring : - begin - read_factor := upper(pchar(value.valueptr)); - factorType:= [ctetString]; - end; - constset : - begin - hs:=','; - for l:=0 to 255 do - if l in pconstset(tconstsym(srsym).value.valueptr)^ then - hs:=hs+tostr(l)+','; - read_factor := hs; - factorType:= [ctetSet]; - end; + end; end; - end; - end; - enumsym : - begin - read_factor:=tostr(tenumsym(srsym).value); - factorType:= [ctetInteger]; - end; - end; + end; + enumsym : + begin + read_factor:=tostr(tenumsym(srsym).value); + factorType:= [ctetInteger]; + end; + end; end; - preproc_consume(_ID); - current_scanner.skipspace; end end else if current_scanner.preproc_token =_LKLAMMER then @@ -4720,6 +4872,11 @@ exit_label: current_scanner.preproc_pattern:=readval_asstring; readpreproc:=_ID; end; + '.' : + begin + readchar; + readpreproc:=_POINT; + end; ',' : begin readchar; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index bd35471a46..5c675cc152 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -4735,14 +4735,14 @@ implementation begin { don't check assigned(_class), that's also the case for nested procedures inside methods } - result:=owner.symtabletype=ObjectSymtable; + result:=(owner.symtabletype=ObjectSymtable)and not no_self_node; end; function tprocdef.is_addressonly:boolean; begin result:=assigned(owner) and - (owner.symtabletype<>ObjectSymtable) and + not is_methodpointer and (not(m_nested_procvars in current_settings.modeswitches) or not is_nested_pd(self)); end; diff --git a/compiler/symsym.pas b/compiler/symsym.pas index b4094fa8c6..7c92f39762 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -614,7 +614,11 @@ implementation constructor tprocsym.create(const n : string); begin - inherited create(procsym,n); + if not(ts_lowercase_proc_start in current_settings.targetswitches) or + (n='') then + inherited create(procsym,n) + else + inherited create(procsym,lowercase(n[1])+copy(n,2,length(n)-1)); FProcdefList:=TFPObjectList.Create(false); FProcdefderefList:=nil; { the tprocdef have their own symoptions, make the procsym @@ -1667,7 +1671,12 @@ implementation not(tf_smartlink_sections in target_info.flags)) or DLLSource or (assigned(current_procinfo) and - (po_inline in current_procinfo.procdef.procoptions)) or + ((po_inline in current_procinfo.procdef.procoptions) or + { globalasmsym is called normally before the body of a subroutine is parsed + so we cannot know if it will be auto inlined, so make all symbols of it + global if asked } + (cs_opt_autoinline in current_settings.optimizerswitches)) + ) or (vo_is_public in varoptions); end; diff --git a/compiler/systems.inc b/compiler/systems.inc index db8b4fa2e8..418a2c3ac8 100644 --- a/compiler/systems.inc +++ b/compiler/systems.inc @@ -197,6 +197,39 @@ ,as_jvm_jasmin ); + tlink = (ld_none, + ld_aix, { external linkers (one per OS, handles all CPUs) } + ld_amiga, + ld_android, + ld_beos, + ld_bsd, + ld_embedded, + ld_emx, + ld_gba, + ld_go32v2, + ld_haiku, + ld_jvm, + ld_linux, + ld_morphos, + ld_mpw, + ld_msdos, + ld_nds, + ld_netwlibc, + ld_netware, + ld_os2, + ld_palmos, + ld_solaris, + ld_watcom, + ld_wdosx, + ld_wii, + ld_windows, + ld_int_go32v2, { implemented internal linkers } + ld_int_linux, + ld_int_nativent, + ld_int_netware, + ld_int_windows + ); + tar = (ar_none ,ar_gnu_ar ,ar_mpw_ar diff --git a/compiler/systems.pas b/compiler/systems.pas index e2df54080b..96f6fb46f7 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -33,20 +33,6 @@ interface *****************************************************************************} type - { Abstract linker class which is implemented in link module } - TAbstractLinker = class - end; - - TAbstractLinkerClass = class of TAbstractLinker; - - - { Abstract assembler class which is implemented in assemble module } - TAbstractAssembler = class - end; - - TAbstractAssemblerClass = class of TAbstractAssembler; - - TAbstractResourceFile = class constructor create(const fn : ansistring);virtual;abstract; end; @@ -194,8 +180,8 @@ interface dirsep : char; assem : tasm; assemextern : tasm; { external assembler, used by -a } - link : tabstractlinkerclass; - linkextern : tabstractlinkerclass; { external linker, used by -s } + link : tlink; + linkextern : tlink; { external linker, used by -s } ar : tar; res : tres; dbg : tdbg; @@ -394,19 +380,6 @@ interface procedure RegisterTarget(const r:tsysteminfo); procedure RegisterRes(const r:tresinfo; rcf : TAbstractResourceFileClass); procedure RegisterAr(const r:tarinfo); - { Register the external linker. This routine is called to setup the - class to use for the linker. It returns the tsysteminfo structure - updated with the correct linker class for external linking. - } - procedure RegisterExternalLinker(var system_info: tsysteminfo; c:TAbstractLinkerClass); - { Register the internal linker. This routine is called to setup the - class to use for the linker. It returns the tsysteminfo structure - updated with the correct linker class for internal linking. - - If internal linking is not supported, this class can be set - to nil. - } - procedure RegisterInternalLinker(var system_info : tsysteminfo; c:TAbstractLinkerClass); procedure InitSystems; @@ -669,16 +642,6 @@ begin arinfos[t]^:=r; end; -procedure RegisterExternalLinker(var system_info: tsysteminfo; c:TAbstractLinkerClass); -begin - system_info.linkextern := c; -end; - -procedure RegisterInternalLinker(var system_info : tsysteminfo; c:TAbstractLinkerClass); -begin - system_info.link := c; -end; - procedure DeregisterInfos; diff --git a/compiler/systems/i_aix.pas b/compiler/systems/i_aix.pas index 5ca4ee7caa..8b0bf0e3f9 100644 --- a/compiler/systems/i_aix.pas +++ b/compiler/systems/i_aix.pas @@ -64,8 +64,8 @@ unit i_aix; dirsep : '/'; assem : as_powerpc_xcoff; assemextern : as_powerpc_xcoff; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_aix; ar : ar_gnu_ar; res : res_xcoff; dbg : dbg_stabx; @@ -127,8 +127,8 @@ unit i_aix; dirsep : '/'; assem : as_powerpc_xcoff; assemextern : as_powerpc_xcoff; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_aix; ar : ar_gnu_ar; res : res_xcoff; dbg : dbg_stabx; diff --git a/compiler/systems/i_amiga.pas b/compiler/systems/i_amiga.pas index 3a19a03ba4..f8ab7d6296 100644 --- a/compiler/systems/i_amiga.pas +++ b/compiler/systems/i_amiga.pas @@ -63,8 +63,8 @@ unit i_amiga; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_amiga; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; @@ -125,8 +125,8 @@ unit i_amiga; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_amiga; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_android.pas b/compiler/systems/i_android.pas index dcf9f72398..ce13495d19 100644 --- a/compiler/systems/i_android.pas +++ b/compiler/systems/i_android.pas @@ -65,8 +65,8 @@ unit i_android; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_android; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -130,8 +130,8 @@ unit i_android; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_android; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; diff --git a/compiler/systems/i_beos.pas b/compiler/systems/i_beos.pas index bfdf975f70..6cca8cbb9c 100644 --- a/compiler/systems/i_beos.pas +++ b/compiler/systems/i_beos.pas @@ -64,8 +64,8 @@ unit i_beos; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_beos; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_bsd.pas b/compiler/systems/i_bsd.pas index 2ae42aee9a..90264afcf0 100644 --- a/compiler/systems/i_bsd.pas +++ b/compiler/systems/i_bsd.pas @@ -93,8 +93,8 @@ unit i_bsd; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -159,8 +159,8 @@ unit i_bsd; dirsep : '/'; assem : as_x86_64_elf64; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_dwarf2; //dbg_stabs; @@ -222,8 +222,8 @@ unit i_bsd; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -284,8 +284,8 @@ unit i_bsd; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -349,8 +349,8 @@ unit i_bsd; dirsep : '/'; assem : as_x86_64_elf64; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_dwarf2; //dbg_stabs; @@ -411,8 +411,8 @@ unit i_bsd; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -473,8 +473,8 @@ unit i_bsd; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -539,8 +539,8 @@ unit i_bsd; dirsep : '/'; assem : as_x86_64_elf64; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_elf; dbg : dbg_dwarf2; //dbg_stabs; @@ -601,8 +601,8 @@ unit i_bsd; dirsep : '/'; assem : as_darwin; assemextern : as_darwin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_macho; dbg : dbg_stabs; @@ -665,8 +665,8 @@ unit i_bsd; dirsep : '/'; assem : as_darwin; assemextern : as_darwin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_macho; dbg : dbg_stabs; @@ -729,8 +729,8 @@ unit i_bsd; dirsep : '/'; assem : as_darwin; assemextern : as_darwin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_macho; dbg : dbg_dwarf2; @@ -793,8 +793,8 @@ unit i_bsd; dirsep : '/'; assem : as_darwin; assemextern : as_darwin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_macho; dbg : dbg_dwarf2; @@ -857,8 +857,8 @@ unit i_bsd; dirsep : '/'; assem : as_darwin; assemextern : as_darwin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_macho; dbg : dbg_dwarf2; @@ -891,7 +891,7 @@ unit i_bsd; system : system_arm_darwin; name : 'Darwin for ARM'; shortname : 'Darwin'; - flags : [tf_p_ext_support,tf_requires_proper_alignment,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_has_winlike_resources]; + flags : [tf_p_ext_support,tf_requires_proper_alignment,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_has_winlike_resources,tf_pic_default]; cpu : cpu_arm; unit_env : 'BSDUNITS'; extradefines : 'UNIX;BSD;HASUNIX;CPUARMEL'; @@ -920,8 +920,8 @@ unit i_bsd; dirsep : '/'; assem : as_darwin; assemextern : as_darwin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_bsd; ar : ar_gnu_ar; res : res_macho; dbg : dbg_dwarf2; diff --git a/compiler/systems/i_embed.pas b/compiler/systems/i_embed.pas index 53946026c0..b39eaa3e80 100644 --- a/compiler/systems/i_embed.pas +++ b/compiler/systems/i_embed.pas @@ -63,8 +63,8 @@ unit i_embed; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_embedded; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; @@ -126,8 +126,8 @@ unit i_embed; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_embedded; ar : ar_gnu_ar; res : res_none; dbg : dbg_dwarf2; @@ -189,8 +189,8 @@ unit i_embed; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_embedded; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_emx.pas b/compiler/systems/i_emx.pas index 14c36da39d..f3934ec92a 100644 --- a/compiler/systems/i_emx.pas +++ b/compiler/systems/i_emx.pas @@ -74,8 +74,8 @@ unit i_emx; dirsep : '\'; assem : as_i386_as_aout; assemextern : as_i386_as_aout; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_emx; ar : ar_gnu_ar; res : res_watcom_wrc_os2; dbg : dbg_stabs; diff --git a/compiler/systems/i_gba.pas b/compiler/systems/i_gba.pas index 910a03a045..f689d52ead 100644 --- a/compiler/systems/i_gba.pas +++ b/compiler/systems/i_gba.pas @@ -64,8 +64,8 @@ unit i_gba; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_gba; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_go32v2.pas b/compiler/systems/i_go32v2.pas index b5d20b3239..a25e0d6bac 100644 --- a/compiler/systems/i_go32v2.pas +++ b/compiler/systems/i_go32v2.pas @@ -63,8 +63,8 @@ unit i_go32v2; dirsep : '\'; assem : as_i386_coff; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_int_go32v2; + linkextern : ld_go32v2; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_haiku.pas b/compiler/systems/i_haiku.pas index 71b6fef5e5..044a7bf118 100644 --- a/compiler/systems/i_haiku.pas +++ b/compiler/systems/i_haiku.pas @@ -65,8 +65,8 @@ unit i_haiku; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_haiku; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; diff --git a/compiler/systems/i_jvm.pas b/compiler/systems/i_jvm.pas index 16d6f9d52d..4d902942d9 100644 --- a/compiler/systems/i_jvm.pas +++ b/compiler/systems/i_jvm.pas @@ -81,8 +81,8 @@ unit i_jvm; dirsep : '/'; assem : as_jvm_jasmin; assemextern : as_jvm_jasmin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_jvm; ar : ar_none; res : res_jvm_raw; dbg : dbg_jasmin; @@ -146,8 +146,8 @@ unit i_jvm; dirsep : '/'; assem : as_jvm_jasmin; assemextern : as_jvm_jasmin; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_jvm; ar : ar_none; res : res_jvm_raw; dbg : dbg_jasmin; diff --git a/compiler/systems/i_linux.pas b/compiler/systems/i_linux.pas index ad474d5568..5316dd9236 100644 --- a/compiler/systems/i_linux.pas +++ b/compiler/systems/i_linux.pas @@ -69,8 +69,8 @@ unit i_linux; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -133,8 +133,8 @@ unit i_linux; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -197,8 +197,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -261,8 +261,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -324,8 +324,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_dwarf2; @@ -387,8 +387,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -451,8 +451,8 @@ unit i_linux; dirsep : '/'; assem : as_x86_64_elf64; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_dwarf2; @@ -517,8 +517,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -553,7 +553,8 @@ unit i_linux; shortname : 'Linux'; flags : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive, tf_requires_proper_alignment, - tf_smartlink_sections,tf_smartlink_library,tf_has_winlike_resources]; + tf_smartlink_sections,tf_smartlink_library,tf_pic_uses_got, + tf_has_winlike_resources]; cpu : cpu_arm; unit_env : 'LINUXUNITS'; extradefines : 'UNIX;HASUNIX;CPUARMHF'; @@ -582,8 +583,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -618,7 +619,8 @@ unit i_linux; shortname : 'Linux'; flags : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive, tf_requires_proper_alignment, - tf_smartlink_sections,tf_smartlink_library,tf_has_winlike_resources]; + tf_smartlink_sections,tf_smartlink_library,tf_pic_uses_got, + tf_has_winlike_resources]; cpu : cpu_arm; unit_env : 'LINUXUNITS'; extradefines : 'UNIX;HASUNIX;CPUARMEL'; @@ -647,8 +649,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -683,7 +685,8 @@ unit i_linux; shortname : 'Linux'; flags : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive, tf_requires_proper_alignment, - tf_smartlink_sections,tf_smartlink_library,tf_has_winlike_resources]; + tf_smartlink_sections,tf_smartlink_library,tf_pic_uses_got, + tf_has_winlike_resources]; cpu : cpu_arm; unit_env : 'LINUXUNITS'; extradefines : 'UNIX;HASUNIX;CPUARMEB'; @@ -712,8 +715,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -776,8 +779,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -844,8 +847,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; @@ -909,8 +912,8 @@ unit i_linux; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_linux; ar : ar_gnu_ar; res : res_elf; dbg : dbg_stabs; diff --git a/compiler/systems/i_macos.pas b/compiler/systems/i_macos.pas index 0df2269b89..68f3d8bf20 100644 --- a/compiler/systems/i_macos.pas +++ b/compiler/systems/i_macos.pas @@ -62,8 +62,8 @@ unit i_macos; dirsep : ':'; assem : as_powerpc_mpw; assemextern : as_powerpc_mpw; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_mpw; ar : ar_mpw_ar; res : res_powerpc_mpw; dbg : dbg_stabs; diff --git a/compiler/systems/i_morph.pas b/compiler/systems/i_morph.pas index 42f4fea91c..50226f4f8e 100644 --- a/compiler/systems/i_morph.pas +++ b/compiler/systems/i_morph.pas @@ -63,8 +63,8 @@ unit i_morph; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_morphos; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_msdos.pas b/compiler/systems/i_msdos.pas index 3233452f1c..b063fade87 100644 --- a/compiler/systems/i_msdos.pas +++ b/compiler/systems/i_msdos.pas @@ -64,8 +64,8 @@ unit i_msdos; dirsep : '\'; assem : as_i386_nasmobj; assemextern : as_i386_nasmobj; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_msdos; ar : ar_watcom_wlib_omf; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_nativent.pas b/compiler/systems/i_nativent.pas index cc70a9f409..325257efb9 100644 --- a/compiler/systems/i_nativent.pas +++ b/compiler/systems/i_nativent.pas @@ -68,8 +68,8 @@ unit i_nativent; dirsep : '\'; assem : as_i386_pecoff; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_int_nativent; + linkextern : ld_none; ar : ar_gnu_ar; res : res_gnu_windres; dbg : dbg_stabs; diff --git a/compiler/systems/i_nds.pas b/compiler/systems/i_nds.pas index 129f42f160..40cc697f90 100644 --- a/compiler/systems/i_nds.pas +++ b/compiler/systems/i_nds.pas @@ -64,8 +64,8 @@ unit i_nds; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_nds; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_nwl.pas b/compiler/systems/i_nwl.pas index 5264094cbe..00eb2dbb88 100644 --- a/compiler/systems/i_nwl.pas +++ b/compiler/systems/i_nwl.pas @@ -63,8 +63,8 @@ unit i_nwl; dirsep : '/'; assem : as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_netwlibc; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_nwm.pas b/compiler/systems/i_nwm.pas index 13506cae41..d58386456c 100644 --- a/compiler/systems/i_nwm.pas +++ b/compiler/systems/i_nwm.pas @@ -63,8 +63,8 @@ unit i_nwm; dirsep : '/'; assem : as_i386_nlmcoff; // as_i386_elf32; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_int_netware; + linkextern : ld_netware; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_os2.pas b/compiler/systems/i_os2.pas index af957609ff..f00658ed30 100644 --- a/compiler/systems/i_os2.pas +++ b/compiler/systems/i_os2.pas @@ -74,8 +74,8 @@ unit i_os2; dirsep : '\'; assem : as_i386_as_aout; assemextern : as_i386_as_aout; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_os2; ar : ar_gnu_ar; res : res_watcom_wrc_os2; dbg : dbg_stabs; diff --git a/compiler/systems/i_palmos.pas b/compiler/systems/i_palmos.pas index ddac2e4581..8db2c627b9 100644 --- a/compiler/systems/i_palmos.pas +++ b/compiler/systems/i_palmos.pas @@ -63,8 +63,8 @@ unit i_palmos; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_palmos; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; @@ -136,8 +136,8 @@ unit i_palmos; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_palmos; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_sunos.pas b/compiler/systems/i_sunos.pas index 558dfe3344..0ac86bf457 100644 --- a/compiler/systems/i_sunos.pas +++ b/compiler/systems/i_sunos.pas @@ -65,8 +65,8 @@ unit i_sunos; dirsep : '/'; assem : as_i386_elf32; assemextern : as_ggas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_solaris; ar : ar_gnu_gar; res : res_elf; dbg : dbg_stabs; @@ -132,8 +132,8 @@ unit i_sunos; dirsep : '/'; assem : as_ggas{as_x86_64_elf64}; assemextern : as_ggas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_solaris; ar : ar_gnu_ar; res : res_elf; dbg : dbg_dwarf2; @@ -199,8 +199,8 @@ unit i_sunos; dirsep : '/'; assem : as_ggas; assemextern : as_ggas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_solaris; ar : ar_gnu_gar; res : res_elf; dbg : dbg_stabs; diff --git a/compiler/systems/i_symbian.pas b/compiler/systems/i_symbian.pas index bccb22ca04..ef89e495dd 100644 --- a/compiler/systems/i_symbian.pas +++ b/compiler/systems/i_symbian.pas @@ -65,8 +65,8 @@ unit i_symbian; dirsep : '\'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_windows; ar : ar_gnu_ar; res : res_gnu_windres; dbg : dbg_stabs; @@ -128,8 +128,8 @@ unit i_symbian; dirsep : '\'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_windows; + linkextern : ld_none; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_watcom.pas b/compiler/systems/i_watcom.pas index 9cf1aef621..fa159839cd 100644 --- a/compiler/systems/i_watcom.pas +++ b/compiler/systems/i_watcom.pas @@ -63,8 +63,8 @@ unit i_watcom; dirsep : '\'; assem : as_i386_wasm; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_watcom; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_wdosx.pas b/compiler/systems/i_wdosx.pas index 509c913c0e..b412fbe9be 100644 --- a/compiler/systems/i_wdosx.pas +++ b/compiler/systems/i_wdosx.pas @@ -63,8 +63,8 @@ unit i_wdosx; dirsep : '\'; assem : as_i386_pecoffwdosx; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_wdosx; ar : ar_gnu_ar; res : res_gnu_windres; dbg : dbg_stabs; diff --git a/compiler/systems/i_wii.pas b/compiler/systems/i_wii.pas index 6c07442892..0fc8c67036 100644 --- a/compiler/systems/i_wii.pas +++ b/compiler/systems/i_wii.pas @@ -63,8 +63,8 @@ unit i_wii; dirsep : '/'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_none; + linkextern : ld_wii; ar : ar_gnu_ar; res : res_none; dbg : dbg_stabs; diff --git a/compiler/systems/i_win.pas b/compiler/systems/i_win.pas index e7b32c8762..b20350435c 100644 --- a/compiler/systems/i_win.pas +++ b/compiler/systems/i_win.pas @@ -68,8 +68,8 @@ unit i_win; dirsep : '\'; assem : as_i386_pecoff; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_int_windows; + linkextern : ld_windows; ar : ar_gnu_ar; res : res_gnu_windres; dbg : dbg_stabs; @@ -135,8 +135,8 @@ unit i_win; dirsep : '\'; assem : as_x86_64_pecoff; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_int_windows; + linkextern : ld_windows; ar : ar_gnu_ar; res : res_win64_gorc; dbg : dbg_dwarf2; @@ -200,8 +200,8 @@ unit i_win; dirsep : '\'; assem : as_gas; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_int_windows; + linkextern : ld_windows; ar : ar_gnu_ar_scripted; res : res_gnu_windres; dbg : dbg_stabs; @@ -265,8 +265,8 @@ unit i_win; dirsep : '\'; assem : as_i386_pecoffwince; assemextern : as_gas; - link : nil; - linkextern : nil; + link : ld_int_windows; + linkextern : ld_windows; ar : ar_gnu_ar_scripted; res : res_gnu_windres; dbg : dbg_stabs; diff --git a/compiler/systems/t_aix.pas b/compiler/systems/t_aix.pas index 85cd009b6c..beb6eec417 100644 --- a/compiler/systems/t_aix.pas +++ b/compiler/systems/t_aix.pas @@ -414,14 +414,13 @@ end; *****************************************************************************} initialization + RegisterLinker(ld_aix,TLinkerAIX); {$ifdef powerpc} - RegisterExternalLinker(system_powerpc_aix_info,TLinkerAIX); RegisterImport(system_powerpc_aix,timportlibaix); RegisterExport(system_powerpc_aix,texportlibaix); RegisterTarget(system_powerpc_aix_info); {$endif powerpc} {$ifdef powerpc64} - RegisterExternalLinker(system_powerpc64_aix_info,TLinkerAIX); RegisterImport(system_powerpc64_aix,timportlibaix); RegisterExport(system_powerpc64_aix,texportlibaix); RegisterTarget(system_powerpc64_aix_info); diff --git a/compiler/systems/t_amiga.pas b/compiler/systems/t_amiga.pas index 30e7efbd21..f7f0c53ea4 100644 --- a/compiler/systems/t_amiga.pas +++ b/compiler/systems/t_amiga.pas @@ -277,11 +277,11 @@ end; initialization {$ifdef m68k} { TODO: No executable creation support for m68k yet!} - RegisterExternalLinker(system_m68k_Amiga_info,TLinkerAmiga); + RegisterLinker(ld_amiga,TLinkerAmiga); RegisterTarget(system_m68k_Amiga_info); {$endif m68k} {$ifdef powerpc} - RegisterExternalLinker(system_powerpc_Amiga_info,TLinkerAmiga); + RegisterLinker(ld_amiga,TLinkerAmiga); RegisterTarget(system_powerpc_Amiga_info); {$endif powerpc} end. diff --git a/compiler/systems/t_android.pas b/compiler/systems/t_android.pas index c508448e27..ae8b193270 100644 --- a/compiler/systems/t_android.pas +++ b/compiler/systems/t_android.pas @@ -424,14 +424,13 @@ end; *****************************************************************************} initialization + RegisterLinker(ld_android,TLinkerAndroid); {$ifdef ARM} - RegisterExternalLinker(system_arm_android_info,TLinkerAndroid); RegisterImport(system_arm_android,timportlibandroid); RegisterExport(system_arm_android,texportlibandroid); RegisterTarget(system_arm_android_info); {$endif ARM} {$ifdef I386} - RegisterExternalLinker(system_i386_android_info,TLinkerAndroid); RegisterImport(system_i386_android,timportlibandroid); RegisterExport(system_i386_android,texportlibandroid); RegisterTarget(system_i386_android_info); diff --git a/compiler/systems/t_beos.pas b/compiler/systems/t_beos.pas index a992ff773a..e55453cdfd 100644 --- a/compiler/systems/t_beos.pas +++ b/compiler/systems/t_beos.pas @@ -491,8 +491,8 @@ end; *****************************************************************************} initialization + RegisterLinker(ld_beos,TLinkerbeos); {$ifdef i386} - RegisterExternalLinker(system_i386_beos_info,TLinkerbeos); RegisterImport(system_i386_beos,timportlibbeos); RegisterExport(system_i386_beos,texportlibbeos); RegisterTarget(system_i386_beos_info); diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas index b581bdc781..91017c1d43 100644 --- a/compiler/systems/t_bsd.pas +++ b/compiler/systems/t_bsd.pas @@ -295,9 +295,13 @@ var startupfile: TCmdStr; begin startupfile:=GetDarwinCrt1ObjName(isdll); - if (startupfile<>'') and - not librarysearchpath.FindFile(startupfile,false,result) then - result:='/usr/lib/'+startupfile; + if startupfile<>'' then + begin + if not librarysearchpath.FindFile(startupfile,false,result) then + result:='/usr/lib/'+startupfile + end + else + result:=''; result:=maybequoted(result); end; @@ -879,29 +883,23 @@ end; *****************************************************************************} initialization + RegisterLinker(ld_bsd,TLinkerBSD); {$ifdef x86_64} - RegisterExternalLinker(system_x86_64_FreeBSD_info,TLinkerBSD); RegisterImport(system_x86_64_freebsd,timportlibbsd); RegisterExport(system_x86_64_freebsd,texportlibbsd); RegisterTarget(system_x86_64_freebsd_info); - RegisterExternalLinker(system_x86_64_OpenBSD_info,TLinkerBSD); RegisterImport(system_x86_64_openbsd,timportlibbsd); RegisterExport(system_x86_64_openbsd,texportlibbsd); RegisterTarget(system_x86_64_openbsd_info); - RegisterExternalLinker(system_x86_64_NetBSD_info,TLinkerBSD); RegisterImport(system_x86_64_netbsd,timportlibbsd); RegisterExport(system_x86_64_netbsd,texportlibbsd); RegisterTarget(system_x86_64_netbsd_info); - RegisterExternalLinker(system_x86_64_darwin_info,TLinkerBSD); RegisterImport(system_x86_64_darwin,timportlibdarwin); RegisterExport(system_x86_64_darwin,texportlibdarwin); RegisterTarget(system_x86_64_darwin_info); {$endif} {$ifdef i386} - RegisterExternalLinker(system_i386_FreeBSD_info,TLinkerBSD); - RegisterExternalLinker(system_i386_NetBSD_info,TLinkerBSD); - RegisterExternalLinker(system_i386_OpenBSD_info,TLinkerBSD); RegisterImport(system_i386_freebsd,timportlibbsd); RegisterExport(system_i386_freebsd,texportlibbsd); RegisterTarget(system_i386_freebsd_info); @@ -911,42 +909,33 @@ initialization RegisterImport(system_i386_openbsd,timportlibbsd); RegisterExport(system_i386_openbsd,texportlibbsd); RegisterTarget(system_i386_openbsd_info); - RegisterExternalLinker(system_i386_darwin_info,TLinkerBSD); RegisterImport(system_i386_darwin,timportlibdarwin); RegisterExport(system_i386_darwin,texportlibdarwin); RegisterTarget(system_i386_darwin_info); - RegisterExternalLinker(system_i386_iphonesim_info,TLinkerBSD); RegisterImport(system_i386_iphonesim,timportlibdarwin); RegisterExport(system_i386_iphonesim,texportlibdarwin); RegisterTarget(system_i386_iphonesim_info); {$endif i386} {$ifdef m68k} -// RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD); - RegisterExternalLinker(system_m68k_NetBSD_info,TLinkerBSD); RegisterImport(system_m68k_netbsd,timportlibbsd); RegisterExport(system_m68k_netbsd,texportlibbsd); RegisterTarget(system_m68k_netbsd_info); {$endif m68k} {$ifdef powerpc} -// RegisterExternalLinker(system_m68k_FreeBSD_info,TLinkerBSD); - RegisterExternalLinker(system_powerpc_darwin_info,TLinkerBSD); RegisterImport(system_powerpc_darwin,timportlibdarwin); RegisterExport(system_powerpc_darwin,texportlibdarwin); RegisterTarget(system_powerpc_darwin_info); - RegisterExternalLinker(system_powerpc_netbsd_info,TLinkerBSD); RegisterImport(system_powerpc_netbsd,timportlibbsd); RegisterExport(system_powerpc_netbsd,texportlibbsd); RegisterTarget(system_powerpc_netbsd_info); {$endif powerpc} {$ifdef powerpc64} - RegisterExternalLinker(system_powerpc64_darwin_info,TLinkerBSD); RegisterImport(system_powerpc64_darwin,timportlibdarwin); RegisterExport(system_powerpc64_darwin,texportlibdarwin); RegisterTarget(system_powerpc64_darwin_info); {$endif powerpc64} {$ifdef arm} - RegisterExternalLinker(system_arm_darwin_info,TLinkerBSD); RegisterImport(system_arm_darwin,timportlibdarwin); RegisterExport(system_arm_darwin,texportlibdarwin); RegisterTarget(system_arm_darwin_info); diff --git a/compiler/systems/t_embed.pas b/compiler/systems/t_embed.pas index f92279c2d2..01d503f624 100644 --- a/compiler/systems/t_embed.pas +++ b/compiler/systems/t_embed.pas @@ -1031,17 +1031,17 @@ function TLinkerEmbedded.postprocessexecutable(const fn : string;isdll:boolean): initialization {$ifdef arm} - RegisterExternalLinker(system_arm_embedded_info,TlinkerEmbedded); + RegisterLinker(ld_embedded,TLinkerEmbedded); RegisterTarget(system_arm_embedded_info); {$endif arm} {$ifdef avr} - RegisterExternalLinker(system_avr_embedded_info,TlinkerEmbedded); + RegisterLinker(ld_embedded,TLinkerEmbedded); RegisterTarget(system_avr_embedded_info); {$endif avr} {$ifdef i386} - RegisterExternalLinker(system_i386_embedded_info,TlinkerEmbedded); + RegisterLinker(ld_embedded,TLinkerEmbedded); RegisterTarget(system_i386_embedded_info); {$endif i386} end. diff --git a/compiler/systems/t_emx.pas b/compiler/systems/t_emx.pas index 85ca4839c2..4f1ed65c90 100644 --- a/compiler/systems/t_emx.pas +++ b/compiler/systems/t_emx.pas @@ -542,7 +542,7 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_i386_emx_info,TLinkerEMX); + RegisterLinker(ld_emx,TLinkerEMX); RegisterImport(system_i386_emx,TImportLibEMX); RegisterRes(res_wrc_os2_info,TResourceFile); RegisterTarget(system_i386_emx_info); diff --git a/compiler/systems/t_gba.pas b/compiler/systems/t_gba.pas index ac81d4bbee..2dee4d83ea 100644 --- a/compiler/systems/t_gba.pas +++ b/compiler/systems/t_gba.pas @@ -627,6 +627,6 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_arm_gba_info,TLinkerGba); + RegisterLinker(ld_gba,TLinkerGba); RegisterTarget(system_arm_gba_info); end. diff --git a/compiler/systems/t_go32v2.pas b/compiler/systems/t_go32v2.pas index e50535869e..f443ec3c59 100644 --- a/compiler/systems/t_go32v2.pas +++ b/compiler/systems/t_go32v2.pas @@ -511,7 +511,7 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_i386_go32v2_info,TExternalLinkerGo32v2); - RegisterInternalLinker(system_i386_go32v2_info,TInternalLinkerGo32v2); + RegisterLinker(ld_go32v2,TExternalLinkerGo32v2); + RegisterLinker(ld_int_go32v2,TInternalLinkerGo32v2); RegisterTarget(system_i386_go32v2_info); end. diff --git a/compiler/systems/t_haiku.pas b/compiler/systems/t_haiku.pas index 25a7a8a947..448738ec25 100644 --- a/compiler/systems/t_haiku.pas +++ b/compiler/systems/t_haiku.pas @@ -491,8 +491,8 @@ end; *****************************************************************************} initialization + RegisterLinker(ld_haiku,TLinkerhaiku); {$ifdef i386} - RegisterExternalLinker(system_i386_haiku_info,TLinkerhaiku); RegisterImport(system_i386_haiku,timportlibhaiku); RegisterExport(system_i386_haiku,texportlibhaiku); RegisterTarget(system_i386_haiku_info); diff --git a/compiler/systems/t_jvm.pas b/compiler/systems/t_jvm.pas index e3592c68a3..09c17e6079 100644 --- a/compiler/systems/t_jvm.pas +++ b/compiler/systems/t_jvm.pas @@ -94,13 +94,11 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_jvm_java32_info, tlinkerjvm); + RegisterLinker(ld_jvm, tlinkerjvm); RegisterImport(system_jvm_java32,timportlibjvm); RegisterExport(system_jvm_java32,texportlibjvm); RegisterTarget(system_jvm_java32_info); - - RegisterExternalLinker(system_jvm_android32_info, tlinkerjvm); RegisterImport(system_jvm_android32,timportlibjvm); RegisterExport(system_jvm_android32,texportlibjvm); RegisterTarget(system_jvm_android32_info); diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas index 3005c5a7fa..6fe68191f9 100644 --- a/compiler/systems/t_linux.pas +++ b/compiler/systems/t_linux.pas @@ -502,8 +502,8 @@ begin end else begin - linklibc:=true; - end; + linklibc:=true; + end; end; Add(')'); end @@ -662,7 +662,7 @@ begin _end. Align after .bss to ensure correct alignment even if the .bss section disappears because there are no input sections.} add(' . = ALIGN(32 / 8);'); - add(' }'); + add('}'); add(' . = ALIGN(32 / 8);'); add(' PROVIDE (_end = .);'); add(' PROVIDE (end = .);'); @@ -1276,7 +1276,7 @@ begin { See tw9089*.pp: if more than one pure-Pascal shared libs are loaded, and none have rtld in their DT_NEEDED, then rtld cannot finalize correctly. } if IsSharedLibrary then - LinkScript.Concat('READSTATICLIBRARY '+maybequoted(dynlinker)); + LinkScript.Concat('READSTATICLIBRARY '+maybequoted(sysrootpath+dynlinker)); linkToSharedLibs:=(not SharedLibFiles.Empty); @@ -1497,67 +1497,58 @@ end; *****************************************************************************} initialization + RegisterLinker(ld_linux,TLinkerLinux); + RegisterLinker(ld_int_linux,TInternalLinkerLinux); {$ifdef i386} - RegisterExternalLinker(system_i386_linux_info,TLinkerLinux); RegisterImport(system_i386_linux,timportliblinux); RegisterExport(system_i386_linux,texportliblinux); RegisterTarget(system_i386_linux_info); - RegisterExternalLinker(system_x86_6432_linux_info,TLinkerLinux); RegisterImport(system_x86_6432_linux,timportliblinux); RegisterExport(system_x86_6432_linux,texportliblinux); RegisterTarget(system_x86_6432_linux_info); {$endif i386} {$ifdef m68k} - RegisterExternalLinker(system_m68k_linux_info,TLinkerLinux); RegisterImport(system_m68k_linux,timportliblinux); RegisterExport(system_m68k_linux,texportliblinux); RegisterTarget(system_m68k_linux_info); {$endif m68k} {$ifdef powerpc} - RegisterExternalLinker(system_powerpc_linux_info,TLinkerLinux); RegisterImport(system_powerpc_linux,timportliblinux); RegisterExport(system_powerpc_linux,texportliblinux); RegisterTarget(system_powerpc_linux_info); {$endif powerpc} {$ifdef powerpc64} - RegisterExternalLinker(system_powerpc64_linux_info,TLinkerLinux); RegisterImport(system_powerpc64_linux,timportliblinux); RegisterExport(system_powerpc64_linux,texportliblinux); RegisterTarget(system_powerpc64_linux_info); {$endif powerpc64} {$ifdef alpha} - RegisterExternalLinker(system_alpha_linux_info,TLinkerLinux); RegisterImport(system_alpha_linux,timportliblinux); RegisterExport(system_alpha_linux,texportliblinux); RegisterTarget(system_alpha_linux_info); {$endif alpha} {$ifdef x86_64} - RegisterExternalLinker(system_x86_64_linux_info,TLinkerLinux); RegisterImport(system_x86_64_linux,timportliblinux); RegisterExport(system_x86_64_linux,texportliblinux); RegisterTarget(system_x86_64_linux_info); {$endif x86_64} {$ifdef SPARC} - RegisterExternalLinker(system_sparc_linux_info,TLinkerLinux); RegisterImport(system_SPARC_linux,timportliblinux); RegisterExport(system_SPARC_linux,texportliblinux); RegisterTarget(system_SPARC_linux_info); {$endif SPARC} {$ifdef ARM} - RegisterExternalLinker(system_arm_linux_info,TLinkerLinux); RegisterImport(system_arm_linux,timportliblinux); RegisterExport(system_arm_linux,texportliblinux); RegisterTarget(system_arm_linux_info); {$endif ARM} {$ifdef MIPS} {$ifdef MIPSEL} - RegisterExternalLinker(system_mipsel_linux_info,TLinkerLinux); RegisterImport(system_mipsel_linux,timportliblinux); RegisterExport(system_mipsel_linux,texportliblinux); RegisterTarget(system_mipsel_linux_info); {$else MIPS} - RegisterExternalLinker(system_mipseb_linux_info,TLinkerLinux); RegisterImport(system_mipseb_linux,timportliblinux); RegisterExport(system_mipseb_linux,texportliblinux); RegisterTarget(system_mipseb_linux_info); diff --git a/compiler/systems/t_macos.pas b/compiler/systems/t_macos.pas index 9f99cc2790..0601ba19ed 100644 --- a/compiler/systems/t_macos.pas +++ b/compiler/systems/t_macos.pas @@ -248,7 +248,7 @@ initialization RegisterImport(system_m68k_macos,timportlibmacos); {$endif m68k} {$ifdef powerpc} - RegisterExternalLinker(system_powerpc_macos_info,TLinkerMPW); + RegisterLinker(ld_mpw,TLinkerMPW); RegisterTarget(system_powerpc_macos_info); RegisterImport(system_powerpc_macos,timportlibmacos); {$endif powerpc} diff --git a/compiler/systems/t_morph.pas b/compiler/systems/t_morph.pas index 68f77079ec..fedd5c329c 100644 --- a/compiler/systems/t_morph.pas +++ b/compiler/systems/t_morph.pas @@ -263,6 +263,6 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_powerpc_morphos_info,TLinkerMorphOS); + RegisterLinker(ld_morphos,TLinkerMorphOS); RegisterTarget(system_powerpc_morphos_info); end. diff --git a/compiler/systems/t_msdos.pas b/compiler/systems/t_msdos.pas index 2824527817..4afe086667 100644 --- a/compiler/systems/t_msdos.pas +++ b/compiler/systems/t_msdos.pas @@ -332,11 +332,11 @@ end; initialization {$if defined(USE_LINKER_TLINK)} - RegisterExternalLinker(system_i8086_msdos_info,TExternalLinkerMsDosTLink); + RegisterLinker(ld_msdos,TExternalLinkerMsDosTLink); {$elseif defined(USE_LINKER_ALINK)} - RegisterExternalLinker(system_i8086_msdos_info,TExternalLinkerMsDosALink); + RegisterLinker(ld_msdos,TExternalLinkerMsDosALink); {$elseif defined(USE_LINKER_WLINK)} - RegisterExternalLinker(system_i8086_msdos_info,TExternalLinkerMsDosWLink); + RegisterLinker(ld_msdos,TExternalLinkerMsDosWLink); {$else} {$fatal no linker defined} {$endif} diff --git a/compiler/systems/t_nativent.pas b/compiler/systems/t_nativent.pas index e4b8fc1329..8c75250f99 100644 --- a/compiler/systems/t_nativent.pas +++ b/compiler/systems/t_nativent.pas @@ -85,7 +85,7 @@ implementation initialization {$ifdef i386} { NativeNT } - RegisterInternalLinker(system_i386_nativent_info,TInternalLinkerNativeNT); + RegisterLinker(ld_int_nativent,TInternalLinkerNativeNT); RegisterImport(system_i386_nativent,TImportLibNativeNT); RegisterExport(system_i386_nativent,TExportLibNativeNT); // RegisterRes(res_gnu_windres_info,TWinLikeResourceFile); diff --git a/compiler/systems/t_nds.pas b/compiler/systems/t_nds.pas index 7b7ab351de..16eab29b5e 100644 --- a/compiler/systems/t_nds.pas +++ b/compiler/systems/t_nds.pas @@ -775,6 +775,6 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_arm_nds_info,TLinkerNDS); + RegisterLinker(ld_nds,TLinkerNDS); RegisterTarget(system_arm_nds_info); end. diff --git a/compiler/systems/t_nwl.pas b/compiler/systems/t_nwl.pas index ed060ca47f..14af613440 100644 --- a/compiler/systems/t_nwl.pas +++ b/compiler/systems/t_nwl.pas @@ -624,7 +624,7 @@ end; initialization - RegisterExternalLinker(system_i386_netwlibc_info,TLinkerNetwlibc); + RegisterLinker(ld_netwlibc,TLinkerNetwlibc); RegisterImport(system_i386_netwlibc,TImportLibNetwlibc); RegisterExport(system_i386_netwlibc,TExportLibNetwlibc); RegisterTarget(system_i386_netwlibc_info); diff --git a/compiler/systems/t_nwm.pas b/compiler/systems/t_nwm.pas index 5761cd9fa3..d202893467 100644 --- a/compiler/systems/t_nwm.pas +++ b/compiler/systems/t_nwm.pas @@ -980,8 +980,8 @@ end; initialization - RegisterExternalLinker(system_i386_netware_info,TLinkerNetware); - RegisterInternalLinker(system_i386_netware_info,TInternalLinkerNetware); + RegisterLinker(ld_netware,TLinkerNetware); + RegisterLinker(ld_int_netware,TInternalLinkerNetware); RegisterImport(system_i386_netware,TImportLibNetware); RegisterExport(system_i386_netware,TExportLibNetware); RegisterTarget(system_i386_netware_info); diff --git a/compiler/systems/t_os2.pas b/compiler/systems/t_os2.pas index 6549b8a79c..064169836c 100644 --- a/compiler/systems/t_os2.pas +++ b/compiler/systems/t_os2.pas @@ -557,7 +557,7 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_i386_os2_info,TLinkerOS2); + RegisterLinker(ld_os2,TLinkerOS2); RegisterImport(system_i386_os2,TImportLibOS2); { RegisterRes(res_wrc_os2_info,TResourceFile);} RegisterTarget(system_i386_os2_info); diff --git a/compiler/systems/t_sunos.pas b/compiler/systems/t_sunos.pas index fcf613c604..63788fd288 100644 --- a/compiler/systems/t_sunos.pas +++ b/compiler/systems/t_sunos.pas @@ -641,22 +641,20 @@ end; *****************************************************************************} initialization + RegisterLinker(ld_solaris,TLinkerSolaris); {$ifdef i386} - RegisterExternalLinker(system_i386_solaris_info,TLinkersolaris); RegisterImport(system_i386_solaris,TImportLibsolaris); RegisterExport(system_i386_solaris,TExportLibsolaris); RegisterTarget(system_i386_solaris_info); {$endif i386} {$ifdef x86_64} - RegisterExternalLinker(system_x86_64_solaris_info,TLinkersolaris); RegisterImport(system_x86_64_solaris,TImportLibsolaris); RegisterExport(system_x86_64_solaris,TExportLibsolaris); RegisterTarget(system_x86_64_solaris_info); {$endif x86_64} {$ifdef sparc} - RegisterExternalLinker(system_sparc_solaris_info,TLinkersolaris); RegisterImport(system_sparc_solaris,TImportLibsolaris); RegisterExport(system_sparc_solaris,TExportLibsolaris); RegisterTarget(system_sparc_solaris_info); diff --git a/compiler/systems/t_symbian.pas b/compiler/systems/t_symbian.pas index a11ba00eda..c354e1e5aa 100644 --- a/compiler/systems/t_symbian.pas +++ b/compiler/systems/t_symbian.pas @@ -181,8 +181,11 @@ implementation *****************************************************************************} initialization + { Using external linker as internal doesn't look correct... } + RegisterLinker(ld_windows,TExternalLinkerWin); + RegisterLinker(ld_int_windows,TInternalLinkerWin); {$ifdef i386} - RegisterInternalLinker(system_i386_symbian_info,TExternalLinkerWin); + ///RegisterInternalLinker(system_i386_symbian_info,TExternalLinkerWin); RegisterImport(system_i386_symbian,TImportLibWin); RegisterExport(system_i386_symbian,TExportLibWin); RegisterDLLScanner(system_i386_symbian,TDLLScannerWin); @@ -191,7 +194,7 @@ initialization {$endif i386} {$ifdef arm} // RegisterExternalLinker(system_arm_symbian_info,TExternalLinkerWin); - RegisterInternalLinker(system_arm_symbian_info,TInternalLinkerWin); + ///RegisterInternalLinker(system_arm_symbian_info,TInternalLinkerWin); RegisterImport(system_arm_symbian,TImportLibWin); RegisterExport(system_arm_symbian,TExportLibWin); RegisterTarget(system_arm_symbian_info); diff --git a/compiler/systems/t_watcom.pas b/compiler/systems/t_watcom.pas index a497b0b380..2c12eeb87a 100644 --- a/compiler/systems/t_watcom.pas +++ b/compiler/systems/t_watcom.pas @@ -174,6 +174,6 @@ end;} *****************************************************************************} initialization - RegisterExternalLinker(system_i386_watcom_info,TLinkerWatcom); + RegisterLinker(ld_watcom,TLinkerWatcom); RegisterTarget(system_i386_watcom_info); end. diff --git a/compiler/systems/t_wdosx.pas b/compiler/systems/t_wdosx.pas index ea8aa01f46..67776395b5 100644 --- a/compiler/systems/t_wdosx.pas +++ b/compiler/systems/t_wdosx.pas @@ -74,7 +74,7 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_i386_wdosx_info,TExternalLinkerWdosx); + RegisterLinker(ld_wdosx,TExternalLinkerWdosx); RegisterImport(system_i386_wdosx,TImportLibWdosx); RegisterExport(system_i386_wdosx,TExportLibWdosx); RegisterDLLScanner(system_i386_wdosx,TDLLScannerWdosx); diff --git a/compiler/systems/t_wii.pas b/compiler/systems/t_wii.pas index 837df26d7c..9a4943e853 100644 --- a/compiler/systems/t_wii.pas +++ b/compiler/systems/t_wii.pas @@ -592,6 +592,6 @@ end; *****************************************************************************} initialization - RegisterExternalLinker(system_powerpc_wii_info,TLinkerWii); + RegisterLinker(ld_wii,TLinkerWii); RegisterTarget(system_powerpc_wii_info); end. diff --git a/compiler/systems/t_win.pas b/compiler/systems/t_win.pas index 972adece8d..88a23f98c1 100644 --- a/compiler/systems/t_win.pas +++ b/compiler/systems/t_win.pas @@ -1815,26 +1815,22 @@ implementation *****************************************************************************} initialization + RegisterLinker(ld_int_windows,TInternalLinkerWin); + RegisterLinker(ld_windows,TExternalLinkerWin); {$ifdef i386} { Win32 } - RegisterExternalLinker(system_i386_win32_info,TExternalLinkerWin); - RegisterInternalLinker(system_i386_win32_info,TInternalLinkerWin); RegisterImport(system_i386_win32,TImportLibWin); RegisterExport(system_i386_win32,TExportLibWin); RegisterDLLScanner(system_i386_win32,TDLLScannerWin); RegisterRes(res_gnu_windres_info,TWinLikeResourceFile); RegisterTarget(system_i386_win32_info); { WinCE } - RegisterExternalLinker(system_i386_wince_info,TExternalLinkerWin); - RegisterInternalLinker(system_i386_wince_info,TInternalLinkerWin); RegisterImport(system_i386_wince,TImportLibWin); RegisterExport(system_i386_wince,TExportLibWin); RegisterDLLScanner(system_i386_wince,TDLLScannerWin); RegisterTarget(system_i386_wince_info); {$endif i386} {$ifdef x86_64} - RegisterExternalLinker(system_x64_win64_info,TExternalLinkerWin); - RegisterInternalLinker(system_x64_win64_info,TInternalLinkerWin); RegisterImport(system_x86_64_win64,TImportLibWin); RegisterExport(system_x86_64_win64,TExportLibWin); RegisterDLLScanner(system_x86_64_win64,TDLLScannerWin); @@ -1842,8 +1838,6 @@ initialization RegisterTarget(system_x64_win64_info); {$endif x86_64} {$ifdef arm} - RegisterExternalLinker(system_arm_wince_info,TExternalLinkerWin); - RegisterInternalLinker(system_arm_wince_info,TInternalLinkerWin); RegisterImport(system_arm_wince,TImportLibWin); RegisterExport(system_arm_wince,TExportLibWin); RegisterRes(res_gnu_windres_info,TWinLikeResourceFile); diff --git a/compiler/utils/ppuutils/ppudump.pp b/compiler/utils/ppuutils/ppudump.pp index 64300ca23e..d55f1bd7ec 100644 --- a/compiler/utils/ppuutils/ppudump.pp +++ b/compiler/utils/ppuutils/ppudump.pp @@ -472,7 +472,7 @@ type str : string[30]; end; const - flagopts=24; + flagopts=27; flagopt : array[1..flagopts] of tflagopt=( (mask: $1 ;str:'init'), (mask: $2 ;str:'final'), @@ -499,7 +499,10 @@ const (mask: $100000 ;str:'has_exports'), (mask: $400000 ;str:'has_wideinits'), (mask: $800000 ;str:'has_classinits'), - (mask: $1000000 ;str:'has_resstrinits') + (mask: $1000000 ;str:'has_resstrinits'), + (mask: $2000000 ;str:'i8086_far_code'), + (mask: $4000000 ;str:'i8086_far_data'), + (mask: $8000000 ;str:'i8086_huge_data') ); var i,ntflags : longint; diff --git a/compiler/x86/aasmcpu.pas b/compiler/x86/aasmcpu.pas index 7782c388ff..4c370413f0 100644 --- a/compiler/x86/aasmcpu.pas +++ b/compiler/x86/aasmcpu.pas @@ -3089,19 +3089,11 @@ implementation actRegTypes : int64; actRegMemTypes: int64; NewRegSize: int64; - NewMemSize: int64; - NewConstSize: int64; - RegSize: int64; - MemSize: int64; - ConstSize: int64; RegMMXSizeMask: int64; RegXMMSizeMask: int64; RegYMMSizeMask: int64; bitcount: integer; - IsRegSizeMemSize: boolean; - ExistsRegMem: boolean; - s: string; function bitcnt(aValue: int64): integer; var @@ -3134,10 +3126,6 @@ implementation InsTabMemRefSizeInfoCache^[AsmOp].ConstSize := csiUnkown; InsTabMemRefSizeInfoCache^[AsmOp].ExistsSSEAVX := false; - RegSize := 0; - IsRegSizeMemSize := true; - ExistsRegMem := false; - insentry:=@instab[i]; RegMMXSizeMask := 0; RegXMMSizeMask := 0; @@ -3155,12 +3143,9 @@ implementation actMemSize := 0; actMemCount := 0; actRegMemTypes := 0; - NewMemSize := 0; actConstSize := 0; actConstCount := 0; - NewConstSize := 0; - if asmop = a_movups then begin diff --git a/compiler/x86/agx86att.pas b/compiler/x86/agx86att.pas index 252aec6f39..03a5af4f2c 100644 --- a/compiler/x86/agx86att.pas +++ b/compiler/x86/agx86att.pas @@ -53,6 +53,8 @@ interface procedure WriteOper_jmp(const o:toper); protected fskipPopcountSuffix: boolean; + { http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56656 } + fNoInterUnitMovQ: boolean; public procedure WriteInstruction(hp: tai);override; end; @@ -90,6 +92,8 @@ interface InstrWriter := Tx86InstrWriter.create(self); { Apple's assembler does not support a size suffix for popcount } Tx86InstrWriter(InstrWriter).fskipPopcountSuffix := true; + { Apple's assembler is broken regarding some movq suffix handling } + Tx86InstrWriter(InstrWriter).fNoInterUnitMovQ := true; end; {**************************************************************************** @@ -293,6 +297,23 @@ interface end; end; {$endif x86_64} + { see fNoInterUnitMovQ declaration comment } + if fNoInterUnitMovQ then + begin + if ((op=A_MOVQ) or + (op=A_VMOVQ)) and + (((taicpu(hp).oper[0]^.typ=top_reg) and + (getregtype(taicpu(hp).oper[0]^.reg)=R_INTREGISTER)) or + ((taicpu(hp).oper[1]^.typ=top_reg) and + (getregtype(taicpu(hp).oper[1]^.reg)=R_INTREGISTER))) then + begin + if op=A_MOVQ then + op:=A_MOVD + else + op:=A_VMOVD; + taicpu(hp).opcode:=op; + end; + end; owner.AsmWrite(#9); { movsd should not be translated to movsl when there are (xmm) arguments } diff --git a/compiler/x86/agx86nsm.pas b/compiler/x86/agx86nsm.pas index df5798e1b7..990ae4ac6d 100644 --- a/compiler/x86/agx86nsm.pas +++ b/compiler/x86/agx86nsm.pas @@ -1183,7 +1183,7 @@ interface id : as_i386_nasmcoff; idtxt : 'NASMCOFF'; asmbin : 'nasm'; - asmcmd : '-f coff -o $OBJ $ASM'; + asmcmd : '-f coff -o $OBJ -w-orphan-labels $ASM'; supported_targets : [system_i386_go32v2]; flags : [af_needar,af_no_debug]; labelprefix : '..@'; @@ -1196,7 +1196,7 @@ interface id : as_i386_nasmwin32; idtxt : 'NASMWIN32'; asmbin : 'nasm'; - asmcmd : '-f win32 -o $OBJ $ASM'; + asmcmd : '-f win32 -o $OBJ -w-orphan-labels $ASM'; supported_targets : [system_i386_win32]; flags : [af_needar,af_no_debug]; labelprefix : '..@'; @@ -1209,7 +1209,7 @@ interface id : as_i386_nasmobj; idtxt : 'NASMOBJ'; asmbin : 'nasm'; - asmcmd : '-f obj -o $OBJ $ASM'; + asmcmd : '-f obj -o $OBJ -w-orphan-labels $ASM'; supported_targets : [system_i386_embedded, system_i8086_msdos]; flags : [af_needar,af_no_debug]; labelprefix : '..@'; @@ -1222,7 +1222,7 @@ interface id : as_i386_nasmwdosx; idtxt : 'NASMWDOSX'; asmbin : 'nasm'; - asmcmd : '-f win32 -o $OBJ $ASM'; + asmcmd : '-f win32 -o $OBJ -w-orphan-labels $ASM'; supported_targets : [system_i386_wdosx]; flags : [af_needar,af_no_debug]; labelprefix : '..@'; @@ -1236,7 +1236,7 @@ interface id : as_i386_nasmelf; idtxt : 'NASMELF'; asmbin : 'nasm'; - asmcmd : '-f elf -o $OBJ $ASM'; + asmcmd : '-f elf -o $OBJ -w-orphan-labels $ASM'; supported_targets : [system_i386_linux]; flags : [af_needar,af_no_debug]; labelprefix : '..@'; @@ -1249,7 +1249,7 @@ interface id : as_i386_nasmbeos; idtxt : 'NASMELF'; asmbin : 'nasm'; - asmcmd : '-f elf -o $OBJ $ASM'; + asmcmd : '-f elf -o $OBJ -w-orphan-labels $ASM'; supported_targets : [system_i386_beos]; flags : [af_needar,af_no_debug]; labelprefix : '..@'; @@ -1262,7 +1262,7 @@ interface id : as_i386_nasmhaiku; idtxt : 'NASMELF'; asmbin : 'nasm'; - asmcmd : '-f elf -o $OBJ $ASM'; + asmcmd : '-f elf -o $OBJ -w-orphan-labels $ASM'; supported_targets : [system_i386_haiku]; flags : [af_needar,af_no_debug]; labelprefix : '..@'; diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index c864269f8c..e3f428f17a 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -756,7 +756,7 @@ unit cgx86; current_asmdata.asmlists[al_imports]:=TAsmList.create; new_section(current_asmdata.asmlists[al_imports],sec_stub,'',0); - result := current_asmdata.RefAsmSymbol(stubname); + result := current_asmdata.DefineAsmSymbol(stubname,AB_LOCAL,AT_FUNCTION); current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0)); { register as a weak symbol if necessary } if weak then diff --git a/compiler/x86_64/cgcpu.pas b/compiler/x86_64/cgcpu.pas index 1744378c3b..eb0c7d87bd 100644 --- a/compiler/x86_64/cgcpu.pas +++ b/compiler/x86_64/cgcpu.pas @@ -40,9 +40,14 @@ unit cgcpu; procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);override; procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override; procedure g_local_unwind(list: TAsmList; l: TAsmLabel);override; + procedure g_save_registers(list: TAsmList);override; + procedure g_restore_registers(list: TAsmList);override; procedure a_loadmm_intreg_reg(list: TAsmList; fromsize, tosize : tcgsize;intreg, mmreg: tregister; shuffle: pmmshuffle); override; procedure a_loadmm_reg_intreg(list: TAsmList; fromsize, tosize : tcgsize;mmreg, intreg: tregister;shuffle : pmmshuffle); override; + private + function use_push: boolean; + function saved_xmm_reg_size: longint; end; procedure create_codegen; @@ -65,7 +70,6 @@ unit cgcpu; RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15); var i : longint; - framepointer : tsuperregister; begin inherited init_register_allocators; @@ -91,17 +95,12 @@ unit cgcpu; saved_standard_registers[i]:=others_saved_std_regs[i]; end; end; - if assigned(current_procinfo) then - framepointer:=getsupreg(current_procinfo.framepointer) - else - { in intf. wrapper code generation } - framepointer:=RS_FRAME_POINTER_REG; if target_info.system=system_x86_64_win64 then rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_R8,RS_R9,RS_R10, - RS_R11,RS_RBX,RS_RSI,RS_RDI,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer]) + RS_R11,RS_RBX,RS_RSI,RS_RDI,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[]) else rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RSI,RS_RDI,RS_R8, - RS_R9,RS_R10,RS_R11,RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer]); + RS_R9,RS_R10,RS_R11,RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[]); rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBWHOLE,[RS_XMM0,RS_XMM1,RS_XMM2,RS_XMM3,RS_XMM4,RS_XMM5,RS_XMM6,RS_XMM7, RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15],first_mm_imreg,[]); @@ -109,6 +108,29 @@ unit cgcpu; end; + function tcgx86_64.use_push: boolean; + begin + result:=(current_procinfo.framepointer=NR_STACK_POINTER_REG) or + (current_procinfo.procdef.proctypeoption=potype_exceptfilter); + end; + + + function tcgx86_64.saved_xmm_reg_size: longint; + var + i: longint; + begin + result:=0; + if (target_info.system<>system_x86_64_win64) or + (not uses_registers(R_MMREGISTER)) then + exit; + for i:=low(saved_mm_registers) to high(saved_mm_registers) do + begin + if (saved_mm_registers[i] in rg[R_MMREGISTER].used_in_proc) then + inc(result,tcgsize2size[OS_VECTOR]); + end; + end; + + procedure tcgx86_64.g_proc_entry(list : TAsmList;localsize:longint;nostackframe:boolean); var hitem: tlinkedlistitem; @@ -119,6 +141,30 @@ unit cgcpu; suppress_endprologue: boolean; stackmisalignment: longint; para: tparavarsym; + xmmsize: longint; + + procedure push_one_reg(reg: tregister); + begin + list.concat(taicpu.op_reg(A_PUSH,tcgsize2opsize[OS_ADDR],reg)); + if (target_info.system=system_x86_64_win64) then + begin + list.concat(cai_seh_directive.create_reg(ash_pushreg,reg)); + include(current_procinfo.flags,pi_has_unwind_info); + end; + end; + + procedure push_regs; + var + r: longint; + begin + for r := low(saved_standard_registers) to high(saved_standard_registers) do + if saved_standard_registers[r] in rg[R_INTREGISTER].used_in_proc then + begin + inc(stackmisalignment,sizeof(pint)); + push_one_reg(newreg(R_INTREGISTER,saved_standard_registers[r],R_SUBWHOLE)); + end; + end; + begin hitem:=list.last; { pi_has_unwind_info may already be set at this point if there are @@ -133,17 +179,15 @@ unit cgcpu; stackmisalignment := sizeof(pint); list.concat(tai_regalloc.alloc(current_procinfo.framepointer,nil)); if current_procinfo.framepointer=NR_STACK_POINTER_REG then - CGmessage(cg_d_stackframe_omited) + begin + push_regs; + CGmessage(cg_d_stackframe_omited); + end else begin { push <frame_pointer> } inc(stackmisalignment,sizeof(pint)); - list.concat(Taicpu.op_reg(A_PUSH,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG)); - if (target_info.system=system_x86_64_win64) then - begin - list.concat(cai_seh_directive.create_reg(ash_pushreg,NR_FRAME_POINTER_REG)); - include(current_procinfo.flags,pi_has_unwind_info); - end; + push_one_reg(NR_FRAME_POINTER_REG); { Return address and FP are both on stack } current_asmdata.asmcfi.cfa_def_cfa_offset(list,2*sizeof(pint)); current_asmdata.asmcfi.cfa_offset(list,NR_FRAME_POINTER_REG,-(2*sizeof(pint))); @@ -151,6 +195,7 @@ unit cgcpu; list.concat(Taicpu.op_reg_reg(A_MOV,tcgsize2opsize[OS_ADDR],NR_STACK_POINTER_REG,NR_FRAME_POINTER_REG)) else begin + push_regs; { load framepointer from hidden $parentfp parameter } para:=tparavarsym(current_procinfo.procdef.paras[0]); if not (vo_is_parentfp in para.varoptions) then @@ -176,6 +221,14 @@ unit cgcpu; } end; + xmmsize:=saved_xmm_reg_size; + if use_push and (xmmsize<>0) then + begin + localsize:=align(localsize,target_info.stackalign)+xmmsize; + reference_reset_base(current_procinfo.save_regs_ref,NR_STACK_POINTER_REG, + localsize-xmmsize,tcgsize2size[OS_VECTOR]); + end; + { allocate stackframe space } if (localsize<>0) or ((target_info.stackalign>sizeof(pint)) and @@ -194,6 +247,16 @@ unit cgcpu; if localsize<>0 then list.concat(cai_seh_directive.create_offset(ash_stackalloc,localsize)); include(current_procinfo.flags,pi_has_unwind_info); + if use_push and (xmmsize<>0) then + begin + href:=current_procinfo.save_regs_ref; + for r:=low(saved_mm_registers) to high(saved_mm_registers) do + if saved_mm_registers[r] in rg[R_MMREGISTER].used_in_proc then + begin + a_loadmm_reg_ref(list,OS_VECTOR,OS_VECTOR,newreg(R_MMREGISTER,saved_mm_registers[r],R_SUBMMWHOLE),href,nil); + inc(href.offset,tcgsize2size[OS_VECTOR]); + end; + end; end; end; end; @@ -206,7 +269,7 @@ unit cgcpu; { We need to record postive offsets from RSP; if registers are saved at negative offsets from RBP we need to account for it. } - if current_procinfo.framepointer=NR_FRAME_POINTER_REG then + if (not use_push) then frame_offset:=current_procinfo.final_localsize else frame_offset:=0; @@ -215,14 +278,17 @@ unit cgcpu; since registers are not modified before they are saved, and saves do not change RSP, 'logically' all saves can happen at the end of prologue. } href:=current_procinfo.save_regs_ref; - for r:=low(saved_standard_registers) to high(saved_standard_registers) do - if saved_standard_registers[r] in rg[R_INTREGISTER].used_in_proc then - begin - templist.concat(cai_seh_directive.create_reg_offset(ash_savereg, - newreg(R_INTREGISTER,saved_standard_registers[r],R_SUBWHOLE), - href.offset+frame_offset)); - inc(href.offset,sizeof(aint)); - end; + if (not use_push) then + begin + for r:=low(saved_standard_registers) to high(saved_standard_registers) do + if saved_standard_registers[r] in rg[R_INTREGISTER].used_in_proc then + begin + templist.concat(cai_seh_directive.create_reg_offset(ash_savereg, + newreg(R_INTREGISTER,saved_standard_registers[r],R_SUBWHOLE), + href.offset+frame_offset)); + inc(href.offset,sizeof(aint)); + end; + end; if uses_registers(R_MMREGISTER) then begin if (href.offset mod tcgsize2size[OS_VECTOR])<>0 then @@ -262,6 +328,8 @@ unit cgcpu; var href : treference; + hreg : tregister; + r : longint; begin { Release PIC register } if cs_create_pic in current_settings.moduleswitches then @@ -274,11 +342,26 @@ unit cgcpu; { remove stackframe } if not nostackframe then begin - if (current_procinfo.framepointer=NR_STACK_POINTER_REG) or - (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then + if use_push then begin + if (saved_xmm_reg_size<>0) then + begin + href:=current_procinfo.save_regs_ref; + for r:=low(saved_mm_registers) to high(saved_mm_registers) do + if saved_mm_registers[r] in rg[R_MMREGISTER].used_in_proc then + begin + { Allocate register so the optimizer does not remove the load } + hreg:=newreg(R_MMREGISTER,saved_mm_registers[r],R_SUBMMWHOLE); + a_reg_alloc(list,hreg); + a_loadmm_ref_reg(list,OS_VECTOR,OS_VECTOR,href,hreg,nil); + inc(href.offset,tcgsize2size[OS_VECTOR]); + end; + end; + if (current_procinfo.final_localsize<>0) then increase_sp(current_procinfo.final_localsize); + internal_restore_regs(list,true); + if (current_procinfo.procdef.proctypeoption=potype_exceptfilter) then list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_ADDR],NR_FRAME_POINTER_REG)); end @@ -294,7 +377,7 @@ unit cgcpu; end else list.concat(Taicpu.op_none(A_LEAVE,S_NO)); - list.concat(tai_regalloc.dealloc(NR_FRAME_POINTER_REG,nil)); + list.concat(tai_regalloc.dealloc(current_procinfo.framepointer,nil)); end; list.concat(Taicpu.Op_none(A_RET,S_NO)); @@ -306,6 +389,20 @@ unit cgcpu; end; + procedure tcgx86_64.g_save_registers(list: TAsmList); + begin + if (not use_push) then + inherited g_save_registers(list); + end; + + + procedure tcgx86_64.g_restore_registers(list: TAsmList); + begin + if (not use_push) then + inherited g_restore_registers(list); + end; + + procedure tcgx86_64.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); var make_global : boolean; @@ -349,8 +446,7 @@ unit cgcpu; cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,href,NR_RAX); { jmp *vmtoffs(%eax) ; method offs } reference_reset_base(href,NR_RAX,tobjectdef(procdef.struct).vmtmethodoffset(procdef.extnumber),sizeof(pint)); - list.concat(taicpu.op_ref_reg(A_MOV,S_Q,href,NR_RAX)); - list.concat(taicpu.op_reg(A_JMP,S_Q,NR_RAX)); + list.concat(taicpu.op_ref(A_JMP,S_Q,href)); end else begin |
