gccint: Target Fragment

1 
1 20.1 Target Makefile Fragments
1 ==============================
1 
1 Target makefile fragments can set these Makefile variables.
1 
1 'LIBGCC2_CFLAGS'
1      Compiler flags to use when compiling 'libgcc2.c'.
1 
1 'LIB2FUNCS_EXTRA'
1      A list of source file names to be compiled or assembled and
1      inserted into 'libgcc.a'.
1 
1 'CRTSTUFF_T_CFLAGS'
11      Special flags used when compiling 'crtstuff.c'.  ⇒
      Initialization.
1 
1 'CRTSTUFF_T_CFLAGS_S'
1      Special flags used when compiling 'crtstuff.c' for shared linking.
1      Used if you use 'crtbeginS.o' and 'crtendS.o' in 'EXTRA-PARTS'.
1      ⇒Initialization.
1 
1 'MULTILIB_OPTIONS'
1      For some targets, invoking GCC in different ways produces objects
1      that can not be linked together.  For example, for some targets GCC
1      produces both big and little endian code.  For these targets, you
1      must arrange for multiple versions of 'libgcc.a' to be compiled,
1      one for each set of incompatible options.  When GCC invokes the
1      linker, it arranges to link in the right version of 'libgcc.a',
1      based on the command line options used.
1 
1      The 'MULTILIB_OPTIONS' macro lists the set of options for which
1      special versions of 'libgcc.a' must be built.  Write options that
1      are mutually incompatible side by side, separated by a slash.
1      Write options that may be used together separated by a space.  The
1      build procedure will build all combinations of compatible options.
1 
1      For example, if you set 'MULTILIB_OPTIONS' to 'm68000/m68020
1      msoft-float', 'Makefile' will build special versions of 'libgcc.a'
1      using the following sets of options: '-m68000', '-m68020',
1      '-msoft-float', '-m68000 -msoft-float', and '-m68020 -msoft-float'.
1 
1 'MULTILIB_DIRNAMES'
1      If 'MULTILIB_OPTIONS' is used, this variable specifies the
1      directory names that should be used to hold the various libraries.
1      Write one element in 'MULTILIB_DIRNAMES' for each element in
1      'MULTILIB_OPTIONS'.  If 'MULTILIB_DIRNAMES' is not used, the
1      default value will be 'MULTILIB_OPTIONS', with all slashes treated
1      as spaces.
1 
1      'MULTILIB_DIRNAMES' describes the multilib directories using GCC
1      conventions and is applied to directories that are part of the GCC
1      installation.  When multilib-enabled, the compiler will add a
1      subdirectory of the form PREFIX/MULTILIB before each directory in
1      the search path for libraries and crt files.
1 
1      For example, if 'MULTILIB_OPTIONS' is set to 'm68000/m68020
1      msoft-float', then the default value of 'MULTILIB_DIRNAMES' is
1      'm68000 m68020 msoft-float'.  You may specify a different value if
1      you desire a different set of directory names.
1 
1 'MULTILIB_MATCHES'
1      Sometimes the same option may be written in two different ways.  If
1      an option is listed in 'MULTILIB_OPTIONS', GCC needs to know about
1      any synonyms.  In that case, set 'MULTILIB_MATCHES' to a list of
1      items of the form 'option=option' to describe all relevant
1      synonyms.  For example, 'm68000=mc68000 m68020=mc68020'.
1 
1 'MULTILIB_EXCEPTIONS'
1      Sometimes when there are multiple sets of 'MULTILIB_OPTIONS' being
1      specified, there are combinations that should not be built.  In
1      that case, set 'MULTILIB_EXCEPTIONS' to be all of the switch
1      exceptions in shell case syntax that should not be built.
1 
1      For example the ARM processor cannot execute both hardware floating
1      point instructions and the reduced size THUMB instructions at the
1      same time, so there is no need to build libraries with both of
1      these options enabled.  Therefore 'MULTILIB_EXCEPTIONS' is set to:
1           *mthumb/*mhard-float*
1 
1 'MULTILIB_REQUIRED'
1      Sometimes when there are only a few combinations are required, it
1      would be a big effort to come up with a 'MULTILIB_EXCEPTIONS' list
1      to cover all undesired ones.  In such a case, just listing all the
1      required combinations in 'MULTILIB_REQUIRED' would be more
1      straightforward.
1 
1      The way to specify the entries in 'MULTILIB_REQUIRED' is same with
1      the way used for 'MULTILIB_EXCEPTIONS', only this time what are
1      required will be specified.  Suppose there are multiple sets of
1      'MULTILIB_OPTIONS' and only two combinations are required, one for
1      ARMv7-M and one for ARMv7-R with hard floating-point ABI and FPU,
1      the 'MULTILIB_REQUIRED' can be set to:
1           MULTILIB_REQUIRED =  mthumb/march=armv7-m
1           MULTILIB_REQUIRED += march=armv7-r/mfloat-abi=hard/mfpu=vfpv3-d16
1 
1      The 'MULTILIB_REQUIRED' can be used together with
1      'MULTILIB_EXCEPTIONS'.  The option combinations generated from
1      'MULTILIB_OPTIONS' will be filtered by 'MULTILIB_EXCEPTIONS' and
1      then by 'MULTILIB_REQUIRED'.
1 
1 'MULTILIB_REUSE'
1      Sometimes it is desirable to reuse one existing multilib for
1      different sets of options.  Such kind of reuse can minimize the
1      number of multilib variants.  And for some targets it is better to
1      reuse an existing multilib than to fall back to default multilib
1      when there is no corresponding multilib.  This can be done by
1      adding reuse rules to 'MULTILIB_REUSE'.
1 
1      A reuse rule is comprised of two parts connected by equality sign.
1      The left part is the option set used to build multilib and the
1      right part is the option set that will reuse this multilib.  Both
1      parts should only use options specified in 'MULTILIB_OPTIONS' and
1      the equality signs found in options name should be replaced with
1      periods.  An explicit period in the rule can be escaped by
1      preceding it with a backslash.  The order of options in the left
1      part matters and should be same with those specified in
1      'MULTILIB_REQUIRED' or aligned with the order in
1      'MULTILIB_OPTIONS'.  There is no such limitation for options in the
1      right part as we don't build multilib from them.
1 
1      'MULTILIB_REUSE' is different from 'MULTILIB_MATCHES' in that it
1      sets up relations between two option sets rather than two options.
1      Here is an example to demo how we reuse libraries built in Thumb
1      mode for applications built in ARM mode:
1           MULTILIB_REUSE = mthumb/march.armv7-r=marm/march.armv7-r
1 
1      Before the advent of 'MULTILIB_REUSE', GCC select multilib by
1      comparing command line options with options used to build multilib.
1      The 'MULTILIB_REUSE' is complementary to that way.  Only when the
1      original comparison matches nothing it will work to see if it is OK
1      to reuse some existing multilib.
1 
1 'MULTILIB_EXTRA_OPTS'
1      Sometimes it is desirable that when building multiple versions of
1      'libgcc.a' certain options should always be passed on to the
1      compiler.  In that case, set 'MULTILIB_EXTRA_OPTS' to be the list
1      of options to be used for all builds.  If you set this, you should
1      probably set 'CRTSTUFF_T_CFLAGS' to a dash followed by it.
1 
1 'MULTILIB_OSDIRNAMES'
1      If 'MULTILIB_OPTIONS' is used, this variable specifies a list of
1      subdirectory names, that are used to modify the search path
1      depending on the chosen multilib.  Unlike 'MULTILIB_DIRNAMES',
1      'MULTILIB_OSDIRNAMES' describes the multilib directories using
1      operating systems conventions, and is applied to the directories
1      such as 'lib' or those in the 'LIBRARY_PATH' environment variable.
1      The format is either the same as of 'MULTILIB_DIRNAMES', or a set
1      of mappings.  When it is the same as 'MULTILIB_DIRNAMES', it
1      describes the multilib directories using operating system
1      conventions, rather than GCC conventions.  When it is a set of
1      mappings of the form GCCDIR=OSDIR, the left side gives the GCC
1      convention and the right gives the equivalent OS defined location.
1      If the OSDIR part begins with a '!', GCC will not search in the
1      non-multilib directory and use exclusively the multilib directory.
1      Otherwise, the compiler will examine the search path for libraries
1      and crt files twice; the first time it will add MULTILIB to each
1      directory in the search path, the second it will not.
1 
1      For configurations that support both multilib and multiarch,
1      'MULTILIB_OSDIRNAMES' also encodes the multiarch name, thus
1      subsuming 'MULTIARCH_DIRNAME'.  The multiarch name is appended to
1      each directory name, separated by a colon (e.g.
1      '../lib32:i386-linux-gnu').
1 
1      Each multiarch subdirectory will be searched before the
1      corresponding OS multilib directory, for example
1      '/lib/i386-linux-gnu' before '/lib/../lib32'.  The multiarch name
1      will also be used to modify the system header search path, as
1      explained for 'MULTIARCH_DIRNAME'.
1 
1 'MULTIARCH_DIRNAME'
1      This variable specifies the multiarch name for configurations that
1      are multiarch-enabled but not multilibbed configurations.
1 
1      The multiarch name is used to augment the search path for
1      libraries, crt files and system header files with additional
1      locations.  The compiler will add a multiarch subdirectory of the
1      form PREFIX/MULTIARCH before each directory in the library and crt
1      search path.  It will also add two directories
1      'LOCAL_INCLUDE_DIR'/MULTIARCH and
1      'NATIVE_SYSTEM_HEADER_DIR'/MULTIARCH) to the system header search
1      path, respectively before 'LOCAL_INCLUDE_DIR' and
1      'NATIVE_SYSTEM_HEADER_DIR'.
1 
1      'MULTIARCH_DIRNAME' is not used for configurations that support
1      both multilib and multiarch.  In that case, multiarch names are
1      encoded in 'MULTILIB_OSDIRNAMES' instead.
1 
1      More documentation about multiarch can be found at
1      <https://wiki.debian.org/Multiarch>.
1 
1 'SPECS'
1      Unfortunately, setting 'MULTILIB_EXTRA_OPTS' is not enough, since
1      it does not affect the build of target libraries, at least not the
1      build of the default multilib.  One possible work-around is to use
1      'DRIVER_SELF_SPECS' to bring options from the 'specs' file as if
1      they had been passed in the compiler driver command line.  However,
1      you don't want to be adding these options after the toolchain is
1      installed, so you can instead tweak the 'specs' file that will be
1      used during the toolchain build, while you still install the
1      original, built-in 'specs'.  The trick is to set 'SPECS' to some
1      other filename (say 'specs.install'), that will then be created out
1      of the built-in specs, and introduce a 'Makefile' rule to generate
1      the 'specs' file that's going to be used at build time out of your
1      'specs.install'.
1 
1 'T_CFLAGS'
1      These are extra flags to pass to the C compiler.  They are used
1      both when building GCC, and when compiling things with the
1      just-built GCC.  This variable is deprecated and should not be
1      used.
1