blob: 98b6ea66bbca363a938ea2ffd049c5939e0be834 [file] [log] [blame]
#
# i386 tests
#
proc run_list_test { name opts } {
global srcdir subdir
set testname "i386 $name"
set file $srcdir/$subdir/$name
gas_run ${name}.s $opts ">&dump.out"
if { [regexp_diff "dump.out" "${file}.l"] } then {
fail $testname
verbose "output is [file_contents "dump.out"]" 2
return
}
pass $testname
}
proc gas_64_check { } {
global NM
global NMFLAGS
global srcdir
catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
return [regexp "targets:.*x86-64" $nm_help]
}
proc gas_32_check { } {
global NM
global NMFLAGS
global srcdir
catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
return [regexp "targets:.*i386" $nm_help]
}
if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] then {
global ASFLAGS
set old_ASFLAGS "$ASFLAGS"
set ASFLAGS "$ASFLAGS --32"
run_list_test "float" "-al"
run_list_test "general" "-al --listing-lhs-width=2"
run_list_test "inval" "-al"
run_list_test "modrm" "-al --listing-lhs-width=2"
run_dump_test "naked"
run_dump_test "opcode"
run_dump_test "intel"
run_dump_test "intel16"
run_list_test "intelbad" ""
run_dump_test "intelok"
run_dump_test "prefix"
run_dump_test "amd"
run_dump_test "katmai"
run_dump_test "jump"
run_dump_test "ssemmx2"
run_dump_test "sse2"
run_dump_test "sub"
run_dump_test "prescott"
run_dump_test "sib"
if {![istarget "*-*-aix*"]
&& (![is_elf_format] || [istarget "*-*-linux*"]
|| [istarget "*-*-netbsd*"]
|| [istarget "*-*-freebsd*"]
|| [istarget "*-*-netware*"])} {
# Don't run this test on targets where '/' starts comments.
run_dump_test "divide"
}
run_dump_test "padlock"
# These tests require support for 8 and 16 bit relocs,
# so we only run them for ELF and COFF targets.
if {[is_elf_format] || [istarget "*-*-coff*"]} then {
run_dump_test "reloc"
run_dump_test "jump16"
run_list_test "white" "-al --listing-lhs-width=3"
# These tests should in theory work for PE targets as well,
# but the relocs we currently produce are slightly different
# from those produced for ELF/COFF based toolchains.
# So for now we ignore PE targets.
run_dump_test "pcrel"
run_dump_test "absrel"
}
# ELF specific tests
if [is_elf_format] then {
# PIC is only supported on ELF targets.
run_dump_test "intelpic"
run_dump_test "relax"
run_dump_test "gotpc"
run_dump_test "tlsd"
run_dump_test "tlspic"
run_dump_test "tlsnopic"
}
# This is a PE specific test.
if { [istarget "*-*-cygwin*"] || [istarget "*-*-pe"]
|| [istarget "*-*-mingw*"]
} then {
run_dump_test "secrel"
}
set ASFLAGS "$old_ASFLAGS"
}
if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] then {
global ASFLAGS
set old_ASFLAGS "$ASFLAGS"
set ASFLAGS "$ASFLAGS --64"
run_dump_test "x86_64"
run_dump_test "x86-64-addr32"
run_dump_test "x86-64-opcode"
run_dump_test "x86-64-rip"
run_list_test "x86-64-inval" "-al"
# For ELF targets verify that @unwind works.
if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"]
|| [istarget "*-*-solaris2.*"])
&& ![istarget *-*-linux*aout*]
&& ![istarget *-*-linux*oldld*] } then {
run_dump_test "x86-64-unwind"
}
set ASFLAGS "$old_ASFLAGS"
}