4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-19 12:59:21 +08:00
newlib-cygwin/newlib/configure.host
Roger Sayle 6bb96d13a2 nvptx: Emulate clock and other machine stubs.
This patch to the libc/machine/nvptx port of newlib implements an
approximation of "clock" and provides some additional stub routines.
These changes not only reduce the number of (link) failures in the GCC
testsuite when targeting nvptx-none, but also allow the NIST scimark4
benchmark to compile and run without modification.

newlib already contains support for backends to provide their own
clock implementations via -DCLOCK_PROVIDED.  That functionality is
used here to return an approximate elapsed time based on the NVidia
GPU's clock64 cycle counter.  Although not great, this is better than
the current behaviour of link error from the unresolved symbol
_times_r.

The other part of the patch is to add a small number of stub functions
to nvptx's misc.c.  Adding isatty, for example, resolves linking
problems in libc from the dependency in __smakebuf_r, and the sync
stub, for example, fixes the failure with GCC's
testsuite/gfortran.dg/ISO_Fortran_binding_14.f90 [which simply tests
that gfortran can call a/any C function].

newlib/
        configure.host: Add -DCLOCK_PROVIDED to newlib_cflags on nvptx*.

newlib/libc/machine/nvptx
        Makefile.am: Add clock.c to lib_a_SOURCES.
        clock.c: New source file to implement/approximate clock().
        misc.c: Add stubs for fstat, isatty, open, sync and unlink.
2021-08-25 10:20:27 +02:00

1020 lines
25 KiB
Plaintext

