Changeset e18ba69


Ignore:
Timestamp:
09/30/2022 02:43:19 AM (2 months ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
multilib, trunk, xry111/arm64, xry111/clfs-ng, xry111/pip3, xry111/rust-wip-20221008
Children:
77b46db
Parents:
cc0e77d
git-author:
Xi Ruoyao <xry111@…> (09/30/2022 02:39:03 AM)
git-committer:
Xi Ruoyao <xry111@…> (09/30/2022 02:43:19 AM)
Message:

toolchain technical note: rewrite the descrption for triplet

  • Don't say "most building system", refine the dicussion for autoconf. Other building systems may use a variant of triplet, or use a completely different system designation.
  • Explain why a triplet may contain 4 fields in detail. "Histroical reason" is not really correct because 3-field triplet is still used today for BSD, Fuchsia, IOS, Mac OS X (darwin), Solaris, etc.
  • "machine" triplet to "system" triplet (strictly speaking, only the first field in the triplet is for the machine).

Why we need to say "vendor can be omitted" explicitly: we mention "gcc
-dumpmachine". On some distros (like Ubuntu) the output has no vendor
field. If you think this is too nasty, please remove both.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • part3intro/toolchaintechnotes.xml

    rcc0e77d re18ba69  
    146146
    147147    <note>
    148       <para>Almost all the build systems use names of the form
    149       cpu-vendor-kernel-os, referred to as the machine triplet. (Sometimes,
    150       the vendor field is omitted.) An astute
    151       reader may wonder why a <quote>triplet</quote> refers to a four component
    152       name. The reason is historical: initially, three component names were enough
    153       to designate a machine unambiguously, but as new machines and systems
    154       proliferated, that proved insufficient. The word <quote>triplet</quote>
    155       remained. A simple way to determine your machine triplet is to run
    156       the <command>config.guess</command>
     148      <para>All packages involved with cross compilation in the book use an
     149      autoconf-based building system.  The autoconf-based building system
     150      accepts system types in the form cpu-vendor-kernel-os,
     151      referred to as the system triplet.  Since the vendor field is mostly
     152      irrelevant, autoconf allows to omit it. An astute reader may wonder
     153      why a <quote>triplet</quote> refers to a four component name. The
     154      reason is the kernel field and the os field originiated from one
     155      <quote>system</quote> field.  Such a three-field form is still valid
     156      today for some systems, for example
     157      <literal>x86_64-unknown-freebsd</literal>.  But for other systems,
     158      two systems can share the same kernel but still be too different to
     159      use a same triplet for them.  For example, an Android running on a
     160      mobile phone is completely different from Ubuntu running on an ARM64
     161      server.  Without an emulation layer, you cannot run an executable for
     162      the server on the mobile phone or vice versa.  So the
     163      <quote>system</quote> field is separated into kernel and os fields to
     164      designate these systems unambiguously.  For our example, the Android
     165      system is designated <literal>aarch64-unknown-linux-android</literal>,
     166      and the Ubuntu system is designated
     167      <literal>aarch64-unknown-linux-gnu</literal>.  The word
     168      <quote>triplet</quote> remained. A simple way to determine your
     169      system triplet is to run the <command>config.guess</command>
    157170      script that comes with the source for many packages. Unpack the binutils
    158171      sources and run the script: <userinput>./config.guess</userinput> and note
Note: See TracChangeset for help on using the changeset viewer.