@@ -119,6 +119,47 @@ TODO: New language feature: Configuration queries:
119119 - Use it to increase the number of "architecture-clean" #import'd files,
120120 allowing a single index to be used for all fat slices.
121121
122+ //===---------------------------------------------------------------------===//
123+ // Specifying targets: -triple and -arch
124+ ===---------------------------------------------------------------------===//
125+
126+ The clang supports "-triple" and "-arch" options. At most one -triple option may
127+ be specified, while multiple -arch options can be specified. Both are optional.
128+
129+ The "selection of target" behavior is defined as follows:
130+
131+ (1) If the user does not specify -triple:
132+
133+ (a) If no -arch options are specified, the target triple used is the host
134+ triple (in llvm/Config/config.h).
135+
136+ (b) If one or more -arch's are specified (and no -triple), then there is
137+ one triple for each -arch, where the specified arch is substituted
138+ for the arch in the host triple. Example:
139+
140+ host triple = i686-apple-darwin9
141+ command: clang -arch ppc -arch ppc64 ...
142+ triples used: ppc-apple-darwin9 ppc64-apple-darwin9
143+
144+ (2) The user does specify a -triple (only one allowed):
145+
146+ (a) If no -arch options are specified, the triple specified by -triple
147+ is used. E.g clang -triple i686-apple-darwin9
148+
149+ (b) If one or more -arch options are specified, then the triple specified
150+ by -triple is used as the primary target, and the arch's specified
151+ by -arch are used to create secondary targets. For example:
152+
153+ clang -triple i686-apple-darwin9 -arch ppc -arch ppc64
154+
155+ has the following targets:
156+
157+ i686-apple-darwin9 (primary target)
158+ ppc-apple-darwin9 (secondary target)
159+ ppc64-apple-darwin9 (secondary target)
160+
161+ The secondary targets are used in the 'portability' model (see below).
162+
122163//===---------------------------------------------------------------------===//
123164
124165The 'portability' model in clang is sufficient to catch translation units (or
0 commit comments