# configure.host
# This shell script handles all host based configuration for newlib.
# It sets various shell variables based on the the host and the
# configuration options. You can modify this shell script without
# needing to rerun autoconf.
# This shell script should be invoked as
# . configure.host
# If it encounters an error, it will exit with a message.
# FIXME: This script is too complicated. It does things in too many
# different ways. This was taken from the old Cygnus configure script
# with only minor changes. It should be cleaned up.
# FIXME: The general approach of picking and choosing which
# directories to configure, other than machine_dir and sys_dir, is
# potentially confusing.
# It uses the following shell variables:
# host The configuration host
# host_cpu The configuration host CPU
# newlib_mb --enable-newlib-mb ("yes", "no")
# target_optspace --enable-target-optspace ("yes", "no", "")
# newlib_multithread --enable-newlib-multithread ("yes", "no", "yes")
# newlib_elix_level --enable-newlib-elix-level ("1","2","3","4") ("4")
# newlib_io_c99_formats --enable-newlib-io-c99-formats ("yes", "no", "")
# newlib_io_long_long --enable-newlib-io-long-long ("yes", "no", "")
# newlib_io_long_double --enable-newlib-io-long-double ("yes", "no", "")
# newlib_global_stdio_streams --enable-global-stdio-streams ("yes", "no, "")
# newlib_fno_builtin --disable-newlib-fno-builtin ("yes", "no, "")
# newlib_reent_check_verify --enable-newlib-reent-check-verify ("yes", "no, "")
# It sets the following shell variables:
# newlib_cflags Special CFLAGS to use when building
# machine_dir Subdirectory of libc/machine to configure
# shared_machine_dir Subdirectory of libc/machine for files shared
# between specific architectures, optional
# sys_dir Subdirectory of libc/sys to configure
# have_sys_mach_dir Is there a machine subdirectory in sys subdirectory
# posix_dir "posix" to build libc/posix, "" otherwise
# signal_dir "signal" to build libc/signal, "" otherwise
# stdio64_dir "stdio64" to build libc/stdio64, "" otherwise
# syscall_dir "syscalls" to build libc/syscalls, "" otherwise
# unix_dir "unix" to build libc/unix, "" otherwise
# use_libtool flag: use libtool to build newlib?
# aext library extension - needed for libtool support
# oext object file extension - needed for libtool support
# lpfx library object prefix - generated when no libtool
# crt1 name of crt1 object if one is provided
# crt1_dir directory where crt1 object is found
# have_crt0 "yes"/"no" if crt0 is/isn't provided.
# "" if crt0 is provided when sys_dir is set
# have_init_fini have init/fini ("yes" or "no", set to "yes" by default)
# noinclude list of include files to not install
newlib_cflags=
libm_machine_dir=
machine_dir=
shared_machine_dir=
sys_dir=
posix_dir=
signal_dir=signal
stdio_dir=stdio
stdio64_dir=
xdr_dir=
syscall_dir=
unix_dir=
noinclude=
mach_add_setjmp=
crt1=
crt1_dir=
have_crt0=
have_init_fini=yes
use_libtool=no
have_sys_mach_dir=no
default_newlib_io_c99_formats=no
default_newlib_io_long_long=no
default_newlib_io_long_double=no
default_newlib_io_pos_args=no
default_newlib_atexit_dynamic_alloc=yes
default_newlib_nano_malloc=no
default_newlib_reent_check_verify=yes
aext=a
oext=o
lpfx="lib_a-"
newlib_msg_warn=
case "${target_optspace}:${host}" in
yes:*)
newlib_cflags="${newlib_cflags} -Os"
;;
:m32r-* | :d10v-* | :d30v-* | :avr-* | :m32c-* | :msp430*-* | :nds32* | :pru-* | :rl78-* )
newlib_cflags="${newlib_cflags} -Os"
;;
no:* | :*)
;;
esac
case "${newlib_fno_builtin}:${host}" in
yes:*)
newlib_cflags="${newlib_cflags} -fno-builtin"
;;
no:*)
newlib_cflags="${newlib_cflags}"
;;
*:*)
# For now, all targets default to using -fno-builtin until tested without
newlib_cflags="${newlib_cflags} -fno-builtin"
;;
esac
# Get the source directories to use for the CPU type.
# machine_dir should supply CPU dependent routines, such as setjmp.
# newlib_cflags is passed to gcc when compiling.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host_cpu}" in
a29k)
machine_dir=a29k
;;
aarch64*)
machine_dir=aarch64
libm_machine_dir=aarch64
;;
amdgcn*)
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
machine_dir=amdgcn
libc_cv_initfinit_array=yes
;;
arc*)
machine_dir=arc
;;
arm*)
machine_dir=arm
libm_machine_dir=arm
;;
avr*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mcall-prologues"
;;
bfin)
machine_dir=bfin
;;
cr16*)
machine_dir=cr16
;;
cris | crisv32)
# The size of the (kernel_)time_t passed from or to a
# simulator or a Linux kernel is mandated by the
# gettimeofday and time system calls and fixed to 32 bits, the
# size of a long. Instead of churning as 64 bits what is anyway
# 32 bits, it makes more sense to default to long.
test -z "${enable_newlib_long_time_t}" && newlib_long_time_t=yes
machine_dir=cris
;;
crx*)
machine_dir=crx
;;
csky*)
machine_dir=csky
default_newlib_atexit_dynamic_alloc="no"
;;
d10v*)
machine_dir=d10v
;;
d30v*)
machine_dir=d30v
;;
epiphany)
machine_dir=epiphany
;;
fido)
machine_dir=m68k
newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
;;
fr30)
machine_dir=fr30
;;
frv)
machine_dir=frv
;;
ft32*)
machine_dir=ft32
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED"
;;
h8300)
machine_dir=h8300
;;
h8500)
machine_dir=h8500
;;
hppa*)
machine_dir=hppa
;;
i960)
machine_dir=i960
;;
i[34567]86)
libm_machine_dir=i386
machine_dir=i386
shared_machine_dir=shared_x86
# Don't use for these since they provide their own setjmp.
case ${host} in
*-*-sco* | *-*-cygwin*)
;;
*)
mach_add_setjmp=true
;;
esac
;;
ia64*)
;;
iq2000)
machine_dir=iq2000
;;
lm32)
machine_dir=lm32
;;
m32c)
machine_dir=m32c
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
;;
m32r*)
machine_dir=m32r
;;
m68hc11|m6811|m68hc12|m6812)
machine_dir=m68hc11
newlib_cflags="-DPREFER_SIZE_OVER_SPEED -Os -mrelax"
CFLAGS="-g -Os"
;;
m68*)
machine_dir=m68k
newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
;;
m88k)
machine_dir=m88k
newlib_cflags="${newlib_cflags} -m88000"
;;
m88110)
machine_dir=m88k
newlib_cflags="${newlib_cflags} -m88110"
;;
mcore)
;;
microblaze*)
machine_dir=microblaze
;;
mep)
machine_dir=mep
;;
mips*)
machine_dir=mips
libm_machine_dir=mips
;;
mmix)
;;
mn10200)
machine_dir=mn10200
;;
mn10300)
default_newlib_io_long_long="yes"
machine_dir=mn10300
;;
moxie)
machine_dir=moxie
;;
msp430*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
newlib_cflags="${newlib_cflags} -mOs "
newlib_cflags="${newlib_cflags} -mhwmult=none "
machine_dir=msp430
default_newlib_nano_malloc="yes"
;;
mt*)
machine_dir=mt
;;
nds32*)
machine_dir=nds32
libm_machine_dir=nds32
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections"
newlib_cflags="${newlib_cflags} -DHAVE_RENAME"
;;
nios2*)
machine_dir=nios2
;;
nvptx*)
machine_dir=nvptx
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED"
;;
or1k*|or1knd*)
machine_dir=or1k
have_init_fini=no
;;
powerpc*)
machine_dir=powerpc
libm_machine_dir=powerpc
;;
pru*)
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED"
newlib_cflags="${newlib_cflags} -DNO_EXEC"
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
default_newlib_nano_malloc="yes"
default_newlib_atexit_dynamic_alloc="no"
machine_dir=pru
libm_machine_dir=pru
;;
riscv*)
libm_machine_dir=riscv
machine_dir=riscv
newlib_cflags="${newlib_cflags} -DHAVE_NANOSLEEP"
default_newlib_atexit_dynamic_alloc="no"
have_init_fini=no
;;
rl78)
machine_dir=rl78
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
;;
rx)
machine_dir=rx
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
;;
sh | sh64)
machine_dir=sh
;;
sparc*)
libm_machine_dir=sparc
machine_dir=sparc
# FIXME: Might wish to make MALLOC_ALIGNMENT more generic.
newlib_cflags="${newlib_cflags} -DMALLOC_ALIGNMENT=8"
;;
tic4x|c4x)
machine_dir=tic4x
;;
tic6x)
machine_dir=tic6x
;;
tic80*)
machine_dir=tic80
;;
v70)
;;
v810)
;;
v850*)
machine_dir=v850
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED "
;;
visium)
machine_dir=visium
;;
w65*)
machine_dir=w65
;;
x86_64)
machine_dir=x86_64
libm_machine_dir=x86_64
shared_machine_dir=shared_x86
;;
xc16x*)
machine_dir=xc16x
;;
xstormy16)
machine_dir=xstormy16
newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED"
newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED"
;;
z8k)
machine_dir=z8k
;;
spu)
stdio_dir=
libm_machine_dir=spu
machine_dir=spu
newlib_cflags="${newlib_cflags} -D_POSIX_MODE"
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
;;
*)
echo '***' "Newlib does not support CPU ${host_cpu}" 1>&2
exit 1
;;
esac
# Disable thread support if requested.
if [ "${newlib_multithread}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -D__SINGLE_THREAD__"
fi
# Disable syscall support if requested.
if [ "${newlib_may_supply_syscalls}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -D__NO_SYSCALLS__"
fi
# Enable multibyte support if requested or it is defaulted
# for target.
if [ "x${newlib_mb}" = "x" ]; then
case "${host}" in
i[34567]86-pc-linux-*|*-*-cygwin*)
newlib_mb=yes
;;
esac
fi
# Disable printf/scanf floating-point support if requested.
if [ "${newlib_io_float}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -DNO_FLOATING_POINT"
fi
# Verify if shared newlib support is allowed and set appropriate variables
# We don't want to use libtool for platforms that we are not going to
# support shared libraries. This is because it adds executable tests which
# we don't want for most embedded platforms.
case "${host}" in
i[34567]86-pc-linux-*)
use_libtool=yes
have_sys_mach_dir=yes
stdio64_dir=stdio64
oext=lo
lpfx=
aext=la ;;
*) ;; #shared library not supported for ${host}
esac
# Get the source directories to use for the host. unix_dir is set
# to unix to get some standard Unix routines. posix_dir is set to get some
# standard Posix routines. sys_dir should supply system dependent routines
# including crt0.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
*-*-cygwin*)
posix_dir=posix
stdio64_dir=stdio64
xdr_dir=xdr
;;
*-*-netware*)
signal_dir=
sys_dir=netware
;;
*-*-phoenix*)
sys_dir=phoenix
posix_dir=posix
unix_dir=unix
;;
*-*-rtems*) # generic RTEMS support
sys_dir=rtems
posix_dir=posix
unix_dir=unix
;;
*-*-tirtos*)
sys_dir=tirtos
have_crt0="no"
;;
a29k-*-*)
sys_dir=a29khif
signal_dir=
;;
aarch64*-*-*)
newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
;;
amdgcn*)
sys_dir=amdgcn
have_crt0="no"
;;
arm*-*-*)
newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
sys_dir=arm
if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
have_crt0="no"
fi
;;
bfin-*-*)
sys_dir=
;;
cr16-*-*)
sys_dir=
;;
crx*)
sys_dir=
;;
d10v*)
sys_dir=d10v
;;
d30v*)
sys_dir=
;;
epiphany-*-*)
sys_dir=epiphany
# crt0 is provided by libgloss.
have_crt0="no"
;;
frv*)
sys_dir=
;;
ft32*)
sys_dir=
;;
h8300-*-hms*)
sys_dir=h8300hms
;;
h8300-*-elf*)
sys_dir=h8300hms
;;
h8300-*-coff*)
sys_dir=h8300hms
;;
h8300-*-xray*)
sys_dir=h8300xray
;;
h8500-*-hms*)
sys_dir=h8500hms
;;
h8500-*-elf*)
sys_dir=h8500hms
;;
i[34567]86-*-rdos*)
sys_dir=rdos
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
newlib_cflags="${newlib_cflags} -D_I386MACH_DISABLE_HW_INTERRUPTS"
;;
i[34567]86-*-sco*)
sys_dir=sysvi386
unix_dir=unix
;;
i[34567]86-pc-linux-*)
sys_dir=linux
unix_dir=unix
posix_dir=posix
crt1=crt1.o
crt1_dir=libc/sys/${sys_dir}
gcc_dir=`gcc -print-search-dirs | awk '/^install:/{print $2}'`
default_newlib_io_c99_formats="yes"
default_newlib_io_long_double="yes"
default_newlib_io_long_long="yes"
default_newlib_io_pos_args="yes"
#newlib_cflags="${newlib_cflags} -Werror" # DEBUGGING ONLY;BREAKS BUILD
newlib_cflags="${newlib_cflags} -Wall"
newlib_cflags="${newlib_cflags} -DHAVE_FCNTL"
newlib_cflags="${newlib_cflags} -DHAVE_GETOPT"
newlib_cflags="${newlib_cflags} -D_NO_POSIX_SPAWN"
# --- Required when building a shared library ------------------------
newlib_cflags="${newlib_cflags} -fPIC -D_I386MACH_NEED_SOTYPE_FUNCTION"
# --- The three lines below are optional ------------------------------
##newlib_cflags="${newlib_cflags} -nostdinc"
##newlib_cflags="${newlib_cflags} -I`newlib-flags --kernel-dir`/include"
##newlib_cflags="${newlib_cflags} -idirafter ${gcc_dir}include"
;;
m68hc11-*-*|m6811-*-*|m6812-*-*|m68hc12-*-*)
;;
m68k-sun-sunos*)
unix_dir=unix
;;
m8*-bug-*)
sys_dir=m88kbug
;;
mep-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
microblaze*-*-*)
machine_dir=microblaze
;;
mips*-dec-*)
sys_dir=decstation
;;
mmix-knuth-mmixware)
sys_dir=mmixware
;;
moxie*)
sys_dir=
;;
nios2*)
sys_dir=
;;
or1k-*-elf | or1knd-*-elf)
sys_dir=or1k
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED "
have_crt0="no"
;;
powerpcle-*-pe)
posix_dir=posix
;;
sh*-*)
sys_dir=sh
;;
sparc-sun-sunos*)
sys_dir=sun4
unix_dir=unix
;;
sparc64*)
sys_dir=sparc64
unix_dir=unix
;;
spu-*-*)
default_newlib_io_long_long="yes"
default_newlib_atexit_dynamic_alloc="no"
;;
tic6x*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
have_crt0="no"
;;
tic80*)
sys_dir=tic80
;;
v70-nec-*)
sys_dir=sysvnecv70
;;
v810-*-*)
sys_dir=sysnec810
;;
v850*-*-*)
sys_dir=sysnecv850
if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
have_crt0="no"
fi
;;
visium-*-*)
sys_dir=
;;
w65-*-*)
sys_dir=w65
;;
z8k-*-coff)
sys_dir=z8ksim
;;
esac
# Host specific flag settings -- usually for features that are not
# general enough or broad enough to be handled above.
# THIS TABLE IS ALPHA SORTED. KEEP IT THAT WAY.
case "${host}" in
*-*-cygwin*)
test -z "$cygwin_srcdir" && cygwin_srcdir=`cd ${srcdir}/../winsup/cygwin; pwd`
export cygwin_srcdir
default_newlib_io_c99_formats="yes"
default_newlib_io_long_long="yes"
default_newlib_io_long_double="yes"
default_newlib_io_pos_args="yes"
CC="${CC} -I${cygwin_srcdir}/include"
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DGETREENT_PROVIDED -DSIGNAL_PROVIDED -D_COMPILING_NEWLIB -DHAVE_BLKSIZE -DHAVE_FCNTL -DMALLOC_PROVIDED"
syscall_dir=syscalls
;;
*-*-phoenix*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -D_COMPILING_NEWLIB -DHAVE_BLKSIZE -DHAVE_NANOSLEEP"
default_newlib_io_long_long="yes"
syscall_dir=
;;
# RTEMS supplies its own versions of some routines:
# malloc() (reentrant version)
# exit() RTEMS has a "global" reent to flush
# signal()/raise() RTEMS has its own including pthread signals
# _XYZ_r() RTEMS has its own reentrant routines
#
# NOTE: When newlib malloc uses a semaphore, RTEMS will switch to that.
*-*-rtems*)
default_newlib_io_long_long="yes"
default_newlib_io_c99_formats="yes"
newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections "
newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
# turn off unsupported items in posix directory
newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
;;
# VxWorks supplies its own version of malloc, and the newlib one
# doesn't work because VxWorks does not have sbrk.
*-wrs-vxworks*)
newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DMISSING_SYSCALL_NAMES -DHAVE_FCNTL"
;;
# TIRTOS supplies its own version of malloc
*-*-tirtos*)
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__ -DMALLOC_PROVIDED"
;;
# UDI doesn't have exec, so system() should fail the right way
a29k-amd-udi)
newlib_cflags="${newlib_cflags} -DNO_EXEC"
syscall_dir=syscalls
;;
aarch64*-*-*)
default_newlib_io_long_long="yes"
syscall_dir=syscalls
;;
arc*-*-*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
arm*-*-pe)
syscall_dir=syscalls
;;
arm*-*-*)
syscall_dir=syscalls
# If newlib is supplying syscalls, select which debug protocol is being used.
# ARM_RDP_MONITOR selects the Demon monitor.
# ARM_RDI_MONITOR selects the Angel monitor.
# If neither are defined, then hard coded defaults will be used
# to create the program's environment.
# If --disable-newlib-supplied-syscalls is specified, then the end-user
# may specify the protocol via gcc spec files supplied by libgloss.
if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
# newlib_cflags="${newlib_cflags} -DARM_RDP_MONITOR"
newlib_cflags="${newlib_cflags} -DARM_RDI_MONITOR"
fi
;;
avr*)
newlib_cflags="${newlib_cflags} -DNO_EXEC -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
;;
bfin*)
syscall_dir=syscalls
;;
cris-*-* | crisv32-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -D_USE_WRITE -DCOMPACT_CTYPE"
syscall_dir=syscalls
;;
cr16-*-*)
syscall_dir=syscalls
;;
crx-*-*)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
csky*)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
d10v*)
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY"
syscall_dir=syscalls
;;
d30v*)
newlib_cflags="${newlib_cflags} -DABORT_MESSAGE -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
epiphany*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
;;
fido-*-elf)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
fr30-*-*)
syscall_dir=syscalls
;;
frv-*-*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
ft32*-*-*)
syscall_dir=syscalls
;;
h8300*-*-*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
# Simulator only extensions for H8300.
# Uncomment the next line to enable them.
# newlib_cflags="${newlib_cflags} -D__SIMULATOR__"
;;
h8500-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
i[34567]86-*-sco*)
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED -DHAVE_FCNTL"
;;
i[34567]86-*-netware*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DNO_EXEC -DABORT_PROVIDED -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DHAVE_FCNTL"
;;
i[3-7]86-*-elfiamcu)
newlib_cflags="${newlib_cflags} -Os -DPREFER_SIZE_OVER_SPEED -ffunction-sections -fomit-frame-pointer -DREENTRANT_SYSCALL_PROVIDED"
if [ "${newlib_multithread}" = "no" ] ; then
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
else
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -D__DYNAMIC_REENT__"
fi
;;
iq2000*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
lm32-*-*)
syscall_dir=syscalls
;;
m32c-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DABORT_PROVIDED"
syscall_dir=
;;
m32r-*-*)
# Pass -msdata=sdata so _impure_ptr goes in .sdata.
# We don't generate sda relocs however for upward compatibility.
# FIXME: This is necessary because the default multilib doesn't
# use --print-multi-lib.
newlib_cflags="${newlib_cflags} -msdata=sdata"
syscall_dir=syscalls
;;
m68hc11-*-*|m6811-*-*|m68hc12-*-*|m6812-*-*)
newlib_cflags="${newlib_cflags} -DNO_EXEC -DABORT_PROVIDED -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
;;
m68k-unknown-elf)
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
mcore-*-*)
syscall_dir=syscalls
;;
microblaze*-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES -DSMALL_MEMORY -D_REENT_SMALL"
;;
mips64vr*-*-*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
mips*-*-elf*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
mmix-*)
syscall_dir=syscalls
# We need every symbol 32-bit aligned, so the invalid
# construct with attribute ((alias ("_ctype_b+127"))) breaks.
newlib_cflags="${newlib_cflags} -DCOMPACT_CTYPE"
;;
mn10?00-*-*)
syscall_dir=syscalls
;;
moxie-*-elf* | moxie-*-rtems*)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
;;
moxie-*-moxiebox)
syscall_dir=syscalls
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -Os -DPREFER_SIZE_OVER_SPEED -DSMALL_MEMORY"
;;
nios2*)
syscall_dir=
newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
;;
nds32*)
syscall_dir=syscalls
;;
or1k*|or1knd*)
syscall_dir=syscalls
;;
powerpc*-*-eabialtivec*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
powerpc*-*-eabispe*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
;;
powerpc*-*-eabi* | \
powerpc*-*-elf* | \
powerpc*-*-linux* | \
powerpc*-*-rtem* | \
powerpc*-*-sysv* | \
powerpc*-*-solaris*)
default_newlib_io_long_long="yes"
newlib_cflags="${newlib_cflags} -mrelocatable-lib -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES"
;;
powerpcle-*-pe)
newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DHAVE_FCNTL -D_NO_POSIX_SPAWN"
syscall_dir=syscalls
;;
pru*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_MEMORY -D_REENT_SMALL"
;;
riscv*-*-*)
syscall_dir=syscalls
;;
sh*-*-*)
default_newlib_io_long_long="yes"
syscall_dir=syscalls
;;
sparc-sun-sunos*)
newlib_cflags="${newlib_cflags} -DSIGNAL_PROVIDED"
;;
sparc64-*-*)
newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_BLKSIZE -DHAVE_FCNTL"
# This either belongs elsewhere or nowhere. But I need *something*,
# so for now it's here ...
case "${host_os}" in
aoutv8 | *32p)
newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=32" ;;
*)
newlib_cflags="${newlib_cflags} -DTARGET_PTR_SIZE=64" ;;
esac
;;
tic6x*)
syscall_dir=
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED"
;;
tic80*)
syscall_dir=syscalls
;;
v850*-*-*)
syscall_dir=syscalls
;;
visium-*-*)
newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DHAVE_SYSTEM -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
w65-*-*)
syscall_dir=syscalls
newlib_cflags="${newlib_cflags} -DSMALL_DTOA -DSMALL_MEMORY"
;;
xc16x-*)
syscall_dir=syscalls
;;
xstormy16-*-*)
syscall_dir=syscalls
;;
z8k-*-*)
syscall_dir=syscalls
;;
*)
newlib_cflags="${newlib_cflags} -DMISSING_SYSCALL_NAMES"
syscall_dir=
;;
esac
# Use defaults for certain settings if not specified by user
# Enable C99 format support in I/O routines if requested.
if [ "x${newlib_io_c99_formats}" = "x" ]; then
if [ ${default_newlib_io_c99_formats} = "yes" ]; then
newlib_io_c99_formats="yes";
fi
fi
# Enable long long support in I/O routines if requested.
if [ "x${newlib_io_long_long}" = "x" ]; then
if [ ${default_newlib_io_long_long} = "yes" ]; then
newlib_io_long_long="yes";
fi
fi
# Enable long double support in I/O routines if requested.
if [ "x${newlib_io_long_double}" = "x" ]; then
if [ ${default_newlib_io_long_double} = "yes" ]; then
newlib_io_long_double="yes";
fi
fi
# Enable printf positional argument support if requested.
if [ "x${newlib_io_pos_args}" = "x" ]; then
if [ ${default_newlib_io_pos_args} = "yes" ]; then
newlib_io_pos_args="yes";
fi
fi
# Disable atexit dynamic allocation if requested.
if [ "x${newlib_atexit_dynamic_alloc}" = "x" ]; then
if [ ${default_newlib_atexit_dynamic_alloc} = "yes" ]; then
newlib_atexit_dynamic_alloc="yes";
fi
fi
# Enable nano-malloc if requested.
if [ "x${newlib_nano_malloc}" = "x" ]; then
if [ ${default_newlib_nano_malloc} = "yes" ]; then
newlib_nano_malloc="yes";
fi
fi
# Enable _REENT_CHECK macro memory allocation verification.
if [ "x${newlib_reent_check_verify}" = "x" ]; then
if [ ${default_newlib_reent_check_verify} = "yes" ]; then
newlib_reent_check_verify="yes";
fi
fi
# Remove rpc headers if xdr_dir not specified
if [ "x${xdr_dir}" = "x" ]; then
noinclude="${noinclude} rpc/types.h rpc/xdr.h"
fi
# Have init/finit if not explicitly specified otherwise
if [ "x${have_init_fini}" != "xno" ]; then
newlib_cflags="${newlib_cflags} -DHAVE_INIT_FINI"
fi
if test -z "${have_crt0}" && test -n "${sys_dir}"; then
have_crt0="yes"
fi
# Target-specific defaults
case "${host_cpu}" in
nvptx*)
if [ "x${newlib_elix_level}" = "x0" ]; then
newlib_elix_level=1;
elif [ "x${newlib_elix_level}" != "x1" ]; then
newlib_msg_warn="nvptx does not support elix level > 1";
fi
if [[ -z ${newlib_global_stdio_streams} ]]; then
newlib_global_stdio_streams="yes";
fi
;;
esac