What exactly *is* a “Triple”, and how is it different from a Platform?

when working with toolchain metadata, i run into the terminology “triple” a lot (example: Triple.swift), and as far as i understand, it’s just an encoding for information about a platform.

what exactly does triple mean? why do we even have this word (it doesn’t seem to refer to the number of hyphen-separated components, of which it has four), and how is it different from platform? when naming a type that models this thing, does it even make sense to call it a PlatformTriple?


The thing’s full name would be “LLVM target triple”. More details here:



This is one of those horrible legacy situations where it originally did have three components, so it was called a “triple”, but then it got extended so there are sometimes now four or even five components and the name doesn’t make as much sense anymore.

“Platform” is a very vague word—does it encompass only the OS, or the OS and architecture?—whereas “triple” is very precise. It’s a set of 3-5 pieces of data that describe a build’s target. These include the CPU architecture, the OS vendor, the OS, the “environment” (like macabi for Mac Catalyst, simulator for iOS simulators, or the libc for certain Linux configurations), and the object file format. The environment and object file format are often empty or defaulted, so they can be left off in many cases. This set of fields are the main information LLVM uses to figure out how to emit machine code.


The full word would be "Target Triplet". The term triple far predates LLVM, and is from the GNU project. This was part of autotools and GCC: Specifying Target Triplets - Autoconf.


It does refer to the components historically. Today, a triple has 10 parts. The composition is also more fuzzy as different components are joined differently.

[arch][subarch][endian]-[vendor]-[os]-[libc]?[abi]?[variant]?[version]-[object file format]?

armv7k_be-arm-linux-gnueabihf6.3.3-macho would be a 10-part triple specifying:

Architecture: ARM
Sub-Architecture: v7k
Endianness: Big Endian
Vendor: ARM Ltd
OS: Linux
libc: GNU (glibc)
ABI: EABI (embedded ABI)
Variant: Hardware Floating Point
OS Version: 6.3.3
File Format: Mach-O


Heh, never seen that fifth hyphenated object format before, you learn something new everyday.

Btw, you're missing a hyphen between [os] and [libc].

Maybe we can redefine “triple” to be an abbreviation for “TaRget Information tuPLE.”


You should work for NASA :joy: