Line 0
Link Here
|
|
|
1 |
# Clang doesn't like the -Wno-psabi argument that we want to pass to GCC. |
2 |
# Since clang is detected as GCC via __GNUC__, use ax_cv_c_compiler_vendor. |
3 |
# https://github.com/atgreen/libffi/commit/b5ade2fb5d9ba06519484677a5474e5dad48c2e3 |
4 |
|
5 |
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp |
6 |
index 5051d31..0e92bb0 100644 |
7 |
--- testsuite/lib/libffi.exp |
8 |
+++ testsuite/lib/libffi.exp |
9 |
@@ -100,46 +100,39 @@ proc libffi-init { args } { |
10 |
global libffi_link_flags |
11 |
global tool_root_dir |
12 |
global ld_library_path |
13 |
- |
14 |
- global using_gcc |
15 |
+ global compiler_vendor |
16 |
|
17 |
set blddirffi [pwd]/.. |
18 |
verbose "libffi $blddirffi" |
19 |
|
20 |
- # Are we building with GCC? |
21 |
- set tmp [grep ../config.status "GCC='yes'"] |
22 |
- if { [string match $tmp "GCC='yes'"] } { |
23 |
- |
24 |
- set using_gcc "yes" |
25 |
+ # Which compiler are we building with? |
26 |
+ set tmp [grep ../config.log "^ax_cv_c_compiler_vendor.*$"] |
27 |
+ regexp -- {^[^=]*=(.*)$} $tmp nil compiler_vendor |
28 |
|
29 |
- set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] |
30 |
- if {$gccdir != ""} { |
31 |
- set gccdir [file dirname $gccdir] |
32 |
- } |
33 |
- verbose "gccdir $gccdir" |
34 |
- |
35 |
- set ld_library_path "." |
36 |
- append ld_library_path ":${gccdir}" |
37 |
- |
38 |
- set compiler "${gccdir}/xgcc" |
39 |
- if { [is_remote host] == 0 && [which $compiler] != 0 } { |
40 |
- foreach i "[exec $compiler --print-multi-lib]" { |
41 |
- set mldir "" |
42 |
- regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir |
43 |
- set mldir [string trimright $mldir "\;@"] |
44 |
- if { "$mldir" == "." } { |
45 |
- continue |
46 |
- } |
47 |
- if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { |
48 |
- append ld_library_path ":${gccdir}/${mldir}" |
49 |
+ if { [string match $compiler_vendor "gnu"] } { |
50 |
+ set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] |
51 |
+ if {$gccdir != ""} { |
52 |
+ set gccdir [file dirname $gccdir] |
53 |
+ } |
54 |
+ verbose "gccdir $gccdir" |
55 |
+ |
56 |
+ set ld_library_path "." |
57 |
+ append ld_library_path ":${gccdir}" |
58 |
+ |
59 |
+ set compiler "${gccdir}/xgcc" |
60 |
+ if { [is_remote host] == 0 && [which $compiler] != 0 } { |
61 |
+ foreach i "[exec $compiler --print-multi-lib]" { |
62 |
+ set mldir "" |
63 |
+ regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir |
64 |
+ set mldir [string trimright $mldir "\;@"] |
65 |
+ if { "$mldir" == "." } { |
66 |
+ continue |
67 |
+ } |
68 |
+ if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { |
69 |
+ append ld_library_path ":${gccdir}/${mldir}" |
70 |
+ } |
71 |
} |
72 |
- } |
73 |
- } |
74 |
- |
75 |
- } else { |
76 |
- |
77 |
- set using_gcc "no" |
78 |
- |
79 |
+ } |
80 |
} |
81 |
|
82 |
# add the library path for libffi. |
83 |
@@ -278,18 +271,25 @@ proc libffi-dg-runtest { testcases default-extra-flags } { |
84 |
} |
85 |
|
86 |
proc run-many-tests { testcases extra_flags } { |
87 |
- global using_gcc |
88 |
- if { [string match $using_gcc "yes"] } { |
89 |
+ global compiler_vendor |
90 |
+ switch $compiler_vendor { |
91 |
+ "clang" { |
92 |
+ set common "-W -Wall" |
93 |
+ set optimizations { "-O0" "-O1" "-O2" "-O3" "-Os" } |
94 |
+ } |
95 |
+ "gnu" { |
96 |
set common "-W -Wall -Wno-psabi" |
97 |
set optimizations { "-O0" "-O2" "-O3" "-Os" "-O2 -fomit-frame-pointer" } |
98 |
- } else { |
99 |
+ } |
100 |
+ default { |
101 |
# Assume we are using the vendor compiler. |
102 |
set common "" |
103 |
set optimizations { "" } |
104 |
+ } |
105 |
} |
106 |
|
107 |
set targetabis { "" } |
108 |
- if [string match $using_gcc "yes"] { |
109 |
+ if [string match $compiler_vendor "gnu"] { |
110 |
if [istarget "i?86-*-*"] { |
111 |
set targetabis { |
112 |
"" |