Re-enable msabi testing (#436)

* Revert "disable msabi testing for now"

This reverts commit 7b7638eb0e.

* x86: Correct testing for 64-bit x86-64

Since passing -m32 to x86-64 compiler will generate i386 code, we
need to check both __ILP32__ and __i386__ for 64-bit x86-64.

* x86: Check __i386__ instead of i?86-*-* targets

Since passing -m32 to x86-64 compiler will generate i386 code, we need
to check __i386__ instead of i?86-*-* targets for i386 targets.

* i386: Properly passing integer parameters in registers

For thiscall and fastcall, if the paramter passed as 64-bit integer or
struct, all following integer paramters will be passed on stack.

* test: Add ABI_ATTR to callback_code

Add ABI_ATTR to callback_code to properly test different ABIs.
This commit is contained in:
hjl-tools
2018-05-02 06:19:58 -07:00
committed by Anthony Green
parent ebf241663c
commit d3c54cf3a2
3 changed files with 107 additions and 88 deletions

View File

@@ -317,22 +317,23 @@ proc run-many-tests { testcases extra_flags } {
set targetabis { "" }
if [string match $compiler_vendor "gnu"] {
if [istarget "i?86-*-*"] {
if [libffi_feature_test "#ifdef __i386__"] {
set targetabis {
""
"-DABI_NUM=FFI_STDCALL -DABI_ATTR=__STDCALL__"
"-DABI_NUM=FFI_THISCALL -DABI_ATTR=__THISCALL__"
"-DABI_NUM=FFI_FASTCALL -DABI_ATTR=__FASTCALL__"
}
} elseif { [istarget "x86_64-*-*"] \
&& [libffi_feature_test "#if !defined __ILP32__ \
&& !defined __i386__"] } {
set targetabis {
""
"-DABI_NUM=FFI_WIN64 -DABI_ATTR=__MSABI__"
}
}
# elseif { [istarget "x86_64-*-*"] \
# && [libffi_feature_test "#ifndef __ILP32__"] } {
# set targetabis {
# ""
# "-DABI_NUM=FFI_WIN64 -DABI_ATTR=__MSABI__"
# }
# }
}
set common [ concat $common $extra_flags ]
foreach test $testcases {
set testname [file tail $test]