diff --git a/compiler/cutils.pas b/compiler/cutils.pas index 99fefd3558..3233ae47d5 100644 --- a/compiler/cutils.pas +++ b/compiler/cutils.pas @@ -50,6 +50,8 @@ interface function SwapLong(x : longint): longint;{$ifdef USEINLINE}inline;{$endif} {# Returns the value in @va(x) swapped to different endian } function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif} + {# Returns the value in @va(x) swapped to different endian } + Function SwapQWord(x : qword) : qword{$ifdef USEINLINE}inline;{$endif} {# Return value @var(i) aligned on @var(a) boundary } function align(i,a:longint):longint;{$ifdef USEINLINE}inline;{$endif} @@ -211,6 +213,13 @@ uses End; + Function SwapQWord(x : qword) : qword{$ifdef USEINLINE}inline;{$endif} + Begin + result:=swaplong(longint(hi(x))); + result:=result or (swaplong(longint(lo(x))) shl 32); + End; + + Function SwapWord(x : word): word;{$ifdef USEINLINE}inline;{$endif} var z : byte; diff --git a/compiler/i386/i386att.inc b/compiler/i386/i386att.inc index 895be5db74..178e4e981b 100644 --- a/compiler/i386/i386att.inc +++ b/compiler/i386/i386att.inc @@ -380,6 +380,10 @@ 'xlatb', 'xor', 'xstore', +'xcryptecb', +'xcryptcbc', +'xcryptcfb', +'xcryptofb', 'cmov', 'j', 'set', @@ -563,6 +567,29 @@ 'movddup', 'movshdup', 'movsldup', +'vmread', +'vmwrite', +'vmcall', +'vmlaunch', +'vmresume', +'vmxoff', +'vmxon', +'vmclear', +'vmptrld', +'vmptrst', +'vmrun', +'vmmcall', +'vmload', +'vmsave', +'stgi', +'clgi', +'skinit', +'invlpga', +'montmul', +'xsha1', +'xsha256', +'dmint', +'rdm', 'movabs', 'movslq', 'cqto' diff --git a/compiler/i386/i386atts.inc b/compiler/i386/i386atts.inc index b6584499f8..e5dc5a2153 100644 --- a/compiler/i386/i386atts.inc +++ b/compiler/i386/i386atts.inc @@ -380,6 +380,10 @@ attsufNONE, attsufNONE, attsufINT, attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, attsufINT, attsufNONE, attsufINT, @@ -565,5 +569,28 @@ attsufNONE, attsufNONE, attsufNONE, attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, attsufNONE ); diff --git a/compiler/i386/i386int.inc b/compiler/i386/i386int.inc index 428a64f8cf..2ccfb80f05 100644 --- a/compiler/i386/i386int.inc +++ b/compiler/i386/i386int.inc @@ -380,6 +380,10 @@ 'xlatb', 'xor', 'xstore', +'xcryptecb', +'xcryptcbc', +'xcryptcfb', +'xcryptofb', 'cmov', 'j', 'set', @@ -563,6 +567,29 @@ 'movddup', 'movshdup', 'movsldup', +'vmread', +'vmwrite', +'vmcall', +'vmlaunch', +'vmresume', +'vmxoff', +'vmxon', +'vmclear', +'vmptrld', +'vmptrst', +'vmrun', +'vmmcall', +'vmload', +'vmsave', +'stgi', +'clgi', +'skinit', +'invlpga', +'montmul', +'xsha1', +'xsha256', +'dmint', +'rdm', 'movabs', 'movsxd', 'cqo' diff --git a/compiler/i386/i386nop.inc b/compiler/i386/i386nop.inc index b65a0310c4..24830769e7 100644 --- a/compiler/i386/i386nop.inc +++ b/compiler/i386/i386nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -1650; +1679; diff --git a/compiler/i386/i386op.inc b/compiler/i386/i386op.inc index 4c011681b0..889d8a767f 100644 --- a/compiler/i386/i386op.inc +++ b/compiler/i386/i386op.inc @@ -380,6 +380,10 @@ A_XLAT, A_XLATB, A_XOR, A_XSTORE, +A_XCRYPTECB, +A_XCRYPTCBC, +A_XCRYPTCFB, +A_XCRYPTOFB, A_CMOVcc, A_Jcc, A_SETcc, @@ -563,6 +567,29 @@ A_LDDQU, A_MOVDDUP, A_MOVSHDUP, A_MOVSLDUP, +A_VMREAD, +A_VMWRITE, +A_VMCALL, +A_VMLAUNCH, +A_VMRESUME, +A_VMXOFF, +A_VMXON, +A_VMCLEAR, +A_VMPTRLD, +A_VMPTRST, +A_VMRUN, +A_VMMCALL, +A_VMLOAD, +A_VMSAVE, +A_STGI, +A_CLGI, +A_SKINIT, +A_INVLPGA, +A_MONTMUL, +A_XSHA1, +A_XSHA256, +A_DMINT, +A_RDM, A_MOVABS, A_MOVSXD, A_CQO diff --git a/compiler/i386/i386prop.inc b/compiler/i386/i386prop.inc index df064ad42e..1dd8320b36 100644 --- a/compiler/i386/i386prop.inc +++ b/compiler/i386/i386prop.inc @@ -380,6 +380,10 @@ (Ch: (Ch_WEAX, Ch_REBX, Ch_None)), (Ch: (Ch_Mop2, Ch_Rop1, Ch_WFlags)), (Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_ROp1, Ch_WOp2, Ch_RFLAGS)), (Ch: (Ch_None, Ch_None, Ch_None)), (Ch: (Ch_RFLAGS, Ch_WOp1, Ch_None)), @@ -563,6 +567,29 @@ (Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_Wop2, Ch_Rop1, Ch_None)), (Ch: (Ch_Wop2, Ch_Rop1, Ch_None)), (Ch: (Ch_MRAX, Ch_WRDX, Ch_None)) diff --git a/compiler/i386/i386tab.inc b/compiler/i386/i386tab.inc index c9b7c0ac94..f2fa42908e 100644 --- a/compiler/i386/i386tab.inc +++ b/compiler/i386/i386tab.inc @@ -8848,6 +8848,34 @@ code : #3#15#167#192; flags : if_p6 or if_cyrix ), + ( + opcode : A_XCRYPTECB; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#200; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_XCRYPTCBC; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#208; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_XCRYPTCFB; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#224; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_XCRYPTOFB; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#232; + flags : if_p6 or if_cyrix + ), ( opcode : A_CMOVcc; ops : 2; @@ -11549,5 +11577,180 @@ optypes : (ot_xmmreg,ot_xmmreg,ot_none); code : #3#243#15#18#72; flags : if_prescott or if_sse3 + ), + ( + opcode : A_VMREAD; + ops : 2; + optypes : (ot_reg32,ot_reg32,ot_none); + code : #192#2#15#120#65; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMREAD; + ops : 2; + optypes : (ot_memory,ot_reg32,ot_none); + code : #192#2#15#120#65; + flags : if_386 or if_priv or if_prot or if_sm + ), + ( + opcode : A_VMWRITE; + ops : 2; + optypes : (ot_reg32,ot_reg32,ot_none); + code : #193#2#15#121#72; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMWRITE; + ops : 2; + optypes : (ot_reg32,ot_memory,ot_none); + code : #193#2#15#121#72; + flags : if_386 or if_priv or if_prot or if_sm + ), + ( + opcode : A_VMCALL; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#193; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMLAUNCH; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#194; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMRESUME; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#195; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMXOFF; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#196; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMXON; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#219#2#15#199#134; + flags : if_priv or if_prot + ), + ( + opcode : A_VMCLEAR; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#3#102#15#199#134; + flags : if_priv or if_prot + ), + ( + opcode : A_VMPTRLD; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#2#15#199#134; + flags : if_priv or if_prot + ), + ( + opcode : A_VMPTRST; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#2#15#199#135; + flags : if_priv or if_prot + ), + ( + opcode : A_VMRUN; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#216; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_VMMCALL; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#217; + flags : if_386 or if_svm + ), + ( + opcode : A_VMLOAD; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#218; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_VMSAVE; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#219; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_STGI; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#220; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_CLGI; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#221; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_SKINIT; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#222; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_INVLPGA; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#223; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_MONTMUL; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#166#192; + flags : if_centaur + ), + ( + opcode : A_XSHA1; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#166#200; + flags : if_centaur + ), + ( + opcode : A_XSHA256; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#166#208; + flags : if_centaur + ), + ( + opcode : A_DMINT; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #2#15#57; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_RDM; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #2#15#58; + flags : if_p6 or if_cyrix ) ); diff --git a/compiler/msg/errore.msg b/compiler/msg/errore.msg index 882f7a7df2..224a276cbb 100644 --- a/compiler/msg/errore.msg +++ b/compiler/msg/errore.msg @@ -1791,6 +1791,7 @@ asmw_e_duplicate_label=08016_E_Asm: Duplicate label $1 asmw_e_redefined_label=08017_E_Asm: Redefined label $1 asmw_e_first_defined_label=08018_E_Asm: First defined here asmw_e_invalid_register=08019_E_Asm: Invalid register $1 +asmw_e_16bit_32bit_not_supported=08020_E_Asm: 16 or 32 Bit references not supported # # Executing linker/assembler diff --git a/compiler/msgidx.inc b/compiler/msgidx.inc index 13ffde8525..146e7ce90e 100644 --- a/compiler/msgidx.inc +++ b/compiler/msgidx.inc @@ -535,6 +535,7 @@ const asmw_e_redefined_label=08017; asmw_e_first_defined_label=08018; asmw_e_invalid_register=08019; + asmw_e_16bit_32bit_not_supported=08020; exec_w_source_os_redefined=09000; exec_i_assembling_pipe=09001; exec_d_cant_create_asmfile=09002; @@ -669,9 +670,9 @@ const option_info=11024; option_help_pages=11025; - MsgTxtSize = 39753; + MsgTxtSize = 39804; MsgIdxMax : array[1..20] of longint=( - 19,74,219,59,62,47,100,20,135,60, + 19,74,219,59,62,47,100,21,135,60, 41,1,1,1,1,1,1,1,1,1 ); diff --git a/compiler/msgtxt.inc b/compiler/msgtxt.inc index dd7f52ab7f..bd423b7c7e 100644 --- a/compiler/msgtxt.inc +++ b/compiler/msgtxt.inc @@ -583,154 +583,154 @@ const msgtxt : array[0..000165,1..240] of char=( '08017_E_Asm: Redefined label $1'#000+ '08018_E_Asm: First defined here'#000+ '08019_E_Asm: Invalid register $1'#000+ - '09000_W_Source operating system redefined'#000+ - '09001_I_Assembling',' (pipe) $1'#000+ + '08020_E_Asm: 16 or 32 Bit references not supported'#000+ + '09000_W_S','ource 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'#000+ '09004_E_Can'#039't create archive file: $1'#000+ - '09005_E_Assembler $1 not found, switching to external assembling'#000+ + '09005_E_Assembler $1 not found, switching to external assemblin','g'#000+ '09006_T_Using assembler: $1'#000+ - '09007_E_Error while a','ssembling exitcode $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+ '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, Li','nking may fail !'#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+ '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+ + '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 script $1'#000+ '09021_E_resource compiler not found, switching to external mode'#000+ - '09022_I_Compiling resource $1'#000+ - '09023_T_unit $1 can'#039't be statically linked, switchi','ng to smart l'+ - 'inking'#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 linking'+ #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 st','atic linked'#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+ '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',' uninitialized data: $1 bytes'#000+ + '09131_X','_Size of initialized 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+ '10000_T_Unitsearch: $1'#000+ '10001_T_PPU Loading $1'#000+ '10002_U_PPU Name: $1'#000+ - '10003_U_PPU Flags: $1'#000+ + '10003_U_PPU F','lags: $1'#000+ '10004_U_PPU Crc: $1'#000+ '10005_U_PPU Time: $1'#000+ - '1','0006_U_PPU File too short'#000+ + '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+ - '10010_U_PPU is compiled for an other target'#000+ + '10010_U_PPU is compiled for an other ','target'#000+ '10011_U_PPU Source: $1'#000+ '10012_U_Writing $1'#000+ - '10','013_F_Can'#039't Write PPU-File'#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+ '10017_F_PPU Dbx count problem'#000+ '10018_E_Illegal unit name: $1'#000+ - '10019_F_Too much units'#000+ - '10020_F_Circular unit referen','ce between $1 and $2'#000+ + '1','0019_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'#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, + '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_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+ - '1','0031_U_Recompiling unit, shared lib is older than ppufile'#000+ + '10030_U_R','ecompiling 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 than ppufile'#000+ '10033_U_Recompiling unit, obj is older than asm'#000+ - '10034_U_Parsing interface of $1'#000+ + '10034_U_Parsing interf','ace of $1'#000+ '10035_U_Parsing implementation of $1'#000+ - '1003','6_U_Second load for unit $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 modifed include files'#000+ '10041_H_File $1 is newer than Release PPU file $2'#000+ - '10042_U_Using a unit which was not compiled with correct FPU mo','de'#000+ + '10042_U_Usin','g a unit which was not compiled with correct FPU mode'#000+ '10043_U_Loading interface units from $1'#000+ '10044_U_Loading implementation 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_Add dependency of $1',' to $2'#000+ + '10047_U_Fini','shed compiling unit $1'#000+ + '10048_U_Add dependency of $1 to $2'#000+ '10049_U_No reload, is caller: $1'#000+ '10050_U_No reload, already 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_Load','ing unit $1'#000+ + '10054_U_Alread','y compiling $1, setting second compile'#000+ + '10055_U_Loading unit $1'#000+ '10056_U_Finished loading unit $1'#000+ '10057_U_Registering new unit $1'#000+ '10058_U_Re-resolving unit $1'#000+ '10059_U_Skipping re-resolving unit $1, still loading used units'#000+ - '11000_O_$1 [options] [options]'#000+ - '11001_W_Only one source fil','e supported'#000+ + '11000_O_$1 [options','] [options]'#000+ + '11001_W_Only one source file supported'#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 file'#000+ + '11005_N_No option inside $1 config file',#000+ '11006_E_Illegal parameter: $1'#000+ - '11007_H_-? writes he','lp pages'#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 supported on DOS platform, reverting to static'+ - #000+ - '11013_F_too man','y IF(N)DEFs'#000+ + '11012_W_Shared libs not supported o','n DOS platform, reverting to stat'+ + 'ic'#000+ + '11013_F_too many IF(N)DEFs'#000+ '11014_F_too many ENDIFs'#000+ '11015_F_open conditional at the end of the file'#000+ '11016_W_Debug information generation is not supported by this executab'+ 'le'#000+ - '11017_H_Try recompiling with -dGDB'#000+ + '11017_H_Try recompiling with -dG','DB'#000+ '11018_E_You are using the obsolete switch $1'#000+ - '110','19_E_You are using the obsolete switch $1, please use $2'#000+ + '11019_E_You are 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 op','tions from file $1'#000+ + '1','1022_W_"$1" assembler use forced'#000+ + '11026_T_Reading options from file $1'#000+ '11027_T_Reading options from environment $1'#000+ '11028_D_Handling option "$1"'#000+ '11029__*** press enter ***'#000+ '11030_H_Start of reading config file $1'#000+ - '11031_H_End of reading config file $1'#000+ + '11031_H_End of reading config ','file $1'#000+ '11032_D_interpreting option "$1"'#000+ - '11036_D_in','terpreting firstpass option "$1"'#000+ + '11036_D_interpreting firstpass option "$1"'#000+ '11033_D_interpreting file option "$1"'#000+ '11034_D_Reading config file "$1"'#000+ '11035_D_found source file name "$1"'#000+ '11039_E_Unknown code page'#000+ - '11040_F_Config file $1 is a directory'#000+ - '11023_Free Pascal Compiler version $','FPCVERSION [$FPCDATE] for $FPCCP'+ - 'U'#010+ + '11040_F_Config file $1 ','is a directory'#000+ + '11023_Free Pascal Compiler version $FPCVERSION [$FPCDATE] for $FPCCPU'#010+ 'Copyright (c) 1993-2005 by Florian Klaempfl'#000+ '11024_Free Pascal Compiler version $FPCVERSION'#010+ #010+ 'Compiler Date : $FPCDATE'#010+ 'Compiler CPU Target: $FPCCPU'#010+ #010+ - 'Supported targets:'#010+ + 'Sup','ported targets:'#010+ ' $OSTARGETS'#010+ #010+ - 'Supported CPU instruc','tion sets:'#010+ + 'Supported CPU instruction sets:'#010+ ' $INSTRUCTIONSETS'#010+ #010+ 'Supported FPU instruction sets:'#010+ @@ -739,170 +739,170 @@ const msgtxt : array[0..000165,1..240] of char=( 'This program comes under the GNU General Public Licence'#010+ 'For more information read COPYING.FPC'#010+ #010+ - 'Report bugs,suggestions etc to:'#010+ - ' bugrep@fre','epascal.org'#000+ + 'Report b','ugs,suggestions etc to:'#010+ + ' bugrep@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 file'#010+ - '**2al_list sourcecode lines in assembler file'#010+ + '**2al_list sourcecode lines in assembl','er file'#010+ '**2an_list node info in assembler file'#010+ - '*L2a','p_use pipes instead of creating temporary assembler files'#010+ + '*L2ap_use pipes instead of creating temporary assembler files'#010+ '**2ar_list register allocation/release info in assembler file'#010+ '**2at_list temp allocation/release info in assembler file'#010+ - '**1A_output format:'#010+ + '**1A_out','put format:'#010+ '**2Adefault_use default assembler'#010+ - '3*2Aa','s_assemble using GNU AS'#010+ + '3*2Aas_assemble using GNU AS'#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*2Anasmwdosx_Win32/WDOSX object file',' using Nasm'#010+ '3*2Awasm_obj file using Wasm (Watcom)'#010+ - '3','*2Anasmobj_obj file using Nasm'#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_elf32 (Linux) using internal writer'#010+ - '3*2Acoff_coff (Go32v2) using internal writer'#010+ - '3*2Apecoff_pecoff (Win32) using internal',' writer'#010+ + '3*2Acoff_coff (Go32v2) using inter','nal writer'#010+ + '3*2Apecoff_pecoff (Win32) using internal writer'#010+ '4*2Aas_assemble using GNU AS'#010+ '6*2Aas_Unix o-file using GNU AS'#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+ + 'A*2Aas_assemble using GN','U AS'#010+ 'P*2Aas_assemble using GNU AS'#010+ - 'S*2Aas_assemble u','sing 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+ '**1C_code generation options:'#010+ '**2Cc_set default calling convention to '#010+ - '**2CD_create also dynamic library (not supported)'#010+ - '**2Ce_Compilati','on with emulated floating point opcodes'#010+ + '**2CD_create a','lso dynamic library (not supported)'#010+ + '**2Ce_Compilation with emulated floating point opcodes'#010+ '**2Cf_Select fpu instruction set to use, see fpc -i for possible va'+ 'lues'#010+ '**2Cg_Generate PIC code'#010+ - '**2Ch_ bytes heap (between 1023 and 67107840)'#010+ + '**2Ch_ bytes heap (between 1023 and 67107840',')'#010+ '**2Ci_IO-checking'#010+ '**2Cn_omit linking stage'#010+ - '**2Co_','check overflow of integer operations'#010+ + '**2Co_check overflow of integer operations'#010+ '**2Cp_select instruction set, see fpc -i for possible values'#010+ '**2Cr_range checking'#010+ '**2CR_verify object method call validity'#010+ - '**2Cs_set stack size to '#010+ + '**2Cs_set stack size to',' '#010+ '**2Ct_stack checking'#010+ - '**2CX_create also smartli','nked library'#010+ + '**2CX_create also smartlinked library'#010+ '**1d_defines the symbol '#010+ '**1D_generate a DEF file'#010+ '**2Dd_set description to '#010+ '**2Dv_set DLL version to '#010+ '*O2Dw_PM application'#010+ '**1e_set path to executable'#010+ - '**1E_same as -Cn'#010+ + '**1E','_same as -Cn'#010+ '**1F_set file names and paths:'#010+ - '**2F','a[,y]_for a program load first units and [y] before uses '+ - 'is parsed'#010+ + '**2Fa[,y]_for a program load first units and [y] before uses is'+ + ' parsed'#010+ '**2Fc_sets input codepage to '#010+ '**2FD_sets the directory where to search for compiler utilities'#010+ - '**2Fe_redirect error output to '#010+ - '**2FE_set exe/unit out','put path to '#010+ + '**2Fe_red','irect error output to '#010+ + '**2FE_set exe/unit output path to '#010+ '**2Fi_adds to include path'#010+ '**2Fl_adds to library path'#010+ '**2FL_uses as dynamic linker'#010+ '**2Fo_adds to object path'#010+ - '**2Fr_load error message file '#010+ + '**2Fr_load error message file ',#010+ '**2Fu_adds to unit path'#010+ - '**2FU_set unit o','utput path to , overrides -FE'#010+ + '**2FU_set unit output path to , overrides -FE'#010+ '*g1g_generate debugger information:'#010+ '*g2gc_generate checks for pointers'#010+ '*g2gd_use dbx'#010+ '*g2gg_use gsym'#010+ '*g2gh_use heap trace unit (for memory leak debugging)'#010+ - '*g2gl_use line info unit to show more info for backtr','aces'#010+ + '*g','2gl_use line info unit to show more info for backtraces'#010+ '*g2gv_generates programs traceable with valgrind'#010+ '*g2gw_generate dwarf debugging info'#010+ '**1i_information'#010+ '**2iD_return compiler date'#010+ '**2iV_return compiler version'#010+ - '**2iSO_return compiler OS'#010+ + '**2iSO_return compiler OS',#010+ '**2iSP_return compiler processor'#010+ - '**2iTO_return tar','get OS'#010+ + '**2iTO_return target OS'#010+ '**2iTP_return target processor'#010+ '**1I_adds to include path'#010+ '**1k_Pass to the linker'#010+ '**1l_write logo'#010+ '**1M_set language mode to '#010+ - '**2Mfpc_free pascal dialect (default)'#010+ + '**2Mfpc_free pascal dialect (default)'#010, '**2Mobjfpc_switch some Delphi 2 extensions on'#010+ - '**2Md','elphi_tries to be Delphi compatible'#010+ + '**2Mdelphi_tries to be Delphi compatible'#010+ '**2Mtp_tries to be TP/BP 7.0 compatible'#010+ '**2Mgpc_tries to be gpc compatible'#010+ '**2Mmacpas_tries to be compatible to the macintosh pascal dialects'#010+ - '**1n_don'#039't read the default config file'#010+ - '**1N_node tree opti','mizations'#010+ + '**1n_don'#039't ','read the default config file'#010+ + '**1N_node tree optimizations'#010+ '**2Nu_unroll loops'#010+ '**1o_change the name of the executable produced to '#010+ '**1O_optimizations:'#010+ '3*2Oa_= set alignment'#010+ '3*2Og_generate smaller code'#010+ - '3*2OG_generate faster code (default)'#010+ - '**2Or_keep certain variables ','in registers'#010+ + '3*2OG_generate ','faster code (default)'#010+ + '**2Or_keep certain variables in registers'#010+ '3*2Ou_enable uncertain optimizations (see docs)'#010+ '3*2O1_level 1 optimizations (quick optimizations)'#010+ '3*2O2_level 2 optimizations (-O1 + slower optimizations)'#010+ - '3*2O3_level 3 optimizations (-O2 repeatedly, max 5 times)'#010+ - '3*2Op_targe','t processor:'#010+ + '3*2O3_level 3 optimiz','ations (-O2 repeatedly, max 5 times)'#010+ + '3*2Op_target processor:'#010+ '3*3Op1_set target processor to 386/486'#010+ '3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#010+ '3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#010+ - '6*2Og_generate smaller code'#010+ + '6*2Og_generate smaller code'#010, '6*2OG_generate faster code (default)'#010+ - '6*2Ox_optimize',' maximum (still BUGGY!!!)'#010+ + '6*2Ox_optimize maximum (still BUGGY!!!)'#010+ '6*2O0_set target processor to a MC68000'#010+ '6*2O2_set target processor to a MC68020+ (default)'#010+ '**1pg_generate profile code for gprof (defines FPC_PROFILE)'#010+ - '**1R_assembler reading style:'#010+ - '**2Rdefault_use default assemb','ler'#010+ + '**1R_asse','mbler reading style:'#010+ + '**2Rdefault_use default assembler'#010+ '3*2Ratt_read AT&T style assembler'#010+ '3*2Rintel_read Intel style assembler'#010+ '6*2RMOT_read motorola style assembler'#010+ '**1S_syntax options:'#010+ '**2S2_same as -Mobjfpc'#010+ - '**2Sc_supports operators like C (*=,+=,/= and -=)'#010+ - '**2Sa_include assertion code.'#010, + '**2Sc_supports operators like',' C (*=,+=,/= and -=)'#010+ + '**2Sa_include assertion code.'#010+ '**2Sd_same as -Mdelphi'#010+ '**2Se_error options. is a combination of the following:'#010+ '**3*_ : compiler stops after the errors (default is 1)'#010+ - '**3*_w : compiler stops also after warnings'#010+ + '**3*_w : compiler stops also after warnin','gs'#010+ '**3*_n : compiler stops also after notes'#010+ - '**3*_h ',': compiler stops also after hints'#010+ + '**3*_h : compiler stops also after hints'#010+ '**2Sg_allow LABEL and GOTO'#010+ '**2Sh_Use ansistrings'#010+ '**2Si_support C++ styled INLINE'#010+ '**2Sk_load fpcylix unit'#010+ '**2SI_set interface style to '#010+ - '**3SIcom_COM compatible interface (default)'#010+ - '**3SIcorba_CORBA comp','atible interface'#010+ + '**3SIcom_COM c','ompatible interface (default)'#010+ + '**3SIcorba_CORBA compatible interface'#010+ '**2Sm_support macros like C (global)'#010+ '**2So_same as -Mtp'#010+ '**2Sp_same as -Mgpc'#010+ '**2Ss_constructor name must be init (destructor must be done)'#010+ - '**2St_allow static keyword in objects'#010+ + '**2St_allow static keyword in obje','cts'#010+ '**1s_don'#039't call assembler and linker'#010+ - '**2sh_Gene','rate script to link on host'#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_Target operating system:'#010+ - '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+ + '3*2Temx_OS/2 via EMX (including EMX','/RSX extender)'#010+ '3*2Tfreebsd_FreeBSD'#010+ - '3*2Tgo32v2_Versi','on 2 of DJ Delorie DOS extender'#010+ + '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+ '3*2Tlinux_Linux'#010+ '3*2Tnetbsd_NetBSD'#010+ '3*2Tnetware_Novell Netware Module (clib)'#010+ '3*2Tnetwlibc_Novell Netware Module (libc)'#010+ '3*2Topenbsd_OpenBSD'#010+ - '3*2Tos2_OS/2 / eComStation'#010+ + '3*2Tos2_OS/2 / eComS','tation'#010+ '3*2Tsunos_SunOS/Solaris'#010+ - '3*2Twatcom_Watcom co','mpatible DOS extender'#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+ @@ -910,59 +910,59 @@ const msgtxt : array[0..000165,1..240] of char=( '6*2Tamiga_Commodore Amiga'#010+ '6*2Tatari_Atari ST/STe/TT'#010+ '6*2Tlinux_Linux/m68k'#010+ - '6*2Tmacos_Macintosh m68k (not supported)'#010+ - '6*2Tpalmos_Pa','lmOS'#010+ + '6*2','Tmacos_Macintosh m68k (not supported)'#010+ + '6*2Tpalmos_PalmOS'#010+ 'A*2Tlinux_Linux'#010+ 'A*2Twince_Windows CE'#010+ 'P*2Tamiga_AmigaOS on PowerPC'#010+ 'P*2Tdarwin_Darwin and MacOS X on PowerPC'#010+ 'P*2Tlinux_Linux on PowerPC'#010+ 'P*2Tmacos_MacOS (classic) on PowerPC'#010+ - 'P*2Tmorphos_MorphOS'#010+ + 'P*2Tmorphos_M','orphOS'#010+ 'S*2Tlinux_Linux'#010+ - '**1u_undefines the symbol',' '#010+ + '**1u_undefines the symbol '#010+ '**1U_unit options:'#010+ '**2Un_don'#039't check the unit name'#010+ '**2Ur_generate release unit files'#010+ '**2Us_compile a system unit'#010+ '**1v_Be verbose. is a combination of the following letters:'#010+ - '**2*_e : Show errors (default) 0 : Show nothing (','except errors'+ + '**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*_h : Show hints c : Show conditionals'#010+ - '**2*_i : Show general info d : Show d','ebug info'#010+ + '**2*_h : Show hints c : Show condition','als'#010+ + '**2*_i : Show general info d : Show debug info'#010+ '**2*_l : Show linenumbers r : Rhide/GCC compatibility mode'#010+ '**2*_a : Show everything x : Executable info (Win32 only)'#010+ - '**2*_b : Write file names messages with full path'#010+ - '**2*_v : write fpcdebug.txt with p :',' Write tree.log with parse t'+ - 'ree'#010+ + '**2*_b : Write file names messages with',' full path'#010+ + '**2*_v : write fpcdebug.txt with p : Write tree.log with parse tre'+ + 'e'#010+ '**2*_ lots of debugging info'#010+ '3*1W_Win32-like target options'#010+ '3*2WB_Create a relocatable image'#010+ '3*2WB_Set Image base to Hexadecimal value'#010+ - '3*2WC_Specify console type application'#010+ - '3*2WD_Use DEFFILE to ','export functions of DLL or EXE'#010+ + '3*2WC_Spe','cify console type application'#010+ + '3*2WD_Use DEFFILE to export functions of DLL or EXE'#010+ '3*2WF_Specify full-screen type application (OS/2 only)'#010+ '3*2WG_Specify graphic type application'#010+ - '3*2WN_Do not generate relocation code (necessary for debugging)'#010+ + '3*2WN_Do not generate relocation code (necessary for debugging)'#010, '3*2WR_Generate relocation code'#010+ - 'P*2WC_Specify consol','e type application (MacOS only)'#010+ + 'P*2WC_Specify console type application (MacOS only)'#010+ 'P*2WG_Specify graphic type application (MacOS only)'#010+ 'P*2WT_Specify tool type application (MPW tool, MacOS only)'#010+ '**1X_executable options:'#010+ - '**2Xc_pass --shared to the linker (Unix only)'#010+ - '**2Xd_don'#039't use standard l','ibrary search path (needed for cross c'+ - 'ompile)'#010+ + '**2Xc_pass --shared t','o the linker (Unix only)'#010+ + '**2Xd_don'#039't use standard library search path (needed for cross com'+ + 'pile)'#010+ '**2XD_try to link units dynamic (defines FPC_LINK_DYNAMIC)'#010+ '**2Xm_generate link map'#010+ - '**2XM_set the name of the '#039'main'#039' program routine (default i'+ - 's '#039'main'#039')'#010+ - '**2XP_prepend the binutils ','names with the prefix '#010+ + '**2XM_set the name of the '#039'main'#039' program routine',' (default'+ + ' is '#039'main'#039')'#010+ + '**2XP_prepend the binutils names with the prefix '#010+ '**2Xr_set library search path to (needed for cross compile)'#010+ '**2Xs_strip all symbols from executable'#010+ - '**2XS_try to link units static (default) (defines FPC_LINK_STATIC)'#010+ - '**2Xt_link with static libraries (-stati','c is passed to linker)'#010+ + '**2XS_try to link units static (default) (defines FPC_LI','NK_STATIC)'#010+ + '**2Xt_link with static libraries (-static is passed to linker)'#010+ '**2XX_try to link units smart (defines FPC_LINK_SMART)'#010+ '**1*_'#010+ '**1?_shows this help'#010+ diff --git a/compiler/ogelf.pas b/compiler/ogelf.pas index ec85bbac38..633ac8e612 100644 --- a/compiler/ogelf.pas +++ b/compiler/ogelf.pas @@ -120,6 +120,61 @@ implementation R_386_GOTOFF = 9; { an offset from GOT base } R_386_GOTPC = 10; { a PC-relative offset _to_ GOT } + R_SPARC_32 = 3; + R_SPARC_WDISP30 = 7; + R_SPARC_HI22 = 9; + R_SPARC_LO10 = 12; + + { AMD64 relocations } + R_X86_64_NONE = 0; + { Direct 64 bit } + R_X86_64_64 = 1; + { PC relative 32 bit signed } + R_X86_64_PC32 = 2; + { 32 bit GOT entry } + R_X86_64_GOT32 = 3; + { 32 bit PLT address } + R_X86_64_PLT32 = 4; + { Copy symbol at runtime } + R_X86_64_COPY = 5; + { Create GOT entry } + R_X86_64_GLOB_DAT = 6; + { Create PLT entry } + R_X86_64_JUMP_SLOT = 7; + { Adjust by program base } + R_X86_64_RELATIVE = 8; + { 32 bit signed PC relative offset to GOT } + R_X86_64_GOTPCREL = 9; + { Direct 32 bit zero extended } + R_X86_64_32 = 10; + { Direct 32 bit sign extended } + R_X86_64_32S = 11; + { Direct 16 bit zero extended } + R_X86_64_16 = 12; + { 16 bit sign extended pc relative } + R_X86_64_PC16 = 13; + { Direct 8 bit sign extended } + R_X86_64_8 = 14; + { 8 bit sign extended pc relative } + R_X86_64_PC8 = 15; + { ID of module containing symbol } + R_X86_64_DTPMOD64 = 16; + { Offset in module's TLS block } + R_X86_64_DTPOFF64 = 17; + { Offset in initial TLS block } + R_X86_64_TPOFF64 = 18; + { 32 bit signed PC relative offset to two GOT entries for GD symbol } + R_X86_64_TLSGD = 19; + { 32 bit signed PC relative offset to two GOT entries for LD symbol } + R_X86_64_TLSLD = 20; + { Offset in TLS block } + R_X86_64_DTPOFF32 = 21; + { 32 bit signed PC relative offset to GOT entry for IE symbol } + R_X86_64_GOTTPOFF = 22; + { Offset in initial TLS block } + R_X86_64_TPOFF32 = 23; + R_X86_64_NUM = 24; + SHN_UNDEF = 0; SHN_ABS = $fff1; SHN_COMMON = $fff2; @@ -199,6 +254,211 @@ implementation end; + telf64header=packed record + magic0123 : longint; + file_class : byte; + data_encoding : byte; + file_version : byte; + padding : array[$07..$0f] of byte; + e_type : word; + e_machine : word; + e_version : longint; + e_entry : qword; { entrypoint } + e_phoff : qword; { program header offset } + e_shoff : qword; { sections header offset } + e_flags : longint; + e_ehsize : word; { elf header size in bytes } + e_phentsize : word; { size of an entry in the program header array } + e_phnum : word; { 0..e_phnum-1 of entrys } + e_shentsize : word; { size of an entry in sections header array } + e_shnum : word; { 0..e_shnum-1 of entrys } + e_shstrndx : word; { index of string section header } + end; + telf64sechdr=packed record + sh_name : longint; + sh_type : longint; + sh_flags : qword; + sh_addr : qword; + sh_offset : qword; + sh_size : qword; + sh_link : longint; + sh_info : longint; + sh_addralign : qword; + sh_entsize : qword; + end; + telf64reloc=packed record + address : qword; + info : qword; { bit 0-7: type, 8-31: symbol } + addend : qword; + end; + telf64symbol=packed record + st_name : longint; + st_info : byte; { bit 0-3: type, 4-7: bind } + st_other : byte; + st_shndx : word; + st_value : qword; + st_size : qword; + end; + telf64stab=packed record + strpos : longint; + ntype : byte; + nother : byte; + ndesc : word; + nvalue : longint; + end; + + +{$ifdef cpu64bit} + telfheader = telf64header; + telfreloc = telf64reloc; + telfsymbol = telf64symbol; + telfsechdr = telf64sechdr; +{$else cpu64bit} + telfheader = telf32header; + telfreloc = telf32reloc; + telfsymbol = telf32symbol; + telfsechdr = telf32sechdr; +{$endif cpu64bit} + + + function MayBeSwapHeader(h : telf32header) : telf32header; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.e_type:=swapword(e_type); + result.e_machine:=swapword(e_machine); + result.e_version:=swaplong(e_version); + result.e_entry:=swaplong(e_entry); + result.e_phoff:=swaplong(e_phoff); + result.e_shoff:=swaplong(e_shoff); + result.e_flags:=swaplong(e_flags); + result.e_ehsize:=swapword(e_ehsize); + result.e_phentsize:=swapword(e_phentsize); + result.e_phnum:=swapword(e_phnum); + result.e_shentsize:=swapword(e_shentsize); + result.e_shnum:=swapword(e_shnum); + result.e_shstrndx:=swapword(e_shstrndx); + end; + end; + + + function MayBeSwapHeader(h : telf64header) : telf64header; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.e_type:=swapword(e_type); + result.e_machine:=swapword(e_machine); + result.e_version:=swaplong(e_version); + result.e_entry:=swapqword(e_entry); + result.e_phoff:=swapqword(e_phoff); + result.e_shoff:=swapqword(e_shoff); + result.e_flags:=swaplong(e_flags); + result.e_ehsize:=swapword(e_ehsize); + result.e_phentsize:=swapword(e_phentsize); + result.e_phnum:=swapword(e_phnum); + result.e_shentsize:=swapword(e_shentsize); + result.e_shnum:=swapword(e_shnum); + result.e_shstrndx:=swapword(e_shstrndx); + end; + end; + + + function MaybeSwapSecHeader(h : telf32sechdr) : telf32sechdr; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.sh_name:=SwapLong(sh_name); + result.sh_type:=SwapLong(sh_type); + result.sh_flags:=SwapLong(sh_flags); + result.sh_addr:=SwapLong(sh_addr); + result.sh_offset:=SwapLong(sh_offset); + result.sh_size:=SwapLong(sh_size); + result.sh_link:=SwapLong(sh_link); + result.sh_info:=SwapLong(sh_info); + result.sh_addralign:=SwapLong(sh_addralign); + result.sh_entsize:=SwapLong(sh_entsize); + end; + end; + + + function MaybeSwapSecHeader(h : telf64sechdr) : telf64sechdr; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.sh_name:=SwapLong(sh_name); + result.sh_type:=SwapLong(sh_type); + result.sh_flags:=SwapQWord(sh_flags); + result.sh_addr:=SwapQWord(sh_addr); + result.sh_offset:=SwapQWord(sh_offset); + result.sh_size:=SwapQWord(sh_size); + result.sh_link:=SwapLong(sh_link); + result.sh_info:=SwapLong(sh_info); + result.sh_addralign:=SwapQWord(sh_addralign); + result.sh_entsize:=SwapQWord(sh_entsize); + end; + end; + + + function MaybeSwapElfSymbol(h : telf32symbol) : telf32symbol; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.st_name:=SwapLong(st_name); + result.st_value:=SwapLong(st_value); + result.st_size:=SwapLong(st_size); + result.st_shndx:=SwapWord(st_shndx); + end; + end; + + + function MaybeSwapElfSymbol(h : telf64symbol) : telf64symbol; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.st_name:=SwapLong(st_name); + result.st_value:=SwapQWord(st_value); + result.st_size:=SwapQWord(st_size); + result.st_shndx:=SwapWord(st_shndx); + end; + end; + + + function MaybeSwapElfReloc(h : telf32reloc) : telf32reloc; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.address:=SwapLong(address); + result.info:=SwapLong(info); + end; + end; + + + function MaybeSwapElfReloc(h : telf64reloc) : telf64reloc; + begin + result:=h; + if source_info.endian<>target_info.endian then + with h do + begin + result.address:=SwapQWord(address); + result.info:=SwapQWord(info); + end; + end; + + {**************************************************************************** Helpers ****************************************************************************} @@ -296,7 +556,7 @@ implementation { reset } Syms:=TDynamicArray.Create(symbolresize); { default sections } - symtabsect:=TElf32ObjSection.create_ext('.symtab',2,0,0,0,4,16); + symtabsect:=TElf32ObjSection.create_ext('.symtab',2,0,0,0,4,sizeof(telfsymbol)); strtabsect:=TElf32ObjSection.create_ext('.strtab',3,0,0,0,1,0); shstrtabsect:=TElf32ObjSection.create_ext('.shstrtab',3,0,0,0,1,0); { insert the empty and filename as first in strtab } @@ -308,6 +568,9 @@ implementation createsection(sec_bss,''); if tf_section_threadvars in target_info.flags then createsection(sec_threadvar,''); + if (tf_needs_dwarf_cfi in target_info.flags) and + (af_supports_dwarf in target_asm.flags) then + createsection(sec_debug_frame,''); end; @@ -335,7 +598,7 @@ implementation '.eh_frame', '.debug_frame','.debug_info','.debug_line','.debug_abbrev', 'fpc', - '' + '' ); begin if (use_smartlink_section and @@ -393,8 +656,10 @@ implementation else begin CurrObjSec.addsymreloc(CurrObjSec.Size,p,relative); +{$ifndef x86_64} if relative=RELOC_RELATIVE then dec(data,len); +{$endif x86_64} end; end; CurrObjSec.write(data,len); @@ -436,7 +701,7 @@ implementation procedure TElf32ObjectOutput.createrelocsection(s:TElf32ObjSection); var - rel : TElf32reloc; + rel : telfreloc; r : TObjRelocation; relsym,reltyp : longint; begin @@ -452,7 +717,15 @@ implementation end; {$endif userodata} { create the reloc section } +{$ifdef i386} s.relocsect:=TElf32ObjSection.create_ext('.rel'+s.name,9,0,symtabsect.secshidx,s.secshidx,4,8); +{$endif i386} +{$ifdef x86_64} + s.relocsect:=TElf32ObjSection.create_ext('.rela'+s.name,4,0,symtabsect.secshidx,s.secshidx,4,3*8); +{$endif x86_64} +{$ifdef sparc} + s.relocsect:=TElf32ObjSection.create_ext('.rel'+s.name,4,0,symtabsect.secshidx,s.secshidx,4,8); +{$endif sparc} { add the relocations } r:=TObjRelocation(s.relocations.first); while assigned(r) do @@ -474,15 +747,50 @@ implementation relsym:=r.objsection.secsymidx else relsym:=SHN_UNDEF; + + { when things settle down, we can create processor specific + derived classes + } +{$ifdef i386} case r.typ of RELOC_RELATIVE : reltyp:=R_386_PC32; RELOC_ABSOLUTE : reltyp:=R_386_32; end; +{$endif i386} +{$ifdef sparc} + case r.typ of +{ RELOC_RELATIVE : + reltyp:=R_386_PC32; +} + RELOC_ABSOLUTE : + reltyp:=R_SPARC_32; + else + internalerror(200410201); + end; +{$endif sparc} +{$ifdef x86_64} + case r.typ of + RELOC_RELATIVE : + begin + reltyp:=R_X86_64_PC32; + { length of the relocated location is handled here } + rel.addend:=-4; + end; + RELOC_ABSOLUTE : + reltyp:=R_X86_64_64; + else + internalerror(200602261); + end; +{$endif x86_64} +{$ifdef cpu64bit} + rel.info:=(qword(relsym) shl 32) or reltyp; +{$else cpu64bit} rel.info:=(relsym shl 8) or reltyp; +{$endif cpu64bit} { write reloc } - s.relocsect.write(rel,sizeof(rel)); + s.relocsect.write(MaybeSwapElfReloc(rel),sizeof(rel)); r:=TObjRelocation(r.next); end; end; @@ -491,7 +799,7 @@ implementation procedure TElf32ObjectOutput.section_write_symbol(p:TObject;arg:pointer); var - elfsym : TElf32symbol; + elfsym : telfsymbol; begin fillchar(elfsym,sizeof(elfsym),0); elfsym.st_name:=TElf32ObjSection(p).shstridx; @@ -500,14 +808,15 @@ implementation TObjSection(p).secsymidx:=symidx; inc(symidx); inc(localsyms); - elf32data.symtabsect.write(elfsym,sizeof(elfsym)); + elf32data.symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); end; procedure TElf32ObjectOutput.createsymtab; var - elfsym : TElf32symbol; - i : longint; + elfsym : telfsymbol; + i, + locals : longint; objsym : TObjSymbol; begin with elf32data do @@ -516,14 +825,14 @@ implementation localsyms:=0; { empty entry } fillchar(elfsym,sizeof(elfsym),0); - symtabsect.write(elfsym,sizeof(elfsym)); + symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); inc(symidx); inc(localsyms); { filename entry } elfsym.st_name:=1; elfsym.st_info:=STT_FILE; elfsym.st_shndx:=SHN_ABS; - symtabsect.write(elfsym,sizeof(elfsym)); + symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); inc(symidx); inc(localsyms); { section } @@ -582,7 +891,7 @@ implementation end; objsym.symidx:=symidx; inc(symidx); - symtabsect.write(elfsym,sizeof(elfsym)); + symtabsect.write(MaybeSwapElfSymbol(elfsym),sizeof(elfsym)); end; end; { update the .symtab section header } @@ -618,7 +927,7 @@ implementation procedure TElf32ObjectOutput.writesectionheader(s:TElf32ObjSection); var - sechdr : TElf32sechdr; + sechdr : telfsechdr; begin fillchar(sechdr,sizeof(sechdr),0); sechdr.sh_name:=s.shstridx; @@ -630,11 +939,10 @@ implementation sechdr.sh_info:=s.shinfo; sechdr.sh_addralign:=s.secalign; sechdr.sh_entsize:=s.shentsize; - writer.write(sechdr,sizeof(sechdr)); + writer.write(MaybeSwapSecHeader(sechdr),sizeof(sechdr)); end; - procedure TElf32ObjectOutput.writesectiondata(s:TElf32ObjSection); begin FWriter.writezeros(s.dataalignbytes); @@ -700,7 +1008,7 @@ implementation function TElf32ObjectOutput.writedata(data:TObjData):boolean; var - header : TElf32header; + header : telfheader; shoffset, datapos : aint; nsections : word; @@ -735,7 +1043,7 @@ implementation shstrtabsect.setdatapos(datapos); { section headers } shoffset:=datapos; - inc(datapos,nsections*sizeof(TElf32sechdr)); + inc(datapos,nsections*sizeof(telfsechdr)); { symtab } symtabsect.setdatapos(datapos); { strtab } @@ -746,25 +1054,52 @@ implementation { Write ELF Header } fillchar(header,sizeof(header),0); header.magic0123:=$464c457f; { = #127'ELF' } +{$ifdef cpu64bit} + header.file_class:=2; +{$else cpu64bit} header.file_class:=1; +{$endif cpu64bit} + if target_info.endian=endian_big then + header.data_encoding:=2 + else header.data_encoding:=1; + header.file_version:=1; header.e_type:=1; +{$ifdef sparc} + header.e_machine:=2; +{$endif sparc} +{$ifdef i386} header.e_machine:=3; +{$endif i386} +{$ifdef m68k} + header.e_machine:=4; +{$endif m68k} +{$ifdef powerpc} + header.e_machine:=20; +{$endif powerpc} +{$ifdef arm} + header.e_machine:=40; +{$endif arm} +{$ifdef x86_64} + header.e_machine:=62; +{$endif x86_64} header.e_version:=1; header.e_shoff:=shoffset; header.e_shstrndx:=shstrtabsect.secshidx; + header.e_shnum:=nsections; - header.e_ehsize:=sizeof(TElf32header); - header.e_shentsize:=sizeof(TElf32sechdr); - writer.write(header,sizeof(header)); + header.e_ehsize:=sizeof(telfheader); + header.e_shentsize:=sizeof(telfsechdr); + writer.write(MaybeSwapHeader(header),sizeof(header)); + writer.writezeros($40-sizeof(header)); { align } { Sections } ObjSectionList.ForEachCall(@section_write_data,nil); { .shstrtab } writesectiondata(shstrtabsect); { section headers, start with an empty header for sh_undef } - writer.writezeros(sizeof(TElf32sechdr)); + writer.writezeros(sizeof(telfsechdr)); ObjSectionList.ForEachCall(@section_write_sechdr,nil); writesectionheader(shstrtabsect); writesectionheader(symtabsect); @@ -808,7 +1143,39 @@ implementation comment : ''; ); + as_x86_64_elf64_info : tasminfo = + ( + id : as_x86_64_elf64; + idtxt : 'ELF'; + asmbin : ''; + asmcmd : ''; + supported_target : system_any; //target_i386_linux; + flags : [af_outputbinary,af_smartlink_sections]; + labelprefix : '.L'; + comment : ''; + ); + + as_sparc_elf32_info : tasminfo = + ( + id : as_sparc_elf32; + idtxt : 'ELF'; + asmbin : ''; + asmcmd : ''; + supported_target : system_any; //target_i386_linux; +// flags : [af_outputbinary,af_smartlink_sections]; + flags : [af_outputbinary]; + labelprefix : '.L'; + comment : ''; + ); initialization +{$ifdef i386} RegisterAssembler(as_i386_elf32_info,TElf32Assembler); +{$endif i386} +{$ifdef sparc} + RegisterAssembler(as_sparc_elf32_info,TElf32Assembler); +{$endif sparc} +{$ifdef x86_64} + RegisterAssembler(as_x86_64_elf64_info,TElf32Assembler); +{$endif x86_64} end. diff --git a/compiler/systems.pas b/compiler/systems.pas index db621c0170..36b9546ff4 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -148,6 +148,8 @@ interface ,as_x86_64_pecoff ,as_i386_pecoffwince ,as_arm_pecoffwince + ,as_x86_64_elf64 + ,as_sparc_elf32 ); tar = (ar_none diff --git a/compiler/systems/i_linux.pas b/compiler/systems/i_linux.pas index cff8c67fb0..06cd279a0c 100644 --- a/compiler/systems/i_linux.pas +++ b/compiler/systems/i_linux.pas @@ -431,7 +431,7 @@ unit i_linux; Cprefix : ''; newline : #10; dirsep : '/'; - assem : as_gas; + assem : as_gas; { as_x86_64_elf64; } assemextern : as_gas; link : nil; linkextern : nil; diff --git a/compiler/x86/aasmcpu.pas b/compiler/x86/aasmcpu.pas index 89fe85fa95..bb0f9e8fa9 100644 --- a/compiler/x86/aasmcpu.pas +++ b/compiler/x86/aasmcpu.pas @@ -780,6 +780,11 @@ implementation if (ot and OT_BITS32)<>0 then s:=s+'32' else +{$ifdef x86_64} + if (ot and OT_BITS32)<>0 then + s:=s+'64' + else +{$endif x86_64} s:=s+'??'; { signed } if (ot and OT_SIGNED)<>0 then @@ -1371,11 +1376,11 @@ implementation ( ( (oper[opidx]^.ref^.index<>NR_NO) and - (getsubreg(oper[opidx]^.ref^.index)<>R_SUBD) + (getsubreg(oper[opidx]^.ref^.index)<>R_SUBADDR) ) or ( (oper[opidx]^.ref^.base<>NR_NO) and - (getsubreg(oper[opidx]^.ref^.base)<>R_SUBD) + (getsubreg(oper[opidx]^.ref^.base)<>R_SUBADDR) ) ); end; @@ -1406,6 +1411,156 @@ implementation end; +{$ifdef x86_64} + function process_ea(const input:toper;var output:ea;rfield:longint):boolean; + var + sym : tasmsymbol; + md,s,rv : byte; + base,index,scalefactor, + o : longint; + ir,br : Tregister; + isub,bsub : tsubregister; + begin + process_ea:=false; + {Register ?} + if (input.typ=top_reg) then + begin + rv:=regval(input.reg); + output.sib_present:=false; + output.bytes:=0; + output.modrm:=$c0 or (rfield shl 3) or rv; + output.size:=1; + process_ea:=true; + exit; + end; + {No register, so memory reference.} + if (input.typ<>top_ref) then + internalerror(200409262); + if ((input.ref^.index<>NR_NO) and (getregtype(input.ref^.index)<>R_INTREGISTER)) or + ((input.ref^.base<>NR_NO) and (getregtype(input.ref^.base)<>R_INTREGISTER)) then + internalerror(200301081); + ir:=input.ref^.index; + br:=input.ref^.base; + isub:=getsubreg(ir); + bsub:=getsubreg(br); + s:=input.ref^.scalefactor; + o:=input.ref^.offset; + sym:=input.ref^.symbol; + { it's direct address } + if (br=NR_NO) and (ir=NR_NO) then + begin + { it's a pure offset } + output.sib_present:=false; + output.bytes:=4; + output.modrm:=5 or (rfield shl 3); + end + else + { it's an indirection } + begin + { 16 bit address? } + if ((ir<>NR_NO) and (isub<>R_SUBADDR)) or + ((br<>NR_NO) and (bsub<>R_SUBADDR)) then +{$ifdef x86_64} + message(asmw_e_16bit_32bit_not_supported); +{$else x86_64} + message(asmw_e_16bit_not_supported); +{$endif x86_64} +{$ifdef OPTEA} + { make single reg base } + if (br=NR_NO) and (s=1) then + begin + br:=ir; + ir:=NR_NO; + end; + { convert [3,5,9]*EAX to EAX+[2,4,8]*EAX } + if (br=NR_NO) and + (((s=2) and (ir<>NR_ESP)) or + (s=3) or (s=5) or (s=9)) then + begin + br:=ir; + dec(s); + end; + { swap ESP into base if scalefactor is 1 } + if (s=1) and (ir=NR_ESP) then + begin + ir:=br; + br:=NR_ESP; + end; +{$endif OPTEA} + { wrong, for various reasons } + if (ir=NR_ESP) or ((s<>1) and (s<>2) and (s<>4) and (s<>8) and (ir<>NR_NO)) then + exit; + { base } + case br of + NR_RAX : base:=0; + NR_RCX : base:=1; + NR_RDX : base:=2; + NR_RBX : base:=3; + NR_RSP : base:=4; + NR_NO, + NR_RBP : base:=5; + NR_RSI : base:=6; + NR_RDI : base:=7; + else + exit; + end; + { index } + case ir of + NR_EAX : index:=0; + NR_ECX : index:=1; + NR_EDX : index:=2; + NR_EBX : index:=3; + NR_NO : index:=4; + NR_EBP : index:=5; + NR_ESI : index:=6; + NR_EDI : index:=7; + else + exit; + end; + case s of + 0, + 1 : scalefactor:=0; + 2 : scalefactor:=1; + 4 : scalefactor:=2; + 8 : scalefactor:=3; + else + exit; + end; + if (br=NR_NO) or + ((br<>NR_EBP) and (o=0) and (sym=nil)) then + md:=0 + else + if ((o>=-128) and (o<=127) and (sym=nil)) then + md:=1 + else + md:=2; + if (br=NR_NO) or (md=2) then + output.bytes:=4 + else + output.bytes:=md; + { SIB needed ? } + if (ir=NR_NO) and (br<>NR_ESP) then + begin + output.sib_present:=false; + output.modrm:=(md shl 6) or (rfield shl 3) or base; + end + else + begin + output.sib_present:=true; + output.modrm:=(md shl 6) or (rfield shl 3) or 4; + output.sib:=(scalefactor shl 6) or (index shl 3) or base; + end; + end; + if output.sib_present then + output.size:=2+output.bytes + else + output.size:=1+output.bytes; + process_ea:=true; + end; + + +{$else x86_64} + function process_ea(const input:toper;var output:ea;rfield:longint):boolean; var sym : tasmsymbol; @@ -1452,8 +1607,8 @@ implementation { it's an indirection } begin { 16 bit address? } - if ((ir<>NR_NO) and (isub<>R_SUBD)) or - ((br<>NR_NO) and (bsub<>R_SUBD)) then + if ((ir<>NR_NO) and (isub<>R_SUBADDR)) or + ((br<>NR_NO) and (bsub<>R_SUBADDR)) then message(asmw_e_16bit_not_supported); {$ifdef OPTEA} { make single reg base } @@ -1547,7 +1702,7 @@ implementation output.size:=1+output.bytes; process_ea:=true; end; - +{$endif x86_64} function taicpu.calcsize(p:PInsEntry):shortint; var diff --git a/compiler/x86/cpubase.pas b/compiler/x86/cpubase.pas index 2d8d4431d5..37219a3270 100644 --- a/compiler/x86/cpubase.pas +++ b/compiler/x86/cpubase.pas @@ -136,11 +136,15 @@ uses first_mm_imreg = $08; {$endif x86_64} - { The subregister that specifies the entire register } + { The subregister that specifies the entire register and an address } {$ifdef x86_64} - R_SUBWHOLE = R_SUBQ; {Hammer} + { Hammer } + R_SUBWHOLE = R_SUBQ; + R_SUBADDR = R_SUBQ; {$else x86_64} - R_SUBWHOLE = R_SUBD; {i386} + { i386 } + R_SUBWHOLE = R_SUBD; + R_SUBADDR = R_SUBD; {$endif x86_64} { Available Registers } diff --git a/compiler/x86/x86ins.dat b/compiler/x86/x86ins.dat index 6e863ec4cf..8d49b2b699 100644 --- a/compiler/x86/x86ins.dat +++ b/compiler/x86/x86ins.dat @@ -1207,18 +1207,24 @@ mem,reg16 \320\300\1\x89\101 8086,SM reg16,reg16 \320\300\1\x89\101 8086 mem,reg32 \321\300\1\x89\101 386,SM reg32,reg32 \321\300\1\x89\101 386 +mem,reg64 \322\300\1\x89\101 X86_64 +reg64,reg64 \322\300\1\x89\101 X86_64 reg8,mem \301\1\x8A\110 8086,SM reg8,reg8 \301\1\x8A\110 8086 reg16,mem \320\301\1\x8B\110 8086,SM reg16,reg16 \320\301\1\x8B\110 8086 reg32,mem \321\301\1\x8B\110 386,SM reg32,reg32 \321\301\1\x8B\110 386 +reg64,mem \322\301\1\x8B\110 X86_64 +reg64,reg64 \322\301\1\x8B\110 X86_64 reg8,imm \10\xB0\21 8086,SM reg16,imm \320\10\xB8\31 8086,SM reg32,imm \321\10\xB8\41 386,SM +reg64,imm \322\10\xB8\41 X86_64 rm8,imm \300\1\xC6\200\21 8086,SM rm16,imm \320\300\1\xC7\200\31 8086,SM rm32,imm \321\300\1\xC7\200\41 386,SM +rm64,imm \322\300\1\xC7\200\41 X86_64 mem,imm8 \300\1\xC6\200\21 8086,SM mem,imm16 \320\300\1\xC7\200\31 8086,SM mem,imm32 \321\300\1\xC7\200\41 386,SM @@ -1871,15 +1877,16 @@ xmmreg,xmmreg \3\x66\x0F\x61\110 WILLAMETTE,SSE2 [PUSH,pushX] (Ch_Rop1, Ch_RWESP, Ch_None) -reg16 \320\10\x50 8086,NOX86_64 -reg32 \321\10\x50 386,NOX86_64 -rm16 \320\300\1\xFF\206 8086,NOX86_64 -rm32 \321\300\1\xFF\206 386,NOX86_64 +reg16 \320\10\x50 8086 +reg32 \321\10\x50 386 +reg64 \321\10\x50 X86_64 +rm16 \320\300\1\xFF\206 8086 +rm32 \321\300\1\xFF\206 386 reg_fsgs \1\x0F\7 386,NOX86_64 reg_sreg \6 8086,NOX86_64 -imm8 \1\x6A\14 286,NOX86_64 -imm16 \320\1\x68\30 286,NOX86_64 -imm32 \321\1\x68\40 386,NOX86_64 +imm8 \1\x6A\14 286 +imm16 \320\1\x68\30 286 +imm32 \321\1\x68\40 386 [PUSHA,pushaX] (Ch_All, Ch_None, Ch_None) @@ -2236,20 +2243,28 @@ mem,reg16 \320\300\1\x29\101 8086,SM reg16,reg16 \320\300\1\x29\101 8086 mem,reg32 \321\300\1\x29\101 386,SM reg32,reg32 \321\300\1\x29\101 386 +mem,reg32 \321\300\1\x29\101 386,SM +reg32,reg32 \321\300\1\x29\101 386 +mem,reg64 \322\300\1\x29\101 X86_64 +reg64,reg64 \322\300\1\x29\101 X86_64 reg8,mem \301\1\x2A\110 8086,SM reg8,reg8 \301\1\x2A\110 8086 reg16,mem \320\301\1\x2B\110 8086,SM reg16,reg16 \320\301\1\x2B\110 8086 reg32,mem \321\301\1\x2B\110 386,SM reg32,reg32 \321\301\1\x2B\110 386 +reg64,reg64 \322\301\1\x2B\110 X86_64 rm16,imm8 \320\300\1\x83\205\15 8086 rm32,imm8 \321\300\1\x83\205\15 386 +rm64,imm8 \322\300\1\x83\205\15 X86_64 reg_al,imm \1\x2C\21 8086,SM reg_ax,imm \320\1\x2D\31 8086,SM reg_eax,imm \321\1\x2D\41 386,SM +reg_rax,imm \322\1\x2D\41 X86_64 rm8,imm \300\1\x80\205\21 8086,SM rm16,imm \320\300\1\x81\205\31 8086,SM rm32,imm \321\300\1\x81\205\41 386,SM +rm64,imm \322\300\1\x81\205\41 X86_64 mem,imm8 \300\1\x80\205\21 8086,SM mem,imm16 \320\300\1\x81\205\31 8086,SM mem,imm32 \321\300\1\x81\205\41 386,SM diff --git a/compiler/x86_64/x8664ats.inc b/compiler/x86_64/x8664ats.inc index b6584499f8..e5dc5a2153 100644 --- a/compiler/x86_64/x8664ats.inc +++ b/compiler/x86_64/x8664ats.inc @@ -380,6 +380,10 @@ attsufNONE, attsufNONE, attsufINT, attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, attsufINT, attsufNONE, attsufINT, @@ -565,5 +569,28 @@ attsufNONE, attsufNONE, attsufNONE, attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, +attsufNONE, attsufNONE ); diff --git a/compiler/x86_64/x8664att.inc b/compiler/x86_64/x8664att.inc index 895be5db74..178e4e981b 100644 --- a/compiler/x86_64/x8664att.inc +++ b/compiler/x86_64/x8664att.inc @@ -380,6 +380,10 @@ 'xlatb', 'xor', 'xstore', +'xcryptecb', +'xcryptcbc', +'xcryptcfb', +'xcryptofb', 'cmov', 'j', 'set', @@ -563,6 +567,29 @@ 'movddup', 'movshdup', 'movsldup', +'vmread', +'vmwrite', +'vmcall', +'vmlaunch', +'vmresume', +'vmxoff', +'vmxon', +'vmclear', +'vmptrld', +'vmptrst', +'vmrun', +'vmmcall', +'vmload', +'vmsave', +'stgi', +'clgi', +'skinit', +'invlpga', +'montmul', +'xsha1', +'xsha256', +'dmint', +'rdm', 'movabs', 'movslq', 'cqto' diff --git a/compiler/x86_64/x8664int.inc b/compiler/x86_64/x8664int.inc index 428a64f8cf..2ccfb80f05 100644 --- a/compiler/x86_64/x8664int.inc +++ b/compiler/x86_64/x8664int.inc @@ -380,6 +380,10 @@ 'xlatb', 'xor', 'xstore', +'xcryptecb', +'xcryptcbc', +'xcryptcfb', +'xcryptofb', 'cmov', 'j', 'set', @@ -563,6 +567,29 @@ 'movddup', 'movshdup', 'movsldup', +'vmread', +'vmwrite', +'vmcall', +'vmlaunch', +'vmresume', +'vmxoff', +'vmxon', +'vmclear', +'vmptrld', +'vmptrst', +'vmrun', +'vmmcall', +'vmload', +'vmsave', +'stgi', +'clgi', +'skinit', +'invlpga', +'montmul', +'xsha1', +'xsha256', +'dmint', +'rdm', 'movabs', 'movsxd', 'cqo' diff --git a/compiler/x86_64/x8664nop.inc b/compiler/x86_64/x8664nop.inc index abfe89b2fb..776da0c607 100644 --- a/compiler/x86_64/x8664nop.inc +++ b/compiler/x86_64/x8664nop.inc @@ -1,2 +1,2 @@ { don't edit, this file is generated from x86ins.dat } -1640; +1691; diff --git a/compiler/x86_64/x8664op.inc b/compiler/x86_64/x8664op.inc index 4c011681b0..889d8a767f 100644 --- a/compiler/x86_64/x8664op.inc +++ b/compiler/x86_64/x8664op.inc @@ -380,6 +380,10 @@ A_XLAT, A_XLATB, A_XOR, A_XSTORE, +A_XCRYPTECB, +A_XCRYPTCBC, +A_XCRYPTCFB, +A_XCRYPTOFB, A_CMOVcc, A_Jcc, A_SETcc, @@ -563,6 +567,29 @@ A_LDDQU, A_MOVDDUP, A_MOVSHDUP, A_MOVSLDUP, +A_VMREAD, +A_VMWRITE, +A_VMCALL, +A_VMLAUNCH, +A_VMRESUME, +A_VMXOFF, +A_VMXON, +A_VMCLEAR, +A_VMPTRLD, +A_VMPTRST, +A_VMRUN, +A_VMMCALL, +A_VMLOAD, +A_VMSAVE, +A_STGI, +A_CLGI, +A_SKINIT, +A_INVLPGA, +A_MONTMUL, +A_XSHA1, +A_XSHA256, +A_DMINT, +A_RDM, A_MOVABS, A_MOVSXD, A_CQO diff --git a/compiler/x86_64/x8664pro.inc b/compiler/x86_64/x8664pro.inc index df064ad42e..1dd8320b36 100644 --- a/compiler/x86_64/x8664pro.inc +++ b/compiler/x86_64/x8664pro.inc @@ -380,6 +380,10 @@ (Ch: (Ch_WEAX, Ch_REBX, Ch_None)), (Ch: (Ch_Mop2, Ch_Rop1, Ch_WFlags)), (Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_ROp1, Ch_WOp2, Ch_RFLAGS)), (Ch: (Ch_None, Ch_None, Ch_None)), (Ch: (Ch_RFLAGS, Ch_WOp1, Ch_None)), @@ -563,6 +567,29 @@ (Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), +(Ch: (Ch_All, Ch_None, Ch_None)), (Ch: (Ch_Wop2, Ch_Rop1, Ch_None)), (Ch: (Ch_Wop2, Ch_Rop1, Ch_None)), (Ch: (Ch_MRAX, Ch_WRDX, Ch_None)) diff --git a/compiler/x86_64/x8664tab.inc b/compiler/x86_64/x8664tab.inc index 11fcae0ac9..2c04511ddb 100644 --- a/compiler/x86_64/x8664tab.inc +++ b/compiler/x86_64/x8664tab.inc @@ -4214,6 +4214,20 @@ code : #209#192#1#137#65; flags : if_386 ), + ( + opcode : A_MOV; + ops : 2; + optypes : (ot_memory,ot_reg64,ot_none); + code : #210#192#1#137#65; + flags : if_x86_64 + ), + ( + opcode : A_MOV; + ops : 2; + optypes : (ot_reg64,ot_reg64,ot_none); + code : #210#192#1#137#65; + flags : if_x86_64 + ), ( opcode : A_MOV; ops : 2; @@ -4256,6 +4270,20 @@ code : #209#193#1#139#72; flags : if_386 ), + ( + opcode : A_MOV; + ops : 2; + optypes : (ot_reg64,ot_memory,ot_none); + code : #210#193#1#139#72; + flags : if_x86_64 + ), + ( + opcode : A_MOV; + ops : 2; + optypes : (ot_reg64,ot_reg64,ot_none); + code : #210#193#1#139#72; + flags : if_x86_64 + ), ( opcode : A_MOV; ops : 2; @@ -4277,6 +4305,13 @@ code : #209#8#184#33; flags : if_386 or if_sm ), + ( + opcode : A_MOV; + ops : 2; + optypes : (ot_reg64,ot_immediate,ot_none); + code : #210#8#184#33; + flags : if_x86_64 + ), ( opcode : A_MOV; ops : 2; @@ -4298,6 +4333,13 @@ code : #209#192#1#199#128#33; flags : if_386 or if_sm ), + ( + opcode : A_MOV; + ops : 2; + optypes : (ot_regmem or ot_bits64,ot_immediate,ot_none); + code : #210#192#1#199#128#33; + flags : if_x86_64 + ), ( opcode : A_MOV; ops : 2; @@ -6678,6 +6720,62 @@ code : #3#102#15#97#72; flags : if_willamette or if_sse2 ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_reg16,ot_none,ot_none); + code : #208#8#80; + flags : if_8086 + ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_reg32,ot_none,ot_none); + code : #209#8#80; + flags : if_386 + ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_reg64,ot_none,ot_none); + code : #209#8#80; + flags : if_x86_64 + ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_regmem or ot_bits16,ot_none,ot_none); + code : #208#192#1#255#134; + flags : if_8086 + ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_regmem or ot_bits32,ot_none,ot_none); + code : #209#192#1#255#134; + flags : if_386 + ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_immediate or ot_bits8 or ot_signed,ot_none,ot_none); + code : #1#106#12; + flags : if_286 + ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_immediate or ot_bits16,ot_none,ot_none); + code : #208#1#104#24; + flags : if_286 + ), + ( + opcode : A_PUSH; + ops : 1; + optypes : (ot_immediate or ot_bits32,ot_none,ot_none); + code : #209#1#104#32; + flags : if_386 + ), ( opcode : A_PUSHA; ops : 0; @@ -7924,6 +8022,34 @@ code : #209#192#1#41#65; flags : if_386 ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_memory,ot_reg32,ot_none); + code : #209#192#1#41#65; + flags : if_386 or if_sm + ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_reg32,ot_reg32,ot_none); + code : #209#192#1#41#65; + flags : if_386 + ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_memory,ot_reg64,ot_none); + code : #210#192#1#41#65; + flags : if_x86_64 + ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_reg64,ot_reg64,ot_none); + code : #210#192#1#41#65; + flags : if_x86_64 + ), ( opcode : A_SUB; ops : 2; @@ -7966,6 +8092,13 @@ code : #209#193#1#43#72; flags : if_386 ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_reg64,ot_reg64,ot_none); + code : #210#193#1#43#72; + flags : if_x86_64 + ), ( opcode : A_SUB; ops : 2; @@ -7980,6 +8113,13 @@ code : #209#192#1#131#133#13; flags : if_386 ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_regmem or ot_bits64,ot_immediate or ot_bits8 or ot_signed,ot_none); + code : #210#192#1#131#133#13; + flags : if_x86_64 + ), ( opcode : A_SUB; ops : 2; @@ -8001,6 +8141,13 @@ code : #209#1#45#33; flags : if_386 or if_sm ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_reg_rax,ot_immediate,ot_none); + code : #210#1#45#33; + flags : if_x86_64 + ), ( opcode : A_SUB; ops : 2; @@ -8022,6 +8169,13 @@ code : #209#192#1#129#133#33; flags : if_386 or if_sm ), + ( + opcode : A_SUB; + ops : 2; + optypes : (ot_regmem or ot_bits64,ot_immediate,ot_none); + code : #210#192#1#129#133#33; + flags : if_x86_64 + ), ( opcode : A_SUB; ops : 2; @@ -8750,6 +8904,34 @@ code : #3#15#167#192; flags : if_p6 or if_cyrix ), + ( + opcode : A_XCRYPTECB; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#200; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_XCRYPTCBC; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#208; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_XCRYPTCFB; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#224; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_XCRYPTOFB; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#167#232; + flags : if_p6 or if_cyrix + ), ( opcode : A_CMOVcc; ops : 2; @@ -11452,6 +11634,181 @@ code : #3#243#15#18#72; flags : if_prescott or if_sse3 ), + ( + opcode : A_VMREAD; + ops : 2; + optypes : (ot_reg32,ot_reg32,ot_none); + code : #192#2#15#120#65; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMREAD; + ops : 2; + optypes : (ot_memory,ot_reg32,ot_none); + code : #192#2#15#120#65; + flags : if_386 or if_priv or if_prot or if_sm + ), + ( + opcode : A_VMWRITE; + ops : 2; + optypes : (ot_reg32,ot_reg32,ot_none); + code : #193#2#15#121#72; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMWRITE; + ops : 2; + optypes : (ot_reg32,ot_memory,ot_none); + code : #193#2#15#121#72; + flags : if_386 or if_priv or if_prot or if_sm + ), + ( + opcode : A_VMCALL; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#193; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMLAUNCH; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#194; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMRESUME; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#195; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMXOFF; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#196; + flags : if_386 or if_priv or if_prot + ), + ( + opcode : A_VMXON; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#219#2#15#199#134; + flags : if_priv or if_prot + ), + ( + opcode : A_VMCLEAR; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#3#102#15#199#134; + flags : if_priv or if_prot + ), + ( + opcode : A_VMPTRLD; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#2#15#199#134; + flags : if_priv or if_prot + ), + ( + opcode : A_VMPTRST; + ops : 1; + optypes : (ot_memory,ot_none,ot_none); + code : #192#2#15#199#135; + flags : if_priv or if_prot + ), + ( + opcode : A_VMRUN; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#216; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_VMMCALL; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#217; + flags : if_386 or if_svm + ), + ( + opcode : A_VMLOAD; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#218; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_VMSAVE; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#219; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_STGI; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#220; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_CLGI; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#221; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_SKINIT; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#222; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_INVLPGA; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #3#15#1#223; + flags : if_386 or if_svm or if_priv or if_prot + ), + ( + opcode : A_MONTMUL; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#166#192; + flags : if_centaur + ), + ( + opcode : A_XSHA1; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#166#200; + flags : if_centaur + ), + ( + opcode : A_XSHA256; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #219#3#15#166#208; + flags : if_centaur + ), + ( + opcode : A_DMINT; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #2#15#57; + flags : if_p6 or if_cyrix + ), + ( + opcode : A_RDM; + ops : 0; + optypes : (ot_none,ot_none,ot_none); + code : #2#15#58; + flags : if_p6 or if_cyrix + ), ( opcode : A_MOVABS; ops : 2;