Target Triplet - OSDev Wiki (2024)

Target Triplets describe a platform on which code runs and are a core concept in the GNU build system. They contain three fields: the name of the CPU family/model, the vendor, and the operating system name. You can view the unambiguous target triplet for your current system by running:

gcc -dumpmachine

Structure

Target triplets have this simple structure:

machine-vendor-operatingsystem

For instance, a FreeBSD system could be written as:

x86_64-unknown-freebsd

Notice how the vendor field is mostly irrelevant and is usually 'pc' for 32-bit x86 systems or 'unknown' or 'none' for other systems. The simple three-field target triplet we have seen so far is unambiguous and easy to parse. However, since the vendor field is mostly unused, the GNU build system allows you to leave out the vendor field; the build system will automatically insert a default vendor part when it disambiguates your target triplet. For instance, this allows you to type:

x86_64-freebsd

The build system will then automatically deduce that the vendor is the default (unknown) if it wishes to know the unambiguous target triplet. Note that parsing target triplets are a bit more tricky, as sometimes the operating system field can be two fields:

x86_64-unknown-linux-gnu

This gets a bit worse since the vendor field can be left out:

x86_64-linux-gnu

This is most definitely ambiguous. Most autoconf-based packages ship with a huge shell script called config.sub whose function is to disambiguate target triplet using a long list of known CPUs and known operating systems.

Rationale

Target triplets are intended to be systematic unambiguous platform names (well, after disambiguation). They lets build systems understand exactly which system the code will run on and allows enabling platform-specific features automatically. In any compilation setting, there are usually three platforms involved (which might be the same three ones):

  • Build Platform: This is the platform on which the compilation tools are executed.
  • Host Platform: This is the platform on which the code will eventually run.
  • Target Platform: If this is a compiler, this is the platform that the compiler will generate code for.

This means that up to three differently-targeted compilers might be in play (if you are building a GCC on platform A, which will run on platform B, which produces executables for platform C). This problem is solved by simply prefixing the compilation tools with the target triplet. When you build a cross-compiler, the installed executables will be prefixed with the specified target triplet:

i686-elf-gcc

This prevents the wrong compiler from being used (and prevents things from the build machine to leak onto the target machine) if build systems are carefully to prefix all compilation tools with the target prefix.

Target Triplets for Operating Systems Development

For instance, if you develop your own operating system and modify GCC to add a new target triplet, yours could be:

x86_64-myos

However, when starting out you simply wish to use the generic targets that are well-suited for early OS development:

i686-elfx86_64-elfarm-none-eabiaarch64-none-elfriscv64-none-elf

These are bare targets meant for freestanding programs (bootloaders and kernels) that don't have a user-space.

Target Triplet - OSDev Wiki (2024)
Top Articles
Buildings vs Landlord Insurance: What's the Difference? | KASE
How Would You Reconcile Your Bank Account To Avoid Spending More Than You Have?
Jack Doherty Lpsg
Use Copilot in Microsoft Teams meetings
Joliet Patch Arrests Today
Time in Baltimore, Maryland, United States now
Unitedhealthcare Hwp
Umn Pay Calendar
Monticello Culver's Flavor Of The Day
Jesus Revolution Showtimes Near Chisholm Trail 8
Boat Jumping Female Otezla Commercial Actress
Select Truck Greensboro
Mawal Gameroom Download
Nier Automata Chapter Select Unlock
More Apt To Complain Crossword
Mephisto Summoners War
Jack Daniels Pop Tarts
Colts seventh rotation of thin secondary raises concerns on roster evaluation
6001 Canadian Ct Orlando Fl
Mini Handy 2024: Die besten Mini Smartphones | Purdroid.de
Premier Reward Token Rs3
Simpsons Tapped Out Road To Riches
60 X 60 Christmas Tablecloths
Ibukunore
Clare Briggs Guzman
Craigslist Lewes Delaware
Minnick Funeral Home West Point Nebraska
Craigslist Apartments Baltimore
Prot Pally Wrath Pre Patch
Ardie From Something Was Wrong Podcast
Buhl Park Summer Concert Series 2023 Schedule
Sams Gas Price Sanford Fl
Visit the UK as a Standard Visitor
Busted! 29 New Arrests in Portsmouth, Ohio – 03/27/22 Scioto County Mugshots
Yoshidakins
Ark Unlock All Skins Command
Barrage Enhancement Lost Ark
Naya Padkar Newspaper Today
How To Get Soul Reaper Knife In Critical Legends
Final Fantasy 7 Remake Nexus
2023 Nickstory
Flipper Zero Delivery Time
Clausen's Car Wash
SF bay area cars & trucks "chevrolet 50" - craigslist
Coroner Photos Timothy Treadwell
Strange World Showtimes Near Century Stadium 25 And Xd
Tom Kha Gai Soup Near Me
9294027542
Wwba Baseball
Nkey rollover - Hitta bästa priset på Prisjakt
Kobe Express Bayside Lakes Photos
Craigslist Centre Alabama
Latest Posts
Article information

Author: Madonna Wisozk

Last Updated:

Views: 6815

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Madonna Wisozk

Birthday: 2001-02-23

Address: 656 Gerhold Summit, Sidneyberg, FL 78179-2512

Phone: +6742282696652

Job: Customer Banking Liaison

Hobby: Flower arranging, Yo-yoing, Tai chi, Rowing, Macrame, Urban exploration, Knife making

Introduction: My name is Madonna Wisozk, I am a attractive, healthy, thoughtful, faithful, open, vivacious, zany person who loves writing and wants to share my knowledge and understanding with you.