* throw an error if esp/rsp are used as index register

git-svn-id: trunk@49568 -
This commit is contained in:
florian 2021-06-27 21:21:19 +00:00
parent ba1b0883c2
commit ce1f9cce01
6 changed files with 375 additions and 366 deletions

1
.gitattributes vendored
View File

@ -12891,6 +12891,7 @@ tests/tbf/tb0271.pp svneol=native#text/pascal
tests/tbf/tb0272.pp svneol=native#text/plain
tests/tbf/tb0273.pp svneol=native#text/pascal
tests/tbf/tb0274.pp svneol=native#text/pascal
tests/tbf/tb0275.pp svneol=native#text/pascal
tests/tbf/tb0588.pp svneol=native#text/pascal
tests/tbf/ub0115.pp svneol=native#text/plain
tests/tbf/ub0149.pp svneol=native#text/plain

View File

@ -2929,7 +2929,7 @@ asmr_e_unknown_field=07145_E_Unknown field identifier
#
# Assembler/binary writers
#
# 08035 is the last used one
# 08036 is the last used one
#
asmw_f_too_many_asm_files=08000_F_Too many assembler files
% With smartlinking enabled, there are too many assembler
@ -2986,6 +2986,7 @@ asmw_e_instruction_not_supported_by_cpu=08032_E_Instruction not supported by the
asmw_e_brxx_out_of_range=08033_E_Asm: conditional branch destination is out of range
asmw_e_illegal_use_of_rip=08034_E_Asm: RIP cannot be used as index register or with another register in a reference
asmw_e_seh_invalid_data_size=08035_F_Illegal function size for SEH function
asmw_e_illegal_use_of_sp=08036_E_Asm: ESP/RSP cannot be used as index register
#
# Executing linker/assembler
#

View File

@ -895,6 +895,7 @@ const
asmw_e_brxx_out_of_range=08033;
asmw_e_illegal_use_of_rip=08034;
asmw_e_seh_invalid_data_size=08035;
asmw_e_illegal_use_of_sp=08036;
exec_w_source_os_redefined=09000;
exec_i_assembling_pipe=09001;
exec_d_cant_create_asmfile=09002;
@ -1139,9 +1140,9 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 87808;
MsgTxtSize = 87862;
MsgIdxMax : array[1..20] of longint=(
28,107,361,131,99,63,146,36,223,68,
28,107,361,131,99,63,146,37,223,68,
64,20,30,1,1,1,1,1,1,1
);

File diff suppressed because it is too large Load Diff

View File

@ -2584,6 +2584,8 @@ implementation
if ((br=NR_RIP) and (ir<>NR_NO)) or
(ir=NR_RIP) then
message(asmw_e_illegal_use_of_rip);
if ir=NR_STACK_POINTER_REG then
Message(asmw_e_illegal_use_of_sp);
{ 16 bit? }
if ((ir<>NR_NO) and (isub in [R_SUBMMX,R_SUBMMY,R_SUBMMZ]) and

7
tests/tbf/tb0275.pp Normal file
View File

@ -0,0 +1,7 @@
{ %fail }
{ %CPU=x86_64 }
begin
asm
movq (%rdi,%rsp),%rax
end;
end.