@@ -24,6 +24,16 @@ def user_is_root():
24
24
return False
25
25
26
26
27
+ def remove_triple_vendor (triple ):
28
+ components = triple .split ("-" )
29
+
30
+ # Remove vendor component (e.g. unknown, pc) if present.
31
+ if len (components ) == 4 :
32
+ del components [1 ]
33
+
34
+ return "-" .join (components )
35
+
36
+
27
37
class LLVMConfig (object ):
28
38
def __init__ (self , lit_config , config ):
29
39
self .lit_config = lit_config
@@ -108,14 +118,14 @@ def __init__(self, lit_config, config):
108
118
elif platform .system () == "OS/390" :
109
119
features .add ("system-zos" )
110
120
111
- # Native compilation: host arch == default triple arch
121
+ # Native compilation: host arch == default triple arch (sans vendor)
112
122
# Both of these values should probably be in every site config (e.g. as
113
123
# part of the standard header. But currently they aren't)
114
124
host_triple = getattr (config , "host_triple" , None )
115
125
target_triple = getattr (config , "target_triple" , None )
116
126
features .add ("host=%s" % host_triple )
117
127
features .add ("target=%s" % target_triple )
118
- if host_triple and host_triple == target_triple :
128
+ if host_triple and remove_triple_vendor ( host_triple ) == remove_triple_vendor ( target_triple ) :
119
129
features .add ("native" )
120
130
121
131
# Sanitizers.
0 commit comments