1*ec02198aSmrg@c Copyright (C) 1988-2020 Free Software Foundation, Inc.
210d565efSmrg@c This is part of the GCC manual.
310d565efSmrg@c For copying conditions, see the file gccint.texi.
410d565efSmrg
510d565efSmrg@node Host Config
610d565efSmrg@chapter Host Configuration
710d565efSmrg@cindex host configuration
810d565efSmrg
910d565efSmrgMost details about the machine and system on which the compiler is
1010d565efSmrgactually running are detected by the @command{configure} script.  Some
1110d565efSmrgthings are impossible for @command{configure} to detect; these are
1210d565efSmrgdescribed in two ways, either by macros defined in a file named
1310d565efSmrg@file{xm-@var{machine}.h} or by hook functions in the file specified
1410d565efSmrgby the @var{out_host_hook_obj} variable in @file{config.gcc}.  (The
1510d565efSmrgintention is that very few hosts will need a header file but nearly
1610d565efSmrgevery fully supported host will need to override some hooks.)
1710d565efSmrg
1810d565efSmrgIf you need to define only a few macros, and they have simple
1910d565efSmrgdefinitions, consider using the @code{xm_defines} variable in your
2010d565efSmrg@file{config.gcc} entry instead of creating a host configuration
2110d565efSmrgheader.  @xref{System Config}.
2210d565efSmrg
2310d565efSmrg@menu
2410d565efSmrg* Host Common::         Things every host probably needs implemented.
2510d565efSmrg* Filesystem::          Your host cannot have the letter `a' in filenames?
2610d565efSmrg* Host Misc::           Rare configuration options for hosts.
2710d565efSmrg@end menu
2810d565efSmrg
2910d565efSmrg@node Host Common
3010d565efSmrg@section Host Common
3110d565efSmrg@cindex host hooks
3210d565efSmrg@cindex host functions
3310d565efSmrg
3410d565efSmrgSome things are just not portable, even between similar operating systems,
3510d565efSmrgand are too difficult for autoconf to detect.  They get implemented using
3610d565efSmrghook functions in the file specified by the @var{host_hook_obj}
3710d565efSmrgvariable in @file{config.gcc}.
3810d565efSmrg
3910d565efSmrg@deftypefn {Host Hook} void HOST_HOOKS_EXTRA_SIGNALS (void)
4010d565efSmrgThis host hook is used to set up handling for extra signals.  The most
4110d565efSmrgcommon thing to do in this hook is to detect stack overflow.
4210d565efSmrg@end deftypefn
4310d565efSmrg
4410d565efSmrg@deftypefn {Host Hook} {void *} HOST_HOOKS_GT_PCH_GET_ADDRESS (size_t @
4510d565efSmrg  @var{size}, int @var{fd})
4610d565efSmrgThis host hook returns the address of some space that is likely to be
4710d565efSmrgfree in some subsequent invocation of the compiler.  We intend to load
4810d565efSmrgthe PCH data at this address such that the data need not be relocated.
4910d565efSmrgThe area should be able to hold @var{size} bytes.  If the host uses
5010d565efSmrg@code{mmap}, @var{fd} is an open file descriptor that can be used for
5110d565efSmrgprobing.
5210d565efSmrg@end deftypefn
5310d565efSmrg
5410d565efSmrg@deftypefn {Host Hook} int HOST_HOOKS_GT_PCH_USE_ADDRESS (void * @var{address}, @
5510d565efSmrg  size_t @var{size}, int @var{fd}, size_t @var{offset})
5610d565efSmrgThis host hook is called when a PCH file is about to be loaded.
5710d565efSmrgWe want to load @var{size} bytes from @var{fd} at @var{offset}
5810d565efSmrginto memory at @var{address}.  The given address will be the result of
5910d565efSmrga previous invocation of @code{HOST_HOOKS_GT_PCH_GET_ADDRESS}.
6010d565efSmrgReturn @minus{}1 if we couldn't allocate @var{size} bytes at @var{address}.
6110d565efSmrgReturn 0 if the memory is allocated but the data is not loaded.  Return 1
6210d565efSmrgif the hook has performed everything.
6310d565efSmrg
6410d565efSmrgIf the implementation uses reserved address space, free any reserved
6510d565efSmrgspace beyond @var{size}, regardless of the return value.  If no PCH will
6610d565efSmrgbe loaded, this hook may be called with @var{size} zero, in which case
6710d565efSmrgall reserved address space should be freed.
6810d565efSmrg
6910d565efSmrgDo not try to handle values of @var{address} that could not have been
7010d565efSmrgreturned by this executable; just return @minus{}1.  Such values usually
7110d565efSmrgindicate an out-of-date PCH file (built by some other GCC executable),
7210d565efSmrgand such a PCH file won't work.
7310d565efSmrg@end deftypefn
7410d565efSmrg
7510d565efSmrg@deftypefn {Host Hook} size_t HOST_HOOKS_GT_PCH_ALLOC_GRANULARITY (void);
7610d565efSmrgThis host hook returns the alignment required for allocating virtual
7710d565efSmrgmemory.  Usually this is the same as getpagesize, but on some hosts the
7810d565efSmrgalignment for reserving memory differs from the pagesize for committing
7910d565efSmrgmemory.
8010d565efSmrg@end deftypefn
8110d565efSmrg
8210d565efSmrg@node Filesystem
8310d565efSmrg@section Host Filesystem
8410d565efSmrg@cindex configuration file
8510d565efSmrg@cindex @file{xm-@var{machine}.h}
8610d565efSmrg
8710d565efSmrgGCC needs to know a number of things about the semantics of the host
8810d565efSmrgmachine's filesystem.  Filesystems with Unix and MS-DOS semantics are
8910d565efSmrgautomatically detected.  For other systems, you can define the
9010d565efSmrgfollowing macros in @file{xm-@var{machine}.h}.
9110d565efSmrg
9210d565efSmrg@ftable @code
9310d565efSmrg@item HAVE_DOS_BASED_FILE_SYSTEM
9410d565efSmrgThis macro is automatically defined by @file{system.h} if the host
9510d565efSmrgfile system obeys the semantics defined by MS-DOS instead of Unix.
9610d565efSmrgDOS file systems are case insensitive, file specifications may begin
9710d565efSmrgwith a drive letter, and both forward slash and backslash (@samp{/}
9810d565efSmrgand @samp{\}) are directory separators.
9910d565efSmrg
10010d565efSmrg@item DIR_SEPARATOR
10110d565efSmrg@itemx DIR_SEPARATOR_2
10210d565efSmrgIf defined, these macros expand to character constants specifying
10310d565efSmrgseparators for directory names within a file specification.
10410d565efSmrg@file{system.h} will automatically give them appropriate values on
10510d565efSmrgUnix and MS-DOS file systems.  If your file system is neither of
10610d565efSmrgthese, define one or both appropriately in @file{xm-@var{machine}.h}.
10710d565efSmrg
10810d565efSmrgHowever, operating systems like VMS, where constructing a pathname is
10910d565efSmrgmore complicated than just stringing together directory names
11010d565efSmrgseparated by a special character, should not define either of these
11110d565efSmrgmacros.
11210d565efSmrg
11310d565efSmrg@item PATH_SEPARATOR
11410d565efSmrgIf defined, this macro should expand to a character constant
11510d565efSmrgspecifying the separator for elements of search paths.  The default
11610d565efSmrgvalue is a colon (@samp{:}).  DOS-based systems usually, but not
11710d565efSmrgalways, use semicolon (@samp{;}).
11810d565efSmrg
11910d565efSmrg@item VMS
12010d565efSmrgDefine this macro if the host system is VMS@.
12110d565efSmrg
12210d565efSmrg@item HOST_OBJECT_SUFFIX
12310d565efSmrgDefine this macro to be a C string representing the suffix for object
12410d565efSmrgfiles on your host machine.  If you do not define this macro, GCC will
12510d565efSmrguse @samp{.o} as the suffix for object files.
12610d565efSmrg
12710d565efSmrg@item HOST_EXECUTABLE_SUFFIX
12810d565efSmrgDefine this macro to be a C string representing the suffix for
12910d565efSmrgexecutable files on your host machine.  If you do not define this macro,
13010d565efSmrgGCC will use the null string as the suffix for executable files.
13110d565efSmrg
13210d565efSmrg@item HOST_BIT_BUCKET
13310d565efSmrgA pathname defined by the host operating system, which can be opened as
13410d565efSmrga file and written to, but all the information written is discarded.
13510d565efSmrgThis is commonly known as a @dfn{bit bucket} or @dfn{null device}.  If
13610d565efSmrgyou do not define this macro, GCC will use @samp{/dev/null} as the bit
13710d565efSmrgbucket.  If the host does not support a bit bucket, define this macro to
13810d565efSmrgan invalid filename.
13910d565efSmrg
14010d565efSmrg@item UPDATE_PATH_HOST_CANONICALIZE (@var{path})
14110d565efSmrgIf defined, a C statement (sans semicolon) that performs host-dependent
14210d565efSmrgcanonicalization when a path used in a compilation driver or
14310d565efSmrgpreprocessor is canonicalized.  @var{path} is a malloc-ed path to be
14410d565efSmrgcanonicalized.  If the C statement does canonicalize @var{path} into a
14510d565efSmrgdifferent buffer, the old path should be freed and the new buffer should
14610d565efSmrghave been allocated with malloc.
14710d565efSmrg
14810d565efSmrg@item DUMPFILE_FORMAT
14910d565efSmrgDefine this macro to be a C string representing the format to use for
15010d565efSmrgconstructing the index part of debugging dump file names.  The resultant
15110d565efSmrgstring must fit in fifteen bytes.  The full filename will be the
15210d565efSmrgconcatenation of: the prefix of the assembler file name, the string
15310d565efSmrgresulting from applying this format to an index number, and a string
15410d565efSmrgunique to each dump file kind, e.g.@: @samp{rtl}.
15510d565efSmrg
15610d565efSmrgIf you do not define this macro, GCC will use @samp{.%02d.}.  You should
15710d565efSmrgdefine this macro if using the default will create an invalid file name.
15810d565efSmrg
15910d565efSmrg@item DELETE_IF_ORDINARY
16010d565efSmrgDefine this macro to be a C statement (sans semicolon) that performs
16110d565efSmrghost-dependent removal of ordinary temp files in the compilation driver.
16210d565efSmrg
16310d565efSmrgIf you do not define this macro, GCC will use the default version.  You
16410d565efSmrgshould define this macro if the default version does not reliably remove
16510d565efSmrgthe temp file as, for example, on VMS which allows multiple versions
16610d565efSmrgof a file.
16710d565efSmrg
16810d565efSmrg@item HOST_LACKS_INODE_NUMBERS
16910d565efSmrgDefine this macro if the host filesystem does not report meaningful inode
17010d565efSmrgnumbers in struct stat.
17110d565efSmrg@end ftable
17210d565efSmrg
17310d565efSmrg@node Host Misc
17410d565efSmrg@section Host Misc
17510d565efSmrg@cindex configuration file
17610d565efSmrg@cindex @file{xm-@var{machine}.h}
17710d565efSmrg
17810d565efSmrg@ftable @code
17910d565efSmrg@item FATAL_EXIT_CODE
18010d565efSmrgA C expression for the status code to be returned when the compiler
18110d565efSmrgexits after serious errors.  The default is the system-provided macro
18210d565efSmrg@samp{EXIT_FAILURE}, or @samp{1} if the system doesn't define that
18310d565efSmrgmacro.  Define this macro only if these defaults are incorrect.
18410d565efSmrg
18510d565efSmrg@item SUCCESS_EXIT_CODE
18610d565efSmrgA C expression for the status code to be returned when the compiler
18710d565efSmrgexits without serious errors.  (Warnings are not serious errors.)  The
18810d565efSmrgdefault is the system-provided macro @samp{EXIT_SUCCESS}, or @samp{0} if
18910d565efSmrgthe system doesn't define that macro.  Define this macro only if these
19010d565efSmrgdefaults are incorrect.
19110d565efSmrg
19210d565efSmrg@item USE_C_ALLOCA
19310d565efSmrgDefine this macro if GCC should use the C implementation of @code{alloca}
19410d565efSmrgprovided by @file{libiberty.a}.  This only affects how some parts of the
19510d565efSmrgcompiler itself allocate memory.  It does not change code generation.
19610d565efSmrg
19710d565efSmrgWhen GCC is built with a compiler other than itself, the C @code{alloca}
19810d565efSmrgis always used.  This is because most other implementations have serious
19910d565efSmrgbugs.  You should define this macro only on a system where no
20010d565efSmrgstack-based @code{alloca} can possibly work.  For instance, if a system
20110d565efSmrghas a small limit on the size of the stack, GCC's builtin @code{alloca}
20210d565efSmrgwill not work reliably.
20310d565efSmrg
20410d565efSmrg@item COLLECT2_HOST_INITIALIZATION
20510d565efSmrgIf defined, a C statement (sans semicolon) that performs host-dependent
20610d565efSmrginitialization when @code{collect2} is being initialized.
20710d565efSmrg
20810d565efSmrg@item GCC_DRIVER_HOST_INITIALIZATION
20910d565efSmrgIf defined, a C statement (sans semicolon) that performs host-dependent
21010d565efSmrginitialization when a compilation driver is being initialized.
21110d565efSmrg
21210d565efSmrg@item HOST_LONG_LONG_FORMAT
21310d565efSmrgIf defined, the string used to indicate an argument of type @code{long
21410d565efSmrglong} to functions like @code{printf}.  The default value is
21510d565efSmrg@code{"ll"}.
21610d565efSmrg
21710d565efSmrg@item HOST_LONG_FORMAT
21810d565efSmrgIf defined, the string used to indicate an argument of type @code{long}
21910d565efSmrgto functions like @code{printf}.  The default value is @code{"l"}.
22010d565efSmrg
22110d565efSmrg@item HOST_PTR_PRINTF
22210d565efSmrgIf defined, the string used to indicate an argument of type @code{void *}
22310d565efSmrgto functions like @code{printf}.  The default value is @code{"%p"}.
22410d565efSmrg@end ftable
22510d565efSmrg
22610d565efSmrgIn addition, if @command{configure} generates an incorrect definition of
22710d565efSmrgany of the macros in @file{auto-host.h}, you can override that
22810d565efSmrgdefinition in a host configuration header.  If you need to do this,
22910d565efSmrgfirst see if it is possible to fix @command{configure}.
230