Library Calls (GNU Compiler Collection (GCC) Internals) (original) (raw)
17.12 Implicit Calls to Library Routines ¶
Here is an explanation of implicit calls to library routines.
Macro: DECLARE_LIBRARY_RENAMES ¶
This macro, if defined, should expand to a piece of C code that will get expanded when compiling functions for libgcc.a. It can be used to provide alternate names for GCC’s internal library functions if there are ABI-mandated names that the compiler should provide.
Target Hook: void
TARGET_INIT_LIBFUNCS (void)
¶
This hook should declare additional library routines or rename existing ones, using the functions set_optab_libfunc
andinit_one_libfunc
defined in optabs.cc.init_optabs
calls this macro after initializing all the normal library routines.
The default is to do nothing. Most ports don’t need to define this hook.
Target Hook: bool
TARGET_LIBFUNC_GNU_PREFIX ¶
If false (the default), internal library routines start with two underscores. If set to true, these routines start with __gnu_
instead. E.g., __muldi3
changes to __gnu_muldi3
. This currently only affects functions defined in libgcc2.c. If this is set to true, the tm.h file must also#define LIBGCC2_GNU_PREFIX
.
Macro: FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison) ¶
This macro should return true
if the library routine that implements the floating point comparison operator comparison in mode mode will return a boolean, and false if it will return a tristate.
GCC’s own floating point libraries return tristates from the comparison operators, so the default returns false always. Most ports don’t need to define this macro.
Macro: TARGET_LIB_INT_CMP_BIASED ¶
This macro should evaluate to true
if the integer comparison functions (like __cmpdi2
) return 0 to indicate that the first operand is smaller than the second, 1 to indicate that they are equal, and 2 to indicate that the first operand is greater than the second. If this macro evaluates to false
the comparison functions return −1, 0, and 1 instead of 0, 1, and 2. If the target uses the routines in libgcc.a, you do not need to define this macro.
Macro: TARGET_HAS_NO_HW_DIVIDE ¶
This macro should be defined if the target has no hardware divide instructions. If this macro is defined, GCC will use an algorithm which make use of simple logical and arithmetic operations for 64-bit division. If the macro is not defined, GCC will use an algorithm which make use of a 64-bit by 32-bit divide primitive.
Macro: TARGET_EDOM ¶
The value of EDOM
on the target machine, as a C integer constant expression. If you don’t define this macro, GCC does not attempt to deposit the value of EDOM
into errno
directly. Look in/usr/include/errno.h to find the value of EDOM
on your system.
If you do not define TARGET_EDOM
, then compiled code reports domain errors by calling the library function and letting it report the error. If mathematical functions on your system use matherr
when there is an error, then you should leave TARGET_EDOM
undefined so that matherr
is used normally.
Macro: GEN_ERRNO_RTX ¶
Define this macro as a C expression to create an rtl expression that refers to the global “variable” errno
. (On certain systems,errno
may not actually be a variable.) If you don’t define this macro, a reasonable default is used.
Target Hook: bool
TARGET_LIBC_HAS_FUNCTION (enum function_class fn_class, tree type)
¶
This hook determines whether a function from a class of functionsfn_class is present in the target C library. If type is NULL, the caller asks for support for all standard (float, double, long double) types. If type is non-NULL, the caller asks for support for a specific type.
Target Hook: bool
TARGET_LIBC_HAS_FAST_FUNCTION (int fcode)
¶
This hook determines whether a function from a class of functions(enum function_class)
fcode has a fast implementation.
Target Hook: unsigned
TARGET_FORTIFY_SOURCE_DEFAULT_LEVEL (void)
¶
This hook determines what value _FORTIFY_SOURCE will be set to when using the command-line option -fhardened.
Target Hook: unsigned
TARGET_LIBM_FUNCTION_MAX_ERROR (unsigned cfn, machine_mode mode, bool boundary_p)
¶
This hook determines expected maximum errors for math functions measured in ulps (units of the last place). 0 means 0.5ulps precision (correctly rounded). ~0U means unknown errors. The combined_fn
cfnargument should identify just which math built-in function it is rather than its variant, mode the variant in terms of floating-point machine mode. The hook should also take into account flag_rounding_math
whether it is maximum error just in default rounding mode, or in all possible rounding modes. boundary_p is true
for maximum errors on intrinsic math boundaries of functions rather than errors inside of the usual result ranges of the functions. E.g. the sin/cos function finite result is in between -1.0 and 1.0 inclusive, with boundary_p true the function returns how many ulps below or above those boundaries result could be.
Macro: NEXT_OBJC_RUNTIME ¶
Set this macro to 1 to use the "NeXT" Objective-C message sending conventions by default. This calling convention involves passing the object, the selector and the method arguments all at once to the method-lookup library function. This is the usual setting when targeting Darwin / macOS systems, which have the NeXT runtime installed.
If the macro is set to 0, the "GNU" Objective-C message sending convention will be used by default. This convention passes just the object and the selector to the method-lookup function, which returns a pointer to the method.
In either case, it remains possible to select code-generation for the alternate scheme, by means of compiler command line switches.