Merge branch 'upstream-master' into merge-upstream-20200829

This commit is contained in:
Giacomo Tesio 2020-08-29 00:05:13 +02:00
commit ded03c70bf
990 changed files with 74028 additions and 9909 deletions

View File

@ -425,3 +425,30 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
(21) BSD-2-Clause-FreeBSD (pru-* targets)
SPDX-License-Identifier: BSD-2-Clause-FreeBSD
Copyright (c) 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1193,3 +1193,84 @@ and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
(52) BSD-2-Clause-FreeBSD (pru-* targets)
SPDX-License-Identifier: BSD-2-Clause-FreeBSD
Copyright (c) 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(53) Andrew Turner (arm-* targets)
Copyright (c) 2013 Andrew Turner <andrew@FreeBSD.ORG>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
(54) BSD-2-Clause-FreeBSD David Schultz (arm-* targets)
SPDX-License-Identifier: BSD-2-Clause-FreeBSD
Copyright (c) 2004-2011 David Schultz <das@FreeBSD.ORG>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

View File

@ -6,6 +6,8 @@
* is freely granted, provided that this notice is preserved.
*/
.syntax unified
#include "linux-syscall.h"
#if __thumb__
@ -146,12 +148,21 @@ ALIAS(utime)
ALIAS(vfork)
ALIAS(wait4)
#if defined (__thumb__) && !defined (__thumb2__)
# define SOCKETCALL(name, NAME) \
GLOBAL(name); \
push { r0 - r3 }; \
movs r0, #SYS_ ## NAME; \
b _socketcall_tail; \
SIZE(name)
#else
# define SOCKETCALL(name, NAME) \
GLOBAL(name); \
push { r0 - r3 }; \
mov r0, #SYS_ ## NAME; \
b _socketcall_tail; \
SIZE(name)
#endif
FUNC(_socketcall_tail)
mov r1, sp

8
libgloss/configure vendored
View File

@ -710,6 +710,7 @@ spu
tic6x
iq2000
or1k
pru
nios2
libnosys'
@ -2551,7 +2552,7 @@ case "${target}" in
subdirs="$subdirs m32c"
;;
msp430*-*-elf)
msp430-*-elf*)
subdirs="$subdirs msp430"
config_libnosys=false
@ -2586,6 +2587,10 @@ case "${target}" in
or1k-*-* | or1knd-*-* )
subdirs="$subdirs or1k"
;;
pru-*-*)
subdirs="$subdirs pru"
;;
nios2-*-*)
subdirs="$subdirs nios2"
@ -3878,6 +3883,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
srcdir=${srcdir}
target=${target}
host=${host}
with_multisubdir=${with_multisubdir}
ac_configure_args="--enable-multilib ${ac_configure_args}"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}

View File

@ -148,7 +148,7 @@ case "${target}" in
m32c-*-*)
AC_CONFIG_SUBDIRS([m32c])
;;
msp430*-*-elf)
msp430-*-elf*)
AC_CONFIG_SUBDIRS([msp430])
config_libnosys=false
;;
@ -176,6 +176,9 @@ case "${target}" in
or1k-*-* | or1knd-*-* )
AC_CONFIG_SUBDIRS([or1k])
;;
pru-*-*)
AC_CONFIG_SUBDIRS([pru])
;;
nios2-*-*)
AC_CONFIG_SUBDIRS([nios2])
;;
@ -226,6 +229,7 @@ AC_CONFIG_FILES([Makefile],
fi],
srcdir=${srcdir}
target=${target}
host=${host}
with_multisubdir=${with_multisubdir}
ac_configure_args="--enable-multilib ${ac_configure_args}"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}

View File

@ -10,11 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -5,7 +5,7 @@
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# and/or other materials related to such
# distribution and use acknowledge that the software was developed
# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to
# endorse or promote products derived from this software without

View File

@ -94,9 +94,9 @@ __hosted_from_gdb_stat (const struct gdb_stat *gs,
s->st_size = gs->st_size;
s->st_blksize = gs->st_blksize;
s->st_blocks = gs->st_blocks;
s->st_atime = gs->st_atime;
s->st_mtime = gs->st_mtime;
s->st_ctime = gs->st_ctime;
s->st_atime = gs->st_atim;
s->st_mtime = gs->st_mtim;
s->st_ctime = gs->st_ctim;
}
void

View File

@ -38,7 +38,7 @@ off_t lseek (int fd, off_t offset, int whence)
#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
parameters[1] = (uint32_t) ((offset >> 32) & 0xffffffff);
parameters[1] = (uint32_t) ((int64_t)offset >> 32);
parameters[2] = (uint32_t) (offset & 0xffffffff);
parameters[3] = __hosted_to_gdb_lseek_flags (whence);
__hosted (HOSTED_LSEEK, parameters);

View File

@ -58,9 +58,9 @@ struct gdb_stat {
uint64_t st_size; /* total size, in bytes */
uint64_t st_blksize; /* blocksize for filesystem I/O */
uint64_t st_blocks; /* number of blocks allocated */
gdb_time_t st_atime; /* time of last access */
gdb_time_t st_mtime; /* time of last modification */
gdb_time_t st_ctime; /* time of last change */
gdb_time_t st_atim; /* time of last access */
gdb_time_t st_mtim; /* time of last modification */
gdb_time_t st_ctim; /* time of last change */
};
struct gdb_timeval {

View File

@ -1,7 +1,7 @@
/*
* sim-unlink.S -- write interface for moxie simulator
*
* Copyright (c) 2008 Anthony Green
* Copyright (c) 2008, 2019 Anthony Green
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
@ -22,7 +22,7 @@
.text
_unlink:
unlink:
jmpa unlink
swi SYS_unlink
ret
.Lend:
.size _unlink,.Lend-_unlink

View File

@ -69,6 +69,7 @@ LIB_CRT = libcrt.a
SIM_OBJS = syscalls.o \
cio.o \
write.o \
unlink.o \
sbrk.o
NOSYS_OBJS = ciosyscalls.o \

View File

@ -19,7 +19,7 @@ INCLUDE intr_vectors.ld
MEMORY
{
RAM (w) : ORIGIN = 0x00500, LENGTH = 0x0eb00
RAM (w) : ORIGIN = 0x00500, LENGTH = 0x0fac0 /* END=0xffbf */
}
SECTIONS
@ -42,14 +42,18 @@ SECTIONS
. = ALIGN(2);
*(.rodata1)
. = ALIGN(2);
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
. = ALIGN(2);
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
. = ALIGN(2);
PROVIDE (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE (__init_array_end = .);
. = ALIGN(2);
PROVIDE (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))

View File

@ -26,7 +26,7 @@ INCLUDE intr_vectors.ld
MEMORY
{
RAM (rw) : ORIGIN = 0x00500, LENGTH = 0x01b00
ROM (rx) : ORIGIN = 0x02000, LENGTH = 0x0df00
ROM (rx) : ORIGIN = 0x02000, LENGTH = 0x0dfc0
/* The regions from intr_vectors.ld go here. */
HIFRAM (rw) : ORIGIN = 0x10000, LENGTH = 0x80000
HIROM (rx) : ORIGIN = 0x90000, LENGTH = 0x70000
@ -68,13 +68,16 @@ SECTIONS
. = ALIGN(2);
KEEP (*(.gcc_except_table)) *(.gcc_except_table.*)
. = ALIGN(2);
PROVIDE (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE (__preinit_array_end = .);
. = ALIGN(2);
PROVIDE (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE (__init_array_end = .);
. = ALIGN(2);
PROVIDE (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))

View File

@ -5,7 +5,7 @@
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# and/or other materials related to such
# distribution and use acknowledge that the software was developed
# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to
# endorse or promote products derived from this software without

View File

@ -106,9 +106,9 @@ __hosted_from_gdb_stat (const struct gdb_stat *gs,
s->st_size = SWAP64 (gs->st_size);
s->st_blksize = SWAP64 (gs->st_blksize);
s->st_blocks = SWAP64 (gs->st_blocks);
s->st_atime = SWAP32 (gs->st_atime);
s->st_mtime = SWAP32 (gs->st_mtime);
s->st_ctime = SWAP32 (gs->st_ctime);
s->st_atime = SWAP32 (gs->st_atim);
s->st_mtime = SWAP32 (gs->st_mtim);
s->st_ctime = SWAP32 (gs->st_ctim);
}
void

View File

@ -39,7 +39,7 @@ off_t lseek (int fd, off_t offset, int whence)
#if HOSTED
gdb_parambuf_t parameters;
parameters[0] = (uint32_t) fd;
parameters[1] = (uint32_t) ((offset >> 32) & 0xffffffff);
parameters[1] = (uint32_t) ((int64_t)offset >> 32);
parameters[2] = (uint32_t) (offset & 0xffffffff);
parameters[3] = __hosted_to_gdb_lseek_flags (whence);
__io_hosted (HOSTED_LSEEK, parameters);

View File

@ -57,9 +57,9 @@ struct gdb_stat {
uint64_t st_size; /* total size, in bytes */
uint64_t st_blksize; /* blocksize for filesystem I/O */
uint64_t st_blocks; /* number of blocks allocated */
gdb_time_t st_atime; /* time of last access */
gdb_time_t st_mtime; /* time of last modification */
gdb_time_t st_ctime; /* time of last change */
gdb_time_t st_atim; /* time of last access */
gdb_time_t st_mtim; /* time of last modification */
gdb_time_t st_ctim; /* time of last change */
};
struct gdb_timeval {

155
libgloss/pru/Makefile.in Normal file
View File

@ -0,0 +1,155 @@
# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
#
# Copyright 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VPATH = @srcdir@ @srcdir@/..
srcdir = @srcdir@
objdir = .
srcroot = $(srcdir)/../..
objroot = $(objdir)/../..
top_srcdir = @top_srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
host_alias = @host_alias@
target_alias = @target_alias@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
tooldir = $(exec_prefix)/$(target_alias)
# Multilib support variables.
# TOP is used instead of MULTI{BUILD,SRC}TOP.
MULTIDIRS =
MULTISUBDIR =
SHELL = /bin/sh
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
CC = @CC@
AS = @AS@
AR = @AR@
LD = @LD@
RANLIB = @RANLIB@
OBJDUMP = `t='$(program_transform_name)'; echo objdump | sed -e $$t`
OBJCOPY = `t='$(program_transform_name)'; echo objcopy | sed -e $$t`
# linker scripts
SCRIPTS = `ls ${srcdir}/ldscripts/*.x`
# object files needed
OBJS = \
do_global_dtors.o gettimeofday.o \
isatty.o putnum.o raise.o \
inbyte.o outbyte.o sbrk.o stat.o syscalls.o \
do_global_dtors.o
# Object files specific to particular targets.
EVALOBJS = ${OBJS}
CRTOBJS = crt0.o crt0-minrt.o
OUTPUTS = libgloss.a $(CRTOBJS)
INCLUDES = -I$(srcdir)/..
# Note that when building the library, ${MULTILIB} is not the way multilib
# options are passed; they're passed in $(CFLAGS).
CFLAGS_FOR_TARGET = ${MULTILIB} ${INCLUDES}
LDFLAGS_FOR_TARGET = ${MULTILIB}
.c.o:
$(CC) $(CFLAGS_FOR_TARGET) -Os $(INCLUDES) -c $(CFLAGS) $<
.C.o:
$(CC) $(CFLAGS_FOR_TARGET) -Os $(INCLUDES) -c $(CFLAGS) $<
.s.o:
$(AS) $(ASFLAGS_FOR_TARGET) $(INCLUDES) $(ASFLAGS) -o $*.o $<
#
# GCC knows to run the preprocessor on .S files before it assembles them.
#
.S.o:
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
all: ${OUTPUTS} copy_scripts_to_objdir
copy_scripts_to_objdir: $(srcdir)/ldscripts/gen-ld-scripts.sh
cp $(SCRIPTS) $(objdir)
#
# here's where we build the library for each target
#
libgloss.a: $(EVALOBJS)
${AR} ${ARFLAGS} $@ $(EVALOBJS)
${RANLIB} $@
# C Runtime Library startup code.
crt0.o: $(srcdir)/crt0.S
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) $< -c -o $@
crt0-minrt.o: $(srcdir)/crt0.S
$(CC) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -DMINRT $< -c -o $@
doc:
clean mostlyclean:
rm -f $(OUTPUTS) *.i *~ *.o *-test *.srec *.dis *.map *.x
distclean maintainer-clean realclean: clean
rm -f Makefile config.status $(OUTPUTS)
.PHONY: install info install-info clean-info
install: $(OUTPUTS) $(srcdir)/ldscripts/gen-ld-scripts.sh
for outputs in ${OUTPUTS}; do\
${INSTALL_DATA} $${outputs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}/$${outputs}; \
done
for s in $(SCRIPTS); do \
b=`basename $$s`; \
${INSTALL_DATA} $$s ${DESTDIR}${tooldir}/lib${MULTISUBDIR}/$$b ;\
done
${mkinstalldirs} ${DESTDIR}${tooldir}/lib${MULTISUBDIR}/device-specs; \
for s in ${srcdir}/device-specs/*; do \
b=`basename $$s`; \
$(INSTALL_DATA) $$s $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/device-specs/$$b ;\
done
info:
install-info:
clean-info:
Makefile: $(srcdir)/Makefile.in config.status @host_makefile_frag_path@
$(SHELL) config.status
config.status: $(srcdir)/configure
$(SHELL) config.status --recheck

409
libgloss/pru/aclocal.m4 vendored Normal file
View File

@ -0,0 +1,409 @@
# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
# 2010, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 12
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
am__universal=false
m4_case([$1], [CC],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac],
[CXX],
[case " $depcc " in #(
*\ -arch\ *\ -arch\ *) am__universal=true ;;
esac])
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this. Also, some Intel
# versions had trouble with output in subdirs
am__obj=sub/conftest.${OBJEXT-o}
am__minus_obj="-o $am__obj"
case $depmode in
gcc)
# This depmode causes a compiler race in universal mode.
test "$am__universal" = false || continue
;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
am__obj=conftest.${OBJEXT-o}
am__minus_obj=
;;
none) break ;;
esac
if depmode=$depmode \
source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
am__nodep='_no'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 5
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[{
# Autoconf 2.62 quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
case $CONFIG_FILES in
*\'*) eval set x "$CONFIG_FILES" ;;
*) set x $CONFIG_FILES ;;
esac
shift
for mf
do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo this is the am__doit target
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# Ignore all kinds of additional output from `make'.
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=include
am__quote=
_am_result=GNU
;;
esac
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
case `$am_make -s -f confmf 2> /dev/null` in #(
*the\ am__doit\ target*)
am__include=.include
am__quote="\""
_am_result=BSD
;;
esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
m4_include([../acinclude.m4])

3874
libgloss/pru/configure vendored Executable file

File diff suppressed because it is too large Load Diff

66
libgloss/pru/configure.in Normal file
View File

@ -0,0 +1,66 @@
# Copyright (c) 2008, 2009, 2011, 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the BSD
# License. This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license
# is available at http://www.opensource.org/licenses. Any Red Hat trademarks that
# are incorporated in the source code or documentation are not subject to the BSD
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(crt0.S)
if test "${enable_shared}" = "yes" ; then
echo "Shared libraries not supported for cross compiling, ignored"
fi
if test "$srcdir" = "." ; then
if test "${with_target_subdir}" != "." ; then
libgloss_topdir="${srcdir}/${with_multisrctop}../../.."
else
libgloss_topdir="${srcdir}/${with_multisrctop}../.."
fi
else
libgloss_topdir="${srcdir}/../.."
fi
AC_CONFIG_AUX_DIR($libgloss_topdir)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
AC_PROG_INSTALL
LIB_AC_PROG_CC
AS=${AS-as}
AC_SUBST(AS)
AR=${AR-ar}
AC_SUBST(AR)
LD=${LD-ld}
AC_SUBST(LD)
AC_PROG_RANLIB
LIB_AM_PROG_AS
host_makefile_frag=${srcdir}/../config/default.mh
dnl We have to assign the same value to other variables because autoconf
dnl doesn't provide a mechanism to substitute a replacement keyword with
dnl arbitrary data or pathnames.
dnl
host_makefile_frag_path=$host_makefile_frag
AC_SUBST(host_makefile_frag_path)
AC_SUBST_FILE(host_makefile_frag)
AC_CONFIG_FILES(Makefile,
. ${libgloss_topdir}/config-ml.in,
srcdir=${srcdir}
target=${target}
with_multisubdir=${with_multisubdir}
ac_configure_args="${ac_configure_args} --enable-multilib"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
libgloss_topdir=${libgloss_topdir}
)
AC_OUTPUT

97
libgloss/pru/crt0.S Normal file
View File

@ -0,0 +1,97 @@
/* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* crt0.S -- PRU startup code
*
* Copyright (c) 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "newlib.h"
.extern main
.extern exit
.text
.section .init0, "x"
.global _start
_start:
/* Initialize stack pointer. */
ldi32 sp, _stack_top
/* DATA and BSS are handled by the loader, so nothing to do here. */
#if !defined(MINRT)
.extern _do_global_dtors
/* Ensure destructors get called. Call is per GNU ABI (i.e. 32-bit
function pointers). But it is also compatible with the TI ABI
since GCC supports only little endian PRU.
WARNING: Keep this compatible with both ABIs! */
ldi r14, %pmem(_do_global_dtors)
call atexit
/* Call constructors. Use non-call-clobbered registers. */
ldi r5, __init_array_start
ldi r6, __init_array_end
ctors_loop:
qbeq ctors_done, r5, r6
/* ABI dictates 16-bit IMEM pointers. */
lbbo r7, r5, 0, 2
call r7.w0
add r5, r5, 2
jmp ctors_loop
ctors_done:
#endif
/* Just in case main() tries to access argc, argv[] and envp. */
zero r14, 3 * 4
#if !defined(MINRT)
.weak __c_args__
ldi32 r5, __c_args__
qbeq __skip_c_args, r5, 0
lbbo r14, r5, 0, 4 /* argc */
add r15, r5, 4 /* argv */
__skip_c_args:
#endif
/* Call main */
call main
#if !defined(MINRT)
/* Call exit */
call exit
#endif
/* We should never reach here. */
_crt_exit:
halt
jmp _crt_exit
/* PRU obviously has no shared libraries, but dso_handle
helps to achieve better GCC test coverage. Besides,
it should be free with minrt. */
.section .data
.global __dso_handle
.weak __dso_handle
__dso_handle:
.long 0

View File

@ -0,0 +1,5 @@
*cpp_device:
-D__SIM__
*link_device:
%{!r:-Tpruelf-sim.x}

View File

@ -0,0 +1,53 @@
/* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* do_global_dtors - invoke global destructors
*
* Copyright (c) 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdint.h>
#include <_ansi.h>
#include "syscall.h"
extern void *__fini_array_start;
extern void *__fini_array_end;
/*
* _do_global_dtors
*/
void
_do_global_dtors (void)
{
/* ABI dictates pointers in init/fini arrays are 16-bit. */
const uint16_t *end = (uint16_t *)&__fini_array_end;
const uint16_t *begin = (uint16_t *)&__fini_array_start;
const uint16_t *p;
void (**dtor) (void);
/* call destructors in reverse order */
for (p = end; p > begin; ) {
p--;
dtor = (void *)p;
(*dtor) ();
}
}

View File

@ -0,0 +1,31 @@
/* gettimeofday.c -- get the current time of day
*
* Copyright (c) 1995, 1999 Cygnus Support
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include <errno.h>
#include "glue.h"
#undef errno
extern int errno;
struct timeval;
/*
* gettimeofday -- no clock
* struct timeval * tp, void * tzvp
*/
int
_gettimeofday (struct timeval * tp, void * tzvp)
{
errno = ENOSYS;
return -1;
}

51
libgloss/pru/inbyte.c Normal file
View File

@ -0,0 +1,51 @@
/* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* inbyte.c -- inbyte function for remoteproc
*
* Copyright (c) 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <errno.h>
#include <_ansi.h>
#include <stdio.h>
#include <unistd.h>
#include "glue.h"
extern ssize_t _read(int fd, void *b, size_t count);
int
inbyte (void)
{
ssize_t n;
char c;
/* PRU has no interrupts, so it is inherently thread-safe. */
n = _read(STDIN_FILENO, &c, 1);
if (n < 0)
return n;
else if (n == 0)
return -ENODATA;
else
return 1;
}

26
libgloss/pru/isatty.c Normal file
View File

@ -0,0 +1,26 @@
/* isatty.c -- chek the terminal device.
*
* Copyright (c) 1995 Cygnus Support
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "glue.h"
/*
* isatty -- returns 1 if connected to a terminal device,
* returns 0 if not. Since we're hooked up to a
* serial port, we'll say yes _AND return a 1.
*/
int
_isatty (int fd)
{
return (1);
}

View File

@ -0,0 +1,80 @@
#!/bin/bash
# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
#
# Copyright 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Generate additional MCU-specific linker scripts by using the
# default PRU-LD linker script.
#
# We do it automatically so that:
# 1. We only change the default linker script in binutils.
# 2. All the default script complexity stays in binutils.
# 3. Here in libgloss we only bump the memory sizes to
# allow large test programs to be executed.
dump_modified()
{
IMEM_SIZE=$1
DMEM_SIZE=$2
HEAP_SIZE=$3
STACK_SIZE=$4
echo "/* WARNING: automatically generated from the default pru-ld script! */"
echo -e "\n\n"
pru-ld --verbose | awk "
BEGIN { LDV_MARKER = 0; }
{
if (\$0 == \"==================================================\" )
{
LDV_MARKER++;
}
else if (LDV_MARKER != 1)
{
}
else if (\$0 ~ /^ imem.*ORIGIN =.*LENGTH =/)
{
print \" imem (x) : ORIGIN = 0x20000000, LENGTH = $IMEM_SIZE\"
}
else if (\$0 ~ /^ dmem.*ORIGIN =.*LENGTH =/)
{
print \" dmem (rw!x) : ORIGIN = 0x0, LENGTH = $DMEM_SIZE\"
}
else if (\$0 ~ /^__HEAP_SIZE = DEFINED/)
{
print \"__HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : $HEAP_SIZE ;\";
}
else if (\$0 ~ /^__STACK_SIZE = DEFINED/)
{
print \"__STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : $STACK_SIZE ;\";
}
else
{
print \$0;
}
}"
}
# IMEM DMEM HEAP_SIZE STACK_SIZE
dump_modified 256K 65536K "32 * 1024 * 1024" "1024 * 1024" | tee pruelf-sim.x

View File

@ -0,0 +1,200 @@
/* WARNING: automatically generated from the default pru-ld script! */
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-pru","elf32-pru","elf32-pru")
OUTPUT_ARCH(pru)
MEMORY
{
imem (x) : ORIGIN = 0x20000000, LENGTH = 256K
dmem (rw!x) : ORIGIN = 0x0, LENGTH = 65536K
}
__HEAP_SIZE = DEFINED(__HEAP_SIZE) ? __HEAP_SIZE : 32 * 1024 * 1024 ;
__STACK_SIZE = DEFINED(__STACK_SIZE) ? __STACK_SIZE : 1024 * 1024 ;
PROVIDE (_stack_top = ORIGIN(dmem) + LENGTH(dmem));
ENTRY (_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
.dynstr : { *(.dynstr) }
.gnu.version : { *(.gnu.version) }
.gnu.version_d : { *(.gnu.version_d) }
.gnu.version_r : { *(.gnu.version_r) }
.rel.init : { *(.rel.init) }
.rela.init : { *(.rela.init) }
.rel.text :
{
*(.rel.text)
*(.rel.text.*)
*(.rel.text:*)
*(.rel.gnu.linkonce.t*)
}
.rela.text :
{
*(.rela.text)
*(.rela.text.*)
*(.rela.text:*)
*(.rela.gnu.linkonce.t*)
}
.rel.fini : { *(.rel.fini) }
.rela.fini : { *(.rela.fini) }
.rel.rodata :
{
*(.rel.rodata)
*(.rel.rodata.*)
*(.rel.rodata:*)
*(.rel.gnu.linkonce.r*)
}
.rela.rodata :
{
*(.rela.rodata)
*(.rela.rodata.*)
*(.rela.rodata:*)
*(.rela.gnu.linkonce.r*)
}
.rel.data :
{
*(.rel.data)
*(.rel.data.*)
*(.rel.data:*)
*(.rel.gnu.linkonce.d*)
}
.rela.data :
{
*(.rela.data)
*(.rela.data.*)
*(.rela.data:*)
*(.rela.gnu.linkonce.d*)
}
.rel.init_array : { *(.rel.init_array) }
.rela.init_array : { *(.rela.init_array) }
.rel.fini_array : { *(.rel.fini_array) }
.rela.fini_array : { *(.rela.fini_array) }
.rel.got : { *(.rel.got) }
.rela.got : { *(.rela.got) }
.rel.bss : { *(.rel.bss) }
.rela.bss : { *(.rela.bss) }
.rel.plt : { *(.rel.plt) }
.rela.plt : { *(.rela.plt) }
/* Internal text space. */
.text :
{
_text_start = . ;
. = ALIGN(4);
*(.init0) /* Start here after reset. */
KEEP (*(.init0))
. = ALIGN(4);
*(.text)
. = ALIGN(4);
*(.text.*)
. = ALIGN(4);
*(.text:*)
. = ALIGN(4);
*(.gnu.linkonce.t*)
. = ALIGN(4);
_text_end = . ;
} > imem
.data :
{
/* Optional variable that user is prepared to have NULL address. */
*(.data.atzero*)
/* CRT is prepared for constructor/destructor table to have
a "valid" NULL address. */
__init_array_start = . ;
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = . ;
__fini_array_start = . ;
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
KEEP (*(.fini_array))
__fini_array_end = . ;
/* DATA memory starts at address 0. So to avoid placing a valid static
variable at the invalid NULL address, we introduce the .data.atzero
section. If CRT can make some use of it - great. Otherwise skip a
word. In all cases .data/.bss sections must start at non-zero. */
. += (. == 0 ? 4 : 0);
PROVIDE (_data_start = .) ;
*(.data)
*(.data*)
*(.data:*)
*(.rodata) /* We need to include .rodata here if gcc is used. */
*(.rodata.*) /* with -fdata-sections. */
*(.rodata:*)
*(.gnu.linkonce.d*)
*(.gnu.linkonce.r*)
. = ALIGN(4);
PROVIDE (_data_end = .) ;
} > dmem
.resource_table :
{
KEEP (*(.resource_table))
} > dmem
.bss :
{
PROVIDE (_bss_start = .) ;
*(.bss)
*(.bss.*)
*(.bss:*)
*(.gnu.linkonce.b*)
*(COMMON)
PROVIDE (_bss_end = .) ;
} > dmem
/* Global data not cleared after reset. */
.noinit :
{
PROVIDE (_noinit_start = .) ;
*(.noinit)
PROVIDE (_noinit_end = .) ;
PROVIDE (_heap_start = .) ;
. += __HEAP_SIZE ;
/* Stack is not here really. It will be put at the end of DMEM.
But we take into account its size here, in order to allow
for MEMORY overflow checking during link time. */
. += __STACK_SIZE ;
} > dmem
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
/* DWARF 3 */
.debug_pubtypes 0 : { *(.debug_pubtypes) }
.debug_ranges 0 : { *(.debug_ranges) }
/* DWARF Extension. */
.debug_macro 0 : { *(.debug_macro) }
.debug_addr 0 : { *(.debug_addr) }
}

37
libgloss/pru/outbyte.c Normal file
View File

@ -0,0 +1,37 @@
/* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* outbyte.c -- outbyte function for simulator
*
* Copyright (c) 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <unistd.h>
#include <_ansi.h>
extern ssize_t _write(int fd, const void *b, size_t count);
void
outbyte (char ch)
{
_write(STDOUT_FILENO, &ch, 1);
}

25
libgloss/pru/print.c Normal file
View File

@ -0,0 +1,25 @@
/* print.c -- print a string on the output device.
*
* Copyright (c) 1995, 1999 Cygnus Support
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include <unistd.h>
#include "glue.h"
/*
* print -- do a raw print of a string
*/
void
_print (char *ptr)
{
_write(STDOUT_FILENO, ptr, strlen(ptr));
}

42
libgloss/pru/putnum.c Normal file
View File

@ -0,0 +1,42 @@
/* putnum.c -- put a hex number on the output device.
*
* Copyright (c) 1995, 1999 Cygnus Support
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "glue.h"
extern void print (char *ptr);
/*
* putnum -- print a 32 bit number in hex
*/
void
_putnum (unsigned int num)
{
char buf[9];
int cnt;
char *ptr;
int digit;
ptr = buf;
for (cnt = 7 ; cnt >= 0 ; cnt--) {
digit = (num >> (cnt * 4)) & 0xf;
if (digit <= 9)
*ptr++ = (char) ('0' + digit);
else
*ptr++ = (char) ('a' - 10 + digit);
}
*ptr = (char) 0;
print (buf);
}

24
libgloss/pru/raise.c Normal file
View File

@ -0,0 +1,24 @@
/* raise.c -- raise a signal for current process.
*
* Copyright (c) 1999 Cygnus Support
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include "glue.h"
extern int _kill (int, int);
extern int _getpid(void);
int
_raise (int sig)
{
return _kill (_getpid (), sig);
}

46
libgloss/pru/sbrk.c Normal file
View File

@ -0,0 +1,46 @@
/* sbrk.c -- allocate memory dynamically.
*
* Copyright (c) 1995,1996,1999 Cygnus Support
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include "glue.h"
extern char _heap_start[];
extern void exit (int) __attribute ((__noreturn__));
extern int _write (int, char *, int);
caddr_t
_sbrk (size_t incr)
{
static char *heap_end;
char *prev_heap_end;
char *sp = (char *)&sp;
if (heap_end == 0)
{
heap_end = _heap_start;
}
prev_heap_end = heap_end;
if (heap_end > sp)
{
_write (1, "Heap and stack collision\n", 25);
#if 0 /* Calling abort brings in the signal handling code. */
abort ();
#else
exit (1);
#endif
}
heap_end += incr;
return (caddr_t) prev_heap_end;
}

31
libgloss/pru/stat.c Normal file
View File

@ -0,0 +1,31 @@
/* stat.c -- Get the status of a file.
*
* Copyright (c) 1995, 1999 Cygnus Support
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*/
#include <sys/stat.h>
#include <errno.h>
#include "glue.h"
#undef errno
extern int errno;
/*
* stat -- Since we have no file system, we just return an error.
*/
int
_stat (const char *path, struct stat *buf)
{
errno = EIO;
return (-1);
}

79
libgloss/pru/syscalls.S Normal file
View File

@ -0,0 +1,79 @@
/* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* syscalls.S -- PRU system calls code
*
* Copyright (c) 2018-2019 Dimitar Dimitrov <dimitar@dinux.eu>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "newlib.h"
#include "syscall.h"
.extern _impure_ptr
/* Handle return from syscall. */
.global __SC_ret
.type __SC_ret,@function
.func
__SC_ret:
/* Check for negative return code */
qbbc __SC_ret_skip_errno_set, r14, 31
/* Invert return code and store to errno (first int in _impure_ptr). */
rsb r14, r14, 0
ldi32 r1, _impure_ptr
lbbo r1, r1, 0, 4
sbbo r14, r1, 0, 4
/* Return -1 (for both int32_t or int64_t). */
fill r14, 8
__SC_ret_skip_errno_set:
ret
.endfunc
.macro SC fname, id
.global \fname
.type \fname,@function
.func
\fname:
ldi r1, \id
halt
jmp __SC_ret
.endfunc
.endm
.text
/* Syscalls are used only by simulator. Real HW
users use other methods for communicating with
the host - remoteproc, rpmsg, shared memory. */
SC _exit, SYS_exit
SC _open, SYS_open
SC _close, SYS_close
SC _read, SYS_read
SC _write, SYS_write
SC _lseek, SYS_lseek
SC _unlink, SYS_unlink
SC _getpid, SYS_getpid
SC _kill, SYS_kill
SC _fstat, SYS_fstat

View File

@ -22,31 +22,50 @@ __syscall_error(long a0)
}
static inline long
__internal_syscall(long n, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
__internal_syscall(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
{
register long a0 asm("a0") = _a0;
register long a1 asm("a1") = _a1;
register long a2 asm("a2") = _a2;
register long a3 asm("a3") = _a3;
register long a4 asm("a4") = _a4;
register long a5 asm("a5") = _a5;
#ifdef __riscv_32e
register long syscall_id asm("t0") = n;
#else
register long syscall_id asm("a7") = n;
#endif
asm volatile ("scall"
: "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(syscall_id));
register long a0 asm("a0") = _a0;
if (argc < 2) {
asm volatile ("ecall" : "+r"(a0) : "r"(syscall_id));
return a0;
}
register long a1 asm("a1") = _a1;
if (argc == 2) {
asm volatile ("ecall" : "+r"(a0) : "r"(a1), "r"(syscall_id));
return a0;
}
register long a2 asm("a2") = _a2;
if (argc == 3) {
asm volatile ("ecall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(syscall_id));
return a0;
}
register long a3 asm("a3") = _a3;
if (argc == 4) {
asm volatile ("ecall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(syscall_id));
return a0;
}
register long a4 asm("a4") = _a4;
if (argc == 5) {
asm volatile ("ecall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(syscall_id));
return a0;
}
register long a5 asm("a5") = _a5;
asm volatile ("ecall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(syscall_id));
return a0;
}
static inline long
syscall_errno(long n, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
syscall_errno(long n, int argc, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5)
{
long a0 = __internal_syscall (n, _a0, _a1, _a2, _a3, _a4, _a5);
long a0 = __internal_syscall (n, argc, _a0, _a1, _a2, _a3, _a4, _a5);
if (a0 < 0)
return __syscall_error (a0);

View File

@ -15,7 +15,7 @@
%(nano_link_gcc_c_sequence) --start-group %G %(nano_libc) %(nano_libgloss) --end-group
*link:
%(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano)
%(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano) %:replace-outfile(-lm -lm_nano)
*lib:
%{!shared:%{g*:-lg_nano} %{!p:%{!pg:-lc_nano}}%{p:-lc_p}%{pg:-lc_p}}

View File

@ -5,5 +5,5 @@
int
_access(const char *file, int mode)
{
return syscall_errno (SYS_access, file, mode, 0, 0, 0, 0);
return syscall_errno (SYS_access, 2, file, mode, 0, 0, 0, 0);
}

View File

@ -5,5 +5,5 @@
int
_close(int file)
{
return syscall_errno (SYS_close, file, 0, 0, 0, 0, 0);
return syscall_errno (SYS_close, 1, file, 0, 0, 0, 0, 0);
}

View File

@ -5,6 +5,6 @@
void
_exit(int exit_status)
{
syscall_errno (SYS_exit, exit_status, 0, 0, 0, 0, 0);
syscall_errno (SYS_exit, 1, exit_status, 0, 0, 0, 0, 0);
while (1);
}

View File

@ -4,5 +4,5 @@
/* Permissions of a file (by name) in a given directory. */
int _faccessat(int dirfd, const char *file, int mode, int flags)
{
return syscall_errno (SYS_faccessat, dirfd, file, mode, flags, 0, 0);
return syscall_errno (SYS_faccessat, 4, dirfd, file, mode, flags, 0, 0);
}

View File

@ -9,7 +9,7 @@ int
_fstat(int file, struct stat *st)
{
struct kernel_stat kst;
int rv = syscall_errno (SYS_fstat, file, &kst, 0, 0, 0, 0);
int rv = syscall_errno (SYS_fstat, 2, file, &kst, 0, 0, 0, 0);
_conv_stat (st, &kst);
return rv;
}

View File

@ -8,7 +8,7 @@ int
_fstatat(int dirfd, const char *file, struct stat *st, int flags)
{
struct kernel_stat kst;
int rv = syscall_errno (SYS_fstatat, dirfd, file, &kst, flags, 0, 0);
int rv = syscall_errno (SYS_fstatat, 4, dirfd, file, &kst, flags, 0, 0);
_conv_stat (st, &kst);
return rv;
}

View File

@ -6,5 +6,5 @@
int
_gettimeofday(struct timeval *tp, void *tzp)
{
return syscall_errno (SYS_gettimeofday, tp, 0, 0, 0, 0, 0);
return syscall_errno (SYS_gettimeofday, 1, tp, 0, 0, 0, 0, 0);
}

View File

@ -4,5 +4,5 @@
/* Establish a new name for an existing file. */
int _link(const char *old_name, const char *new_name)
{
return syscall_errno (SYS_link, old_name, new_name, 0, 0, 0, 0);
return syscall_errno (SYS_link, 2, old_name, new_name, 0, 0, 0, 0);
}

View File

@ -6,5 +6,5 @@
off_t
_lseek(int file, off_t ptr, int dir)
{
return syscall_errno (SYS_lseek, file, ptr, dir, 0, 0, 0);
return syscall_errno (SYS_lseek, 3, file, ptr, dir, 0, 0, 0);
}

View File

@ -7,7 +7,7 @@
int _lstat(const char *file, struct stat *st)
{
struct kernel_stat kst;
int rv = syscall_errno (SYS_lstat, file, &kst, 0, 0, 0, 0);
int rv = syscall_errno (SYS_lstat, 2, file, &kst, 0, 0, 0, 0);
_conv_stat (st, &kst);
return rv;
}

View File

@ -5,5 +5,5 @@
int
_open(const char *name, int flags, int mode)
{
return syscall_errno (SYS_open, name, flags, mode, 0, 0, 0);
return syscall_errno (SYS_open, 3, name, flags, mode, 0, 0, 0);
}

View File

@ -4,5 +4,5 @@
/* Open file relative to given directory. */
int _openat(int dirfd, const char *name, int flags, int mode)
{
return syscall_errno (SYS_openat, dirfd, name, flags, mode, 0, 0);
return syscall_errno (SYS_openat, 4, dirfd, name, flags, mode, 0, 0);
}

View File

@ -5,5 +5,5 @@
/* Read from a file. */
ssize_t _read(int file, void *ptr, size_t len)
{
return syscall_errno (SYS_read, file, ptr, len, 0, 0, 0);
return syscall_errno (SYS_read, 3, file, ptr, len, 0, 0, 0);
}

View File

@ -41,13 +41,13 @@ _sbrk(ptrdiff_t incr)
if (heap_end == 0)
{
long brk = __internal_syscall (SYS_brk, 0, 0, 0, 0, 0, 0);
long brk = __internal_syscall (SYS_brk, 1, 0, 0, 0, 0, 0, 0);
if (brk == -1)
return (void *)__syscall_error (-ENOMEM);
heap_end = brk;
}
if (__internal_syscall (SYS_brk, heap_end + incr, 0, 0, 0, 0, 0) != heap_end + incr)
if (__internal_syscall (SYS_brk, 1, heap_end + incr, 0, 0, 0, 0, 0) != heap_end + incr)
return (void *)__syscall_error (-ENOMEM);
heap_end += incr;

View File

@ -8,7 +8,7 @@ int
_stat(const char *file, struct stat *st)
{
struct kernel_stat kst;
int rv = syscall_errno (SYS_stat, file, &kst, 0, 0, 0, 0);
int rv = syscall_errno (SYS_stat, 2, file, &kst, 0, 0, 0, 0);
_conv_stat (st, &kst);
return rv;
}

View File

@ -5,5 +5,5 @@
int
_unlink(const char *name)
{
return syscall_errno (SYS_unlink, name, 0, 0, 0, 0, 0);
return syscall_errno (SYS_unlink, 1, name, 0, 0, 0, 0, 0);
}

View File

@ -6,5 +6,5 @@
ssize_t
_write(int file, const void *ptr, size_t len)
{
return syscall_errno (SYS_write, file, ptr, len, 0, 0, 0);
return syscall_errno (SYS_write, 3, file, ptr, len, 0, 0, 0);
}

View File

@ -5,7 +5,7 @@
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# and/or other materials related to such
# distribution and use acknowledge that the software was developed
# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to
# endorse or promote products derived from this software without

View File

@ -5,7 +5,7 @@
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# and/or other materials related to such
# distribution and use acknowledge that the software was developed
# at Cygnus Support, Inc. Cygnus Support, Inc. may not be used to
# endorse or promote products derived from this software without

View File

@ -26,11 +26,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -26,11 +26,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

2
mkdep
View File

@ -6,7 +6,7 @@
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# and/or other materials related to such
# distribution and use acknowledge that the software was developed
# by the University of California, Berkeley. The name of the
# University may not be used to endorse or promote products derived

View File

@ -49,7 +49,8 @@ For an example of this kind of usage, see libm/common/s_logb.c.
If writing a new function that requires documentation, the required
sections are FUNCTION, INDEX, SYNOPSIS, DESCRIPTION, RETURNS,
and PORTABILITY. BUGS and SEEALSO should be added as appropriate.
and PORTABILITY. BUGS, NOTES, SEEALSO and WARNINGS should be added as
appropriate.
Source files which contain documentation are processed into ".def"
files with the extracted information. These .def files are noted in the
@ -64,7 +65,8 @@ In summary, to add new documentation:
1. Add properly-formatted comments to source file (e.g. src.c);
2. add "chewout" file to CHEWOUT_FILES list in Makefile.am (e.g. src.def),
re-generate Makefile.in;
3. add file to something.tex;
3. @include that .def file in the appropriate .tex file, add texinfo menu
entries that reference the @node(s) in that .def file;
4. make ChangeLog entry and generate patch.
EL/IX (ELIX_LEVEL_n, ELIX_n_SOURCES)

View File

@ -1,3 +1,20 @@
*** Major changes in newlib version 3.2.0:
- memmem performance improvement
- nanf() and HUGE_VALF now used in libm float routines to reduce size
- new reduced "tiny" code size printf and puts support
- errno setting enhanced in libm routines
- new --enable-newlib-reent-check-verify configure option to verify reent memory
- <fenv.h> support added
- <sys/time.h> and <sys/_timespec.h> synced with FreeBSD
- timeval macros moved to <sys/time.h>
- newlib wide char conversion functions updated to Unicode 11.0
- new msp430-elfbare target support
- AMD GCN port
- PRU port
- nbdm port
- various standard improvements
*** Major changes in newlib version 3.1.0:
- global stdio streams support added for reent small

View File

@ -1,11 +1,11 @@
README for newlib-3.0.0 release
README for newlib-3.2.0 release
(mostly cribbed from the README in the gdb-4.13 release)
This is `newlib', a simple ANSI C library, math library, and collection
of board support packages.
Prior to the 3.0.0 release, newlib supported both ANSI and K&R-style
compilers. As of 3.0.0, K&R is no longer supported.
Prior to the 3.2.0 release, newlib supported both ANSI and K&R-style
compilers. As of 3.2.0, K&R is no longer supported.
The newlib and libgloss subdirectories are a collection of software from
several sources, each with their own copyright and license. See the file
@ -20,8 +20,8 @@ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Unpacking and Installation -- quick overview
==========================
When you unpack the newlib-3.0.0.tar.gz file, you'll find a directory
called `newlib-3.0.0', which contains:
When you unpack the newlib-3.2.0.tar.gz file, you'll find a directory
called `newlib-3.2.0', which contains:
COPYING config/ install-sh* mpw-configure
COPYING.LIB config-ml.in libgloss/ mpw-install
@ -97,13 +97,13 @@ directory. If the path to `configure' would be the same as the
argument to `--srcdir', you can leave out the `--srcdir' option; it
will be assumed.)
For example, with version 3.0.0, you can build NEWLIB in a separate
For example, with version 3.2.0, you can build NEWLIB in a separate
directory for a Sun 4 cross m68k-aout environment like this:
cd newlib-3.0.0
cd newlib-3.2.0
mkdir ../newlib-m68k-aout
cd ../newlib-m68k-aout
../newlib-3.0.0/configure --host=sun4 --target=m68k-aout
../newlib-3.2.0/configure --host=sun4 --target=m68k-aout
make
When `configure' builds a configuration using a remote source
@ -119,8 +119,8 @@ called `configure' (or one of its subdirectories).
The `Makefile' that `configure' generates in each source directory
also runs recursively. If you type `make' in a source directory such
as `newlib-3.0.0' (or in a separate configured directory configured with
`--srcdir=PATH/newlib-3.0.0'), you will build all the required libraries.
as `newlib-3.2.0' (or in a separate configured directory configured with
`--srcdir=PATH/newlib-3.2.0'), you will build all the required libraries.
When you have multiple hosts or targets configured in separate
directories, you can run `make' on them in parallel (for example, if
@ -604,7 +604,7 @@ Reporting Bugs
The correct address for reporting bugs found in NEWLIB is
"newlib@sourceware.org". Please email all bug reports to that
address. Please include the NEWLIB version number (e.g., newlib-3.0.0),
address. Please include the NEWLIB version number (e.g., newlib-3.2.0),
and how you configured it (e.g., "sun4 host and m68k-aout target").
Since NEWLIB supports many different configurations, it is important
that you be precise about this.

View File

@ -26,6 +26,9 @@
very restricted storage. */
#undef _WANT_REENT_SMALL
/* Verify _REENT_CHECK macros allocate memory successfully. */
#undef _REENT_CHECK_VERIFY
/* Multibyte supported */
#undef _MB_CAPABLE

View File

@ -2,7 +2,7 @@ dnl This provides configure definitions used by all the newlib
dnl configure.in files.
AC_DEFUN([DEF_NEWLIB_MAJOR_VERSION],m4_define([NEWLIB_MAJOR_VERSION],[3]))
AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[1]))
AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[3]))
AC_DEFUN([DEF_NEWLIB_PATCHLEVEL_VERSION],m4_define([NEWLIB_PATCHLEVEL_VERSION],[0]))
AC_DEFUN([DEF_NEWLIB_VERSION],m4_define([NEWLIB_VERSION],[NEWLIB_MAJOR_VERSION.NEWLIB_MINOR_VERSION.NEWLIB_PATCHLEVEL_VERSION]))

48
newlib/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for newlib 3.1.0.
# Generated by GNU Autoconf 2.68 for newlib 3.3.0.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -567,8 +567,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
PACKAGE_VERSION='3.1.0'
PACKAGE_STRING='newlib 3.1.0'
PACKAGE_VERSION='3.3.0'
PACKAGE_STRING='newlib 3.3.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -788,6 +788,7 @@ enable_newlib_register_fini
enable_newlib_io_long_long
enable_newlib_io_long_double
enable_newlib_mb
enable_newlib_reent_check_verify
enable_newlib_iconv_encodings
enable_newlib_iconv_from_encodings
enable_newlib_iconv_to_encodings
@ -1379,7 +1380,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures newlib 3.1.0 to adapt to many kinds of systems.
\`configure' configures newlib 3.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1449,7 +1450,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of newlib 3.1.0:";;
short | recursive ) echo "Configuration of newlib 3.3.0:";;
esac
cat <<\_ACEOF
@ -1463,6 +1464,7 @@ Optional Features:
--enable-newlib-io-long-long enable long long type support in IO functions like printf/scanf
--enable-newlib-io-long-double enable long double type support in IO functions printf/scanf
--enable-newlib-mb enable multibyte support
--disable-newlib-reent-check-verify disable checking of _REENT_CHECK memory allocation
--enable-newlib-iconv-encodings enable specific comma-separated list of bidirectional iconv encodings to be built-in
--enable-newlib-iconv-from-encodings enable specific comma-separated list of \"from\" iconv encodings to be built-in
--enable-newlib-iconv-to-encodings enable specific comma-separated list of \"to\" iconv encodings to be built-in
@ -1584,7 +1586,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
newlib configure 3.1.0
newlib configure 3.3.0
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@ -1862,7 +1864,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by newlib $as_me 3.1.0, which was
It was created by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@ -2310,6 +2312,17 @@ else
newlib_mb=
fi
# Check whether --enable-newlib-reent-check-verify was given.
if test "${enable_newlib_reent_check_verify+set}" = set; then :
enableval=$enable_newlib_reent_check_verify; case "${enableval}" in
yes) newlib_reent_check_verify=yes;;
no) newlib_reent_check_verify=no ;;
*) as_fn_error $? "bad value ${enableval} for newlib-reent-check-verify option" "$LINENO" 5 ;;
esac
else
newlib_reent_check_verify=
fi
# Check whether --enable-newlib-iconv-encodings was given.
if test "${enable_newlib_iconv_encodings+set}" = set; then :
enableval=$enable_newlib_iconv_encodings; if test x${enableval} = x; then
@ -3222,7 +3235,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
VERSION='3.1.0'
VERSION='3.3.0'
# Some tools Automake needs.
@ -11840,7 +11853,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11843 "configure"
#line 11856 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -11946,7 +11959,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11949 "configure"
#line 11962 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -12351,6 +12364,13 @@ _ACEOF
fi
if test "${newlib_reent_check_verify}" = "yes"; then
cat >>confdefs.h <<_ACEOF
#define _REENT_CHECK_VERIFY 1
_ACEOF
fi
if test "${newlib_io_c99_formats}" = "yes"; then
cat >>confdefs.h <<_ACEOF
#define _WANT_IO_C99_FORMATS 1
@ -12424,13 +12444,13 @@ _ACEOF
fi
$as_echo "#define _NEWLIB_VERSION \"3.1.0\"" >>confdefs.h
$as_echo "#define _NEWLIB_VERSION \"3.3.0\"" >>confdefs.h
$as_echo "#define __NEWLIB__ 3" >>confdefs.h
$as_echo "#define __NEWLIB_MINOR__ 1" >>confdefs.h
$as_echo "#define __NEWLIB_MINOR__ 3" >>confdefs.h
$as_echo "#define __NEWLIB_PATCHLEVEL__ 0" >>confdefs.h
@ -13363,7 +13383,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by newlib $as_me 3.1.0, which was
This file was extended by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -13429,7 +13449,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
newlib config.status 3.1.0
newlib config.status 3.3.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

View File

@ -29,6 +29,7 @@
# 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
@ -76,6 +77,7 @@ 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-"
@ -85,7 +87,7 @@ case "${target_optspace}:${host}" in
yes:*)
newlib_cflags="${newlib_cflags} -Os"
;;
:m32r-* | :d10v-* | :d30v-* | :avr-* | :m32c-* | :msp430*-* | :nds32* | :rl78-* )
:m32r-* | :d10v-* | :d30v-* | :avr-* | :m32c-* | :msp430*-* | :nds32* | :pru-* | :rl78-* )
newlib_cflags="${newlib_cflags} -Os"
;;
no:* | :*)
@ -245,6 +247,7 @@ case "${host_cpu}" in
;;
mips*)
machine_dir=mips
libm_machine_dir=mips
;;
mmix)
;;
@ -288,6 +291,16 @@ case "${host_cpu}" in
;;
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"
default_newlib_nano_malloc="yes"
default_newlib_atexit_dynamic_alloc="no"
machine_dir=pru
libm_machine_dir=pru
;;
riscv*)
libm_machine_dir=riscv
@ -310,6 +323,7 @@ case "${host_cpu}" in
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"
@ -339,6 +353,7 @@ case "${host_cpu}" in
;;
x86_64)
machine_dir=x86_64
libm_machine_dir=x86_64
;;
xc16x*)
machine_dir=xc16x
@ -871,6 +886,10 @@ newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVID
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
;;
@ -969,6 +988,13 @@ if [ "x${newlib_nano_malloc}" = "x" ]; then
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"

View File

@ -66,6 +66,16 @@ AC_ARG_ENABLE(newlib-mb,
*) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
esac], [newlib_mb=])dnl
dnl Enable verification of successful memory allocation for _REENT_CHECK family of macros
dnl Support --disable-newlib-reent-check-verify
AC_ARG_ENABLE(newlib-reent-check-verify,
[ --disable-newlib-reent-check-verify disable checking of _REENT_CHECK memory allocation],
[case "${enableval}" in
yes) newlib_reent_check_verify=yes;;
no) newlib_reent_check_verify=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for newlib-reent-check-verify option) ;;
esac], [newlib_reent_check_verify=])dnl
dnl Support --enable-newlib-iconv-encodings
AC_ARG_ENABLE(newlib-iconv-encodings,
[ --enable-newlib-iconv-encodings enable specific comma-separated list of bidirectional iconv encodings to be built-in],
@ -396,6 +406,10 @@ if test "${newlib_elix_level}" -gt "0"; then
AC_DEFINE_UNQUOTED(_ELIX_LEVEL,${newlib_elix_level})
fi
if test "${newlib_reent_check_verify}" = "yes"; then
AC_DEFINE_UNQUOTED(_REENT_CHECK_VERIFY)
fi
if test "${newlib_io_c99_formats}" = "yes"; then
AC_DEFINE_UNQUOTED(_WANT_IO_C99_FORMATS)
fi

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# python script to convert the handwritten chapter .texi files, which include
# the generated files for each function, to DocBook XML
@ -19,25 +19,25 @@ def main():
print ('<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">')
for l in sys.stdin.readlines():
l = l.rstrip()
l = l.rstrip()
# transform @file{foo} to <filename>foo</filename>
l = re.sub("@file{(.*?)}", "<filename>\\1</filename>", l)
# transform @file{foo} to <filename>foo</filename>
l = re.sub("@file{(.*?)}", "<filename>\\1</filename>", l)
if l.startswith("@node"):
l = l.replace("@node", "", 1)
l = l.strip()
l = l.lower()
if first_node:
print ('<chapter id="%s" xmlns:xi="http://www.w3.org/2001/XInclude">' % l.replace(' ', '_'))
first_node = False
elif l.startswith("@chapter "):
l = l.replace("@chapter ", "", 1)
print ('<title>%s</title>' % l)
elif l.startswith("@include "):
l = l.replace("@include ", "", 1)
l = l.replace(".def", ".xml", 1)
print ('<xi:include href="%s"/>' % l.strip())
if l.startswith("@node"):
l = l.replace("@node", "", 1)
l = l.strip()
l = l.lower()
if first_node:
print ('<chapter id="%s" xmlns:xi="http://www.w3.org/2001/XInclude">' % l.replace(' ', '_'))
first_node = False
elif l.startswith("@chapter "):
l = l.replace("@chapter ", "", 1)
print ('<title>%s</title>' % l)
elif l.startswith("@include "):
l = l.replace("@include ", "", 1)
l = l.replace(".def", ".xml", 1)
print ('<xi:include href="%s"/>' % l.strip())
print ('</chapter>')

20
newlib/doc/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for newlib 3.1.0.
# Generated by GNU Autoconf 2.68 for newlib 3.3.0.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -556,8 +556,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
PACKAGE_VERSION='3.1.0'
PACKAGE_STRING='newlib 3.1.0'
PACKAGE_VERSION='3.3.0'
PACKAGE_STRING='newlib 3.3.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1242,7 +1242,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures newlib 3.1.0 to adapt to many kinds of systems.
\`configure' configures newlib 3.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1312,7 +1312,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of newlib 3.1.0:";;
short | recursive ) echo "Configuration of newlib 3.3.0:";;
esac
cat <<\_ACEOF
@ -1404,7 +1404,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
newlib configure 3.1.0
newlib configure 3.3.0
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@ -1459,7 +1459,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by newlib $as_me 3.1.0, which was
It was created by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@ -2543,7 +2543,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
VERSION='3.1.0'
VERSION='3.3.0'
# Some tools Automake needs.
@ -4063,7 +4063,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by newlib $as_me 3.1.0, which was
This file was extended by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -4120,7 +4120,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
newlib config.status 3.1.0
newlib config.status 3.3.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# python script to process makedoc instructions in a source file and produce
# DocBook XML output
@ -35,11 +35,11 @@ verbose = 0
def dump(s, stage, threshold = 1):
if verbose > threshold:
print('*' * 40, file=sys.stderr)
print(stage, file=sys.stderr)
print('*' * 40, file=sys.stderr)
print('%s' % s, file=sys.stderr)
print('*' * 40, file=sys.stderr)
print('*' * 40, file=sys.stderr)
print(stage, file=sys.stderr)
print('*' * 40, file=sys.stderr)
print('%s' % s, file=sys.stderr)
print('*' * 40, file=sys.stderr)
#
# Stage 1
@ -48,7 +48,7 @@ def dump(s, stage, threshold = 1):
def skip_whitespace_and_stars(i, src):
while i < len(src) and (src[i].isspace() or (src[i] == '*' and src[i+1] != '/')):
i += 1
i += 1
return i
@ -60,37 +60,37 @@ def comment_contents_generator(src):
i = 0
while i < len(src) - 2:
if src[i] == '\n' and src[i+1] == '/' and src[i+2] == '*':
i = i + 3
if src[i] == '\n' and src[i+1] == '/' and src[i+2] == '*':
i = i + 3
i = skip_whitespace_and_stars(i, src)
i = skip_whitespace_and_stars(i, src)
if src[i] == '.':
i += 1
if src[i] == '.':
i += 1
while i < len(src):
if src[i] == '\n':
yield '\n'
i += 1
while i < len(src):
if src[i] == '\n':
yield '\n'
i += 1
# allow a single blank line
if i < len(src) and src[i] == '\n':
yield '\n'
i += 1
# allow a single blank line
if i < len(src) and src[i] == '\n':
yield '\n'
i += 1
i = skip_whitespace_and_stars(i, src)
i = skip_whitespace_and_stars(i, src)
elif src[i] == '*' and src[i+1] == '/':
i = i + 2
# If we have just output \n\n, this adds another blank line.
# This is the only way a double blank line can occur.
yield '\nEND\n'
break
else:
yield src[i]
i += 1
else:
i += 1
elif src[i] == '*' and src[i+1] == '/':
i = i + 2
# If we have just output \n\n, this adds another blank line.
# This is the only way a double blank line can occur.
yield '\nEND\n'
break
else:
yield src[i]
i += 1
else:
i += 1
def remove_noncomments(src):
src = '\n' + src
@ -107,7 +107,7 @@ def remove_noncomments(src):
def iscommand(l):
if re.match('^[A-Z_]{3,}\s*$', l):
return True
return True
return False
def command_block_generator(content):
@ -115,12 +115,12 @@ def command_block_generator(content):
text = ''
for l in content.splitlines():
if iscommand(l):
yield (command, text)
command = l.rstrip()
text = ''
else:
text = text + l + '\n'
if iscommand(l):
yield (command, text)
command = l.rstrip()
text = ''
else:
text = text + l + '\n'
yield (command, text)
# Look for commands, which give instructions how to process the following input
@ -142,17 +142,17 @@ def process(content):
# invoke each command on it's text
def perform(processed):
for i in processed:
c = i[0].rstrip()
t = i[1].strip() + '\n'
c = i[0].rstrip()
t = i[1].strip() + '\n'
if verbose:
print("performing command '%s'" % c, file=sys.stderr)
if verbose:
print("performing command '%s'" % c, file=sys.stderr)
if c in command_dispatch_dict:
command_dispatch_dict[c](c, t)
else:
print("command '%s' is not recognized" % c, file=sys.stderr)
# the text following an unrecognized command is discarded
if c in command_dispatch_dict:
command_dispatch_dict[c](c, t)
else:
print("command '%s' is not recognized" % c, file=sys.stderr)
# the text following an unrecognized command is discarded
# FUNCTION (aka TYPEDEF)
#
@ -162,33 +162,33 @@ def function(c, l):
l = l.strip()
if verbose:
print('FUNCTION %s' % l, file=sys.stderr)
print('FUNCTION %s' % l, file=sys.stderr)
separator = '---'
if ';' in l:
# fpclassify has an unusual format we also need to handle
spliton = ';'
l = l.splitlines()[0]
# fpclassify has an unusual format we also need to handle
spliton = ';'
l = l.splitlines()[0]
elif len(l.splitlines()) > 1:
# a few pages like mktemp have two '---' lines
spliton = ';'
o = ''
for i in l.splitlines():
if separator in i:
o += i + ';'
else:
o += i
l = o[:-1]
# a few pages like mktemp have two '---' lines
spliton = ';'
o = ''
for i in l.splitlines():
if separator in i:
o += i + ';'
else:
o += i
l = o[:-1]
else:
spliton = '\n'
spliton = '\n'
namelist = []
descrlist = []
for a in l.split(spliton):
(n, d) = a.split(separator, 1)
namelist = namelist + n.split(',')
descrlist = descrlist + [d]
(n, d) = a.split(separator, 1)
namelist = namelist + n.split(',')
descrlist = descrlist + [d]
# only copysign and log1p use <[ ]> markup in descr,
# only gets() uses << >> markup
@ -199,19 +199,21 @@ def function(c, l):
namelist = map(lambda v: re.sub('^and ', '', v.strip(), 1), namelist)
# strip off << >> surrounding name
namelist = map(lambda v: v.strip().lstrip('<').rstrip('>'), namelist)
# instantiate list to make it subscriptable
namelist = list(namelist)
if verbose:
print(namelist, file=sys.stderr)
print(namelist, file=sys.stderr)
# additional alternate names may also appear in INDEX commands
# create the root element if needed
if rootelement is None:
rootelement = lxml.etree.Element('refentrycontainer')
rootelement = lxml.etree.Element('refentrycontainer')
# FUNCTION implies starting a new refentry
if refentry is not None:
print("multiple FUNCTIONs without NEWPAGE", file=sys.stderr)
exit(1)
print("multiple FUNCTIONs without NEWPAGE", file=sys.stderr)
exit(1)
# create the refentry
refentry = lxml.etree.SubElement(rootelement, 'refentry')
@ -232,8 +234,8 @@ def function(c, l):
refdescriptor.text = namelist[0]
# refname elements exist for all alternate names
for n in namelist:
refname = lxml.etree.SubElement(refnamediv, 'refname')
refname.text = n
refname = lxml.etree.SubElement(refnamediv, 'refname')
refname.text = n
refpurpose = lxml.etree.SubElement(refnamediv, 'refpurpose')
refnamediv.replace(refpurpose, lxml.etree.fromstring('<refpurpose>' + descr + '</refpurpose>'))
@ -249,7 +251,7 @@ def index(c, l):
l = l.strip()
if verbose:
print('INDEX %s' % l, file=sys.stderr)
print('INDEX %s' % l, file=sys.stderr)
# discard anything after the first word
l = l.split()[0]
@ -262,20 +264,20 @@ def index(c, l):
primary.text = l
# to validate, it seems we need to maintain refentry elements in a certain order
refentry[:] = sorted(refentry, key = lambda x: x.tag)
refentry[:] = sorted(refentry, key = lambda x: x.tag if isinstance(x.tag, str) else '')
# adds another alternate refname
refnamediv = refentry.find('refnamediv')
# as long as it doesn't already exist
if not refnamediv.xpath(('refname[.="%s"]') % l):
refname = lxml.etree.SubElement(refnamediv, 'refname')
refname.text = l
if verbose > 1:
print('added refname %s' % l, file=sys.stderr)
refname = lxml.etree.SubElement(refnamediv, 'refname')
refname.text = l
if verbose > 1:
print('added refname %s' % l, file=sys.stderr)
else:
if verbose > 1:
print('duplicate refname %s discarded' % l, file=sys.stderr)
if verbose > 1:
print('duplicate refname %s discarded' % l, file=sys.stderr)
# to validate, it seems we need to maintain refnamediv elements in a certain order
refnamediv[:] = sorted(refnamediv, key = lambda x: x.tag)
@ -293,28 +295,28 @@ def synopsis(c, t):
s = ''
for l in t.splitlines():
if re.match('\s*(#|\[|struct)', l):
# preprocessor # directives, structs, comments in square brackets
funcsynopsisinfo = lxml.etree.SubElement(funcsynopsis, 'funcsynopsisinfo')
funcsynopsisinfo.text = l.strip() + '\n'
elif re.match('[Ll]ink with', l):
pass
else:
s = s + l
if re.match('\s*(#|\[|struct)', l):
# preprocessor # directives, structs, comments in square brackets
funcsynopsisinfo = lxml.etree.SubElement(funcsynopsis, 'funcsynopsisinfo')
funcsynopsisinfo.text = l.strip() + '\n'
elif re.match('[Ll]ink with', l):
pass
else:
s = s + l
# a prototype without a terminating ';' is an error
if s.endswith(')'):
print("'%s' missing terminating semicolon" % l, file=sys.stderr)
s = s + ';'
exit(1)
# a prototype without a terminating ';' is an error
if s.endswith(')'):
print("'%s' missing terminating semicolon" % l, file=sys.stderr)
s = s + ';'
exit(1)
if ';' in s:
synopsis_for_prototype(funcsynopsis, s)
s = ''
if ';' in s:
synopsis_for_prototype(funcsynopsis, s)
s = ''
if s.strip():
print("surplus synopsis '%s'" % s, file=sys.stderr)
exit(1)
print("surplus synopsis '%s'" % s, file=sys.stderr)
exit(1)
def synopsis_for_prototype(funcsynopsis, s):
s = s.strip()
@ -323,48 +325,48 @@ def synopsis_for_prototype(funcsynopsis, s):
# bare prototype into it. Fortunately, since the parameter names are marked
# up, we have enough information to do this.
for fp in s.split(';'):
fp = fp.strip()
if fp:
fp = fp.strip()
if fp:
if verbose:
print("'%s'" % fp, file=sys.stderr)
if verbose:
print("'%s'" % fp, file=sys.stderr)
match = re.match(r'(.*?)([\w\d]*) ?\((.*)\)', fp)
match = re.match(r'(.*?)([\w\d]*) ?\((.*)\)', fp)
if verbose:
print(match.groups(), file=sys.stderr)
if verbose:
print(match.groups(), file=sys.stderr)
funcprototype = lxml.etree.SubElement(funcsynopsis, 'funcprototype')
funcdef = lxml.etree.SubElement(funcprototype, 'funcdef')
funcdef.text = match.group(1)
function = lxml.etree.SubElement(funcdef, 'function')
function.text = match.group(2)
funcprototype = lxml.etree.SubElement(funcsynopsis, 'funcprototype')
funcdef = lxml.etree.SubElement(funcprototype, 'funcdef')
funcdef.text = match.group(1)
function = lxml.etree.SubElement(funcdef, 'function')
function.text = match.group(2)
if match.group(3).strip() == 'void':
void = lxml.etree.SubElement(funcprototype, 'void')
else:
# Split parameters on ',' except if it is inside ()
for p in re.split(',(?![^()]*\))', match.group(3)):
p = p.strip()
if match.group(3).strip() == 'void':
void = lxml.etree.SubElement(funcprototype, 'void')
else:
# Split parameters on ',' except if it is inside ()
for p in re.split(',(?![^()]*\))', match.group(3)):
p = p.strip()
if verbose:
print(p, file=sys.stderr)
if verbose:
print(p, file=sys.stderr)
if p == '...':
varargs = lxml.etree.SubElement(funcprototype, 'varargs')
else:
paramdef = lxml.etree.SubElement(funcprototype, 'paramdef')
parameter = lxml.etree.SubElement(paramdef, 'parameter')
if p == '...':
varargs = lxml.etree.SubElement(funcprototype, 'varargs')
else:
paramdef = lxml.etree.SubElement(funcprototype, 'paramdef')
parameter = lxml.etree.SubElement(paramdef, 'parameter')
# <[ ]> enclose the parameter name
match2 = re.match('(.*)<\[(.*)\]>(.*)', p)
# <[ ]> enclose the parameter name
match2 = re.match('(.*)<\[(.*)\]>(.*)', p)
if verbose:
print(match2.groups(), file=sys.stderr)
if verbose:
print(match2.groups(), file=sys.stderr)
paramdef.text = match2.group(1)
parameter.text = match2.group(2)
parameter.tail = match2.group(3)
paramdef.text = match2.group(1)
parameter.text = match2.group(2)
parameter.tail = match2.group(3)
# DESCRIPTION
@ -384,15 +386,15 @@ def refsect(t, s):
title.text = t.title()
if verbose:
print('%s has %d paragraphs' % (t, len(s.split('\n\n'))) , file=sys.stderr)
print('%s has %d paragraphs' % (t, len(s.split('\n\n'))) , file=sys.stderr)
if verbose > 1:
dump(s, 'before lexing')
dump(s, 'before lexing')
# dump out lexer token sequence
lex.input(s)
for tok in lexer:
print(tok, file=sys.stderr)
# dump out lexer token sequence
lex.input(s)
for tok in lexer:
print(tok, file=sys.stderr)
# parse the section text for makedoc markup and the few pieces of texinfo
# markup we understand, and output an XML marked-up string
@ -421,25 +423,25 @@ def discarded(c, t):
return
command_dispatch_dict = {
'FUNCTION' : function,
'TYPEDEF' : function, # TYPEDEF is not currently used, but described in doc.str
'INDEX' : index,
'TRAD_SYNOPSIS' : discarded, # K&R-style synopsis, obsolete and discarded
'ANSI_SYNOPSIS' : synopsis,
'SYNOPSIS' : synopsis,
'DESCRIPTION' : refsect,
'RETURNS' : refsect,
'ERRORS' : refsect,
'PORTABILITY' : refsect,
'BUGS' : refsect,
'WARNINGS' : refsect,
'SEEALSO' : seealso,
'NOTES' : refsect, # NOTES is not described in doc.str, so is currently discarded by makedoc, but that doesn't seem right
'QUICKREF' : discarded, # The intent of QUICKREF and MATHREF is not obvious, but they don't generate any output currently
'MATHREF' : discarded,
'START' : discarded, # a START command is inserted to contain the text before the first command
'END' : discarded, # an END command is inserted merely to terminate the text for the last command in a comment block
'NEWPAGE' : newpage,
'FUNCTION' : function,
'TYPEDEF' : function, # TYPEDEF is not currently used, but described in doc.str
'INDEX' : index,
'TRAD_SYNOPSIS' : discarded, # K&R-style synopsis, obsolete and discarded
'ANSI_SYNOPSIS' : synopsis,
'SYNOPSIS' : synopsis,
'DESCRIPTION' : refsect,
'RETURNS' : refsect,
'ERRORS' : refsect,
'PORTABILITY' : refsect,
'BUGS' : refsect,
'WARNINGS' : refsect,
'SEEALSO' : seealso,
'NOTES' : refsect, # NOTES is not described in doc.str, so is currently discarded by makedoc, but that doesn't seem right
'QUICKREF' : discarded, # The intent of QUICKREF and MATHREF is not obvious, but they don't generate any output currently
'MATHREF' : discarded,
'START' : discarded, # a START command is inserted to contain the text before the first command
'END' : discarded, # an END command is inserted merely to terminate the text for the last command in a comment block
'NEWPAGE' : newpage,
}
#
@ -483,7 +485,7 @@ def line_markup_convert(p):
s = s.replace('@*', '</para><para>')
if (verbose > 3) and (s != p):
print('%s-> line_markup_convert ->\n%s' % (p, s), file=sys.stderr)
print('%s-> line_markup_convert ->\n%s' % (p, s), file=sys.stderr)
return s
@ -529,9 +531,9 @@ def t_TEXINFO(t):
# if the line starts with a known texinfo command, change t.type to the
# token for that command
for k in texinfo_commands.keys():
if t.value[1:].startswith(k):
t.type = texinfo_commands[k]
break
if t.value[1:].startswith(k):
t.type = texinfo_commands[k]
break
return t
@ -575,10 +577,10 @@ def t_BLANKLINE(t):
def t_eof(t):
if hasattr(t.lexer,'at_eof'):
# remove eof flag ready for lexing next input
delattr(t.lexer,'at_eof')
t.lexer.lineno = 0
return None
# remove eof flag ready for lexing next input
delattr(t.lexer,'at_eof')
t.lexer.lineno = 0
return None
t.type = 'EOF'
t.lexer.at_eof = True;
@ -598,15 +600,15 @@ lexer = lex.lex()
def parser_verbose(p):
if verbose > 2:
print(p[0], file=sys.stderr)
print(p[0], file=sys.stderr)
def p_input(p):
'''input : paragraph
| input paragraph'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
p[0] = p[1]
parser_verbose(p)
# Strictly, text at top level should be paragraphs (i.e terminated by a
@ -621,9 +623,9 @@ def p_paragraph_content(p):
'''paragraph_content : paragraph_line
| paragraph_line paragraph_content'''
if len(p) == 3:
p[0] = p[1] + p[2]
p[0] = p[1] + p[2]
else:
p[0] = p[1]
p[0] = p[1]
parser_verbose(p)
def p_paragraph_line(p):
@ -649,9 +651,9 @@ def p_maybe_lines(p):
'''maybe_lines : empty
| paragraph maybe_lines'''
if len(p) == 3:
p[0] = p[1] + p[2]
p[0] = p[1] + p[2]
else:
p[0] = p[1]
p[0] = p[1]
parser_verbose(p)
def p_maybe_blankline(p):
@ -668,32 +670,32 @@ def p_courier(p):
'''courier : COURIER
| COURIER courier'''
if len(p) == 3:
p[0] = p[1] + p[2]
p[0] = p[1] + p[2]
else:
p[0] = p[1]
p[0] = p[1]
parser_verbose(p)
def p_bullet(p):
'''bullet : ITEM maybe_lines
| ITEM BLANKLINE maybe_lines'''
if len(p) == 3:
# Glue any text in ITEM into the first para of maybe_lines
# (This is an unfortunate consequence of the line-based tokenization we do)
if p[2].startswith('<para>'):
p[0] = '<listitem><para>' + p[1] + p[2][len('<para>'):] + '</listitem>'
else:
p[0] = '<listitem><para>' + p[1] + '</para>' + p[2] + '</listitem>'
# Glue any text in ITEM into the first para of maybe_lines
# (This is an unfortunate consequence of the line-based tokenization we do)
if p[2].startswith('<para>'):
p[0] = '<listitem><para>' + p[1] + p[2][len('<para>'):] + '</listitem>'
else:
p[0] = '<listitem><para>' + p[1] + '</para>' + p[2] + '</listitem>'
else:
p[0] = '<listitem><para>' + p[1] + '</para>' + p[3] + '</listitem>'
p[0] = '<listitem><para>' + p[1] + '</para>' + p[3] + '</listitem>'
parser_verbose(p)
def p_bullets(p):
'''bullets : bullet
| bullet bullets'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
p[0] = p[1]
parser_verbose(p)
def p_bulletlist(p):
@ -705,18 +707,18 @@ def p_row(p):
'''row : ITEM maybe_lines
| ITEM BLANKLINE maybe_lines'''
if len(p) == 3:
p[0] = '<row><entry><code>' + p[1] + '</code></entry><entry>' + p[2] + '</entry></row>'
p[0] = '<row><entry><code>' + p[1] + '</code></entry><entry>' + p[2] + '</entry></row>'
else:
p[0] = '<row><entry><code>' + p[1] + '</code></entry><entry>' + p[3] + '</entry></row>'
p[0] = '<row><entry><code>' + p[1] + '</code></entry><entry>' + p[3] + '</entry></row>'
parser_verbose(p)
def p_rows(p):
'''rows : row
| row rows'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
p[0] = p[1]
parser_verbose(p)
def p_table(p):
@ -756,9 +758,9 @@ def p_mct_columns(p):
'''mct_columns : maybe_lines
| maybe_lines MCT_COLUMN_SEPARATOR mct_columns'''
if len(p) == 4:
p[0] = '<entry>' + p[1] + '</entry>' + p[3]
p[0] = '<entry>' + p[1] + '</entry>' + p[3]
else:
p[0] = '<entry>' + p[1] + '</entry>'
p[0] = '<entry>' + p[1] + '</entry>'
parser_verbose(p)
def p_mct_row(p):
@ -770,9 +772,9 @@ def p_mct_rows(p):
'''mct_rows : mct_row
| mct_row mct_rows'''
if len(p) == 3:
p[0] = p[1] + '\n' + p[2]
p[0] = p[1] + '\n' + p[2]
else:
p[0] = p[1]
p[0] = p[1]
parser_verbose(p)
def p_mct_header(p):
@ -807,18 +809,18 @@ def main(file):
perform(processed)
# output the XML tree
s = lxml.etree.tostring(rootelement, pretty_print=True)
s = lxml.etree.tostring(rootelement, pretty_print=True, encoding='unicode')
if not s:
print('No output produced (perhaps the input has no makedoc markup?)', file=sys.stderr)
exit(1)
print('No output produced (perhaps the input has no makedoc markup?)', file=sys.stderr)
exit(1)
print(s)
# warn about texinfo commands which didn't get processed
match = re.search('@[a-z*]+', s)
if match:
print('texinfo command %s remains in output' % match.group(), file=sys.stderr)
print('texinfo command %s remains in output' % match.group(), file=sys.stderr)
#
#
@ -826,16 +828,16 @@ def main(file):
if __name__ == '__main__' :
options = OptionParser()
options.add_option('-v', '--verbose', action='count', dest = 'verbose')
options.add_option('-v', '--verbose', action='count', dest = 'verbose', default = 0)
options.add_option('-c', '--cache', action='store_true', dest = 'cache', help="just ensure PLY cache is up to date")
(opts, args) = options.parse_args()
if opts.cache:
sys.exit()
sys.exit()
verbose = opts.verbose
if len(args) > 0:
main(open(args[0], 'rb'))
main(open(args[0], 'rb'))
else:
main(sys.stdin)
main(sys.stdin)

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for newlib 3.1.0.
# Generated by GNU Autoconf 2.68 for newlib 3.3.0.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -567,8 +567,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
PACKAGE_VERSION='3.1.0'
PACKAGE_STRING='newlib 3.1.0'
PACKAGE_VERSION='3.3.0'
PACKAGE_STRING='newlib 3.3.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1323,7 +1323,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures newlib 3.1.0 to adapt to many kinds of systems.
\`configure' configures newlib 3.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1393,7 +1393,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of newlib 3.1.0:";;
short | recursive ) echo "Configuration of newlib 3.3.0:";;
esac
cat <<\_ACEOF
@ -1505,7 +1505,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
newlib configure 3.1.0
newlib configure 3.3.0
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@ -1783,7 +1783,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by newlib $as_me 3.1.0, which was
It was created by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@ -2867,7 +2867,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
VERSION='3.1.0'
VERSION='3.3.0'
# Some tools Automake needs.
@ -12396,7 +12396,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by newlib $as_me 3.1.0, which was
This file was extended by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -12453,7 +12453,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
newlib config.status 3.1.0
newlib config.status 3.3.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

20
newlib/libc/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for newlib 3.1.0.
# Generated by GNU Autoconf 2.68 for newlib 3.3.0.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -567,8 +567,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
PACKAGE_VERSION='3.1.0'
PACKAGE_STRING='newlib 3.1.0'
PACKAGE_VERSION='3.3.0'
PACKAGE_STRING='newlib 3.3.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1371,7 +1371,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures newlib 3.1.0 to adapt to many kinds of systems.
\`configure' configures newlib 3.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1441,7 +1441,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of newlib 3.1.0:";;
short | recursive ) echo "Configuration of newlib 3.3.0:";;
esac
cat <<\_ACEOF
@ -1557,7 +1557,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
newlib configure 3.1.0
newlib configure 3.3.0
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@ -1835,7 +1835,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by newlib $as_me 3.1.0, which was
It was created by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@ -2982,7 +2982,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
VERSION='3.1.0'
VERSION='3.3.0'
# Some tools Automake needs.
@ -12795,7 +12795,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by newlib $as_me 3.1.0, which was
This file was extended by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -12852,7 +12852,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
newlib config.status 3.1.0
newlib config.status 3.3.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

View File

@ -10,11 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -306,7 +306,7 @@ ok:
data->data[i] = _iconv_to_ucs_ces_handlers_table.init (
rptr,
data->desc[i].csname);
if (data->data == NULL)
if (data->data[i] == NULL)
goto error;
}

View File

@ -5,8 +5,8 @@
#include <_ansi.h>
#include "encnames.h"
const char *
_iconv_aliases =
const char
_iconv_aliases[] =
{
#if defined (_ICONV_FROM_ENCODING_BIG5) \
|| defined (_ICONV_TO_ENCODING_BIG5)
@ -210,4 +210,3 @@ _iconv_aliases =
#endif
""
};

View File

@ -115,7 +115,7 @@ search_again:
&& (p+l == table_end || isspace (*(p+l)) || *(p+l) == '\n')))
{
ptable = p + l;
len -= table - p;
len = table_end - ptable;
goto search_again;
}

View File

@ -57,10 +57,8 @@ typedef __uint16_t ucs2_t;
/* 32-bit UCS-4 type */
typedef __uint32_t ucs4_t;
/* The list of built-in encoding names and aliases */
extern const char *
_iconv_aliases;
extern const char _iconv_aliases[];
#endif /* !__ICONV_LIB_LOCAL_H__ */

View File

@ -20,11 +20,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -66,6 +66,9 @@ extern int toascii_l (int __c, locale_t __l);
#define _X 0100
#define _B 0200
/* For C++ backward-compatibility only. */
extern __IMPORT const char _ctype_[];
#ifdef __HAVE_LOCALE_INFO__
const char *__locale_ctype_ptr (void);
#else
@ -108,7 +111,12 @@ const char *__locale_ctype_ptr (void);
#ifdef __HAVE_LOCALE_INFO__
const char *__locale_ctype_ptr_l (locale_t);
#else
#define __locale_ctype_ptr_l(l) _ctype_
static __inline char *
__locale_ctype_ptr_l(locale_t _l)
{
(void)_l;
return __locale_ctype_ptr();
}
#endif
#define __ctype_lookup_l(__c,__l) ((__locale_ctype_ptr_l(__l)+sizeof(""[__c]))[(int)(__c)])
@ -170,9 +178,6 @@ const char *__locale_ctype_ptr_l (locale_t);
#endif /* !__cplusplus */
/* For C++ backward-compatibility only. */
extern __IMPORT const char _ctype_[];
_END_STD_C
#endif /* _CTYPE_H_ */

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2016 Joel Sherrill <joel@rtems.org>. All rights reserved.
* Copyright (c) 2016,2019 Joel Sherrill <joel@rtems.org>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -26,6 +27,32 @@
#ifndef _POSIX_DEVCTL_h_
#define _POSIX_DEVCTL_h_
/*
* Nothing in this file should be visible unless _POSIX_26_C_SOURCE is
* defined.
*/
#ifdef _POSIX_26_C_SOURCE
#include <sys/cdefs.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__rtems__)
/*
* The FACE Technical Standard, Edition 3.0 and later require the
* definition of the subcommand SOCKCLOSE in <devctl.h>.
*
* Reference: https://www.opengroup.org/face
*
* Using 'D' should avoid the letters used by other users of <sys/ioccom.h>
*/
#include <sys/ioccom.h>
#define SOCKCLOSE _IO('D', 1) /* socket close */
#endif
/*
* The posix_devctl() method is defined by POSIX 1003.26-2003. Aside
* from the single method, it adds the following requirements:
@ -35,10 +62,6 @@
* + application must define _POSIX_26_C_SOURCE to use posix_devctl().
* + posix_devctl() is prototyped in <devctl.h>
*/
#ifdef _POSIX_26_C_SOURCE
#include <sys/cdefs.h>
int posix_devctl(
int fd,
int dcmd,
@ -48,4 +71,8 @@ int posix_devctl(
);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -17,11 +17,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -87,6 +87,9 @@
# define __IEEE_BYTES_LITTLE_ENDIAN
# endif
#endif
#ifndef __SOFTFP__
# define _SUPPORTS_ERREXCEPT
#endif
#endif
#if defined (__aarch64__)
@ -96,6 +99,9 @@
#define __IEEE_BIG_ENDIAN
#endif
#define __OBSOLETE_MATH_DEFAULT 0
#ifdef __ARM_FP
# define _SUPPORTS_ERREXCEPT
#endif
#endif
#ifdef __epiphany__
@ -189,10 +195,14 @@
#ifdef __i386__
#define __IEEE_LITTLE_ENDIAN
# define _SUPPORTS_ERREXCEPT
#endif
#ifdef __riscv
#define __IEEE_LITTLE_ENDIAN
#ifdef __riscv_flen
# define _SUPPORTS_ERREXCEPT
#endif
#endif
#ifdef __i960__
@ -386,6 +396,7 @@
#ifdef __x86_64__
#define __IEEE_LITTLE_ENDIAN
# define _SUPPORTS_ERREXCEPT
#endif
#ifdef __mep__
@ -409,6 +420,10 @@
#define __SMALL_BITFIELDS /* 16 Bit INT */
#endif
#ifdef __PRU__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __RL78__
#define __IEEE_LITTLE_ENDIAN
#define __SMALL_BITFIELDS /* 16 Bit INT */
@ -456,6 +471,10 @@
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __XTENSA_EL__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __CYGWIN__
#define __OBSOLETE_MATH_DEFAULT 0
#endif

View File

@ -238,7 +238,7 @@ _BEGIN_STD_C
#endif
#ifdef __moxie__
#define _JBLEN 16
#define _JBLEN 10
#endif
#ifdef __CRX__
@ -352,6 +352,11 @@ _BEGIN_STD_C
#define _JBTYPE unsigned long
#endif
#ifdef __PRU__
#define _JBLEN 48
#define _JBTYPE unsigned int
#endif
#ifdef __RX__
#define _JBLEN 0x44
#endif

View File

@ -188,7 +188,17 @@ extern int isnan (double);
# define MATH_ERREXCEPT 2
#endif
#ifndef math_errhandling
# define math_errhandling MATH_ERRNO
# ifdef _IEEE_LIBM
# define _MATH_ERRHANDLING_ERRNO 0
# else
# define _MATH_ERRHANDLING_ERRNO MATH_ERRNO
# endif
# ifdef _SUPPORTS_ERREXCEPT
# define _MATH_ERRHANDLING_ERREXCEPT MATH_ERREXCEPT
# else
# define _MATH_ERRHANDLING_ERREXCEPT 0
# endif
# define math_errhandling (_MATH_ERRHANDLING_ERRNO | _MATH_ERRHANDLING_ERREXCEPT)
#endif
extern int __isinff (float x);
@ -602,22 +612,6 @@ extern int *__signgam (void);
#define M_LOG2_E _M_LN2
#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
/* Global control over fdlibm error handling. */
enum __fdlibm_version
{
__fdlibm_ieee = -1,
__fdlibm_posix
};
#define _LIB_VERSION_TYPE enum __fdlibm_version
#define _LIB_VERSION __fdlib_version
extern __IMPORT _LIB_VERSION_TYPE _LIB_VERSION;
#define _IEEE_ __fdlibm_ieee
#define _POSIX_ __fdlibm_posix
#endif /* __BSD_VISIBLE */
_END_STD_C

View File

@ -10,11 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -5,7 +5,7 @@
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* and/or other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived

View File

@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
@ -10,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -28,7 +30,7 @@
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
* $FreeBSD$
* $FreeBSD: head/sys/sys/_timespec.h 326023 2017-11-20 19:43:44Z pfg $
*/
#ifndef _SYS__TIMESPEC_H_

View File

@ -1,4 +1,6 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
*
* Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
* All rights reserved.
*
@ -23,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
* $FreeBSD: head/sys/sys/_timeval.h 326256 2017-11-27 15:01:59Z pfg $
*/
#ifndef _SYS__TIMEVAL_H_
@ -53,37 +55,6 @@ struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* and microseconds */
};
#if __BSD_VISIBLE
#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp) \
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
((tvp)->tv_sec cmp (uvp)->tv_sec))
#define timeradd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
if ((vvp)->tv_usec >= 1000000) { \
(vvp)->tv_sec++; \
(vvp)->tv_usec -= 1000000; \
} \
} while (0)
#define timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
#endif
#endif /* __BSD_VISIBLE */
#endif /* _TIMEVAL_DEFINED */
#endif /* !_SYS__TIMEVAL_H_ */

View File

@ -521,9 +521,13 @@ extern "C" {
/* #define _XOPEN_UNIX -1 */
#endif /* __XSI_VISIBLE */
/* The value corresponds to UNICODE version 5.2, which is the current
state of newlib's wide char conversion functions. */
#define __STDC_ISO_10646__ 200910L
/*
* newlib's wide char conversion functions were updated on
* 2019-01-12
* to UNICODE version:
* 11.0.0 released 2018-06-05
*/
#define __STDC_ISO_10646__ 201806L
#endif /* __CYGWIN__ */

View File

@ -498,10 +498,10 @@ extern const struct __sFILE_fake __sf_fake_stderr;
#endif /* _REENT_GLOBAL_STDIO_STREAMS */
/* Only add assert() calls if we are specified to debug. */
#ifdef _REENT_CHECK_DEBUG
/* Specify how to handle reent_check malloc failures. */
#ifdef _REENT_CHECK_VERIFY
#include <assert.h>
#define __reent_assert(x) assert(x)
#define __reent_assert(x) ((x) ? (void)0 : __assert_func(__FILE__, __LINE__, (char *)0, "REENT malloc succeeded"))
#else
#define __reent_assert(x) ((void)0)
#endif

View File

@ -27,33 +27,47 @@ typedef __sigset_t sigset_t;
* FD_SETSIZE may be defined by the user, but the default here
* should be >= NOFILE (param.h).
*/
# ifndef FD_SETSIZE
# define FD_SETSIZE 64
# endif
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif
typedef unsigned long fd_mask;
# define NFDBITS (sizeof (fd_mask) * 8) /* bits per mask */
# ifndef _howmany
# define _howmany(x,y) (((x)+((y)-1))/(y))
# endif
typedef unsigned long __fd_mask;
#if __BSD_VISIBLE
typedef __fd_mask fd_mask;
#endif
/* We use a macro for fd_set so that including Sockets.h afterwards
can work. */
typedef struct _types_fd_set {
fd_mask fds_bits[_howmany(FD_SETSIZE, NFDBITS)];
} _types_fd_set;
#define _NFDBITS ((int)sizeof(__fd_mask) * 8) /* bits per mask */
#if __BSD_VISIBLE
#define NFDBITS _NFDBITS
#endif
#define fd_set _types_fd_set
#ifndef _howmany
#define _howmany(x,y) (((x) + ((y) - 1)) / (y))
#endif
# define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
# define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
# define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
# define FD_ZERO(p) (__extension__ (void)({ \
size_t __i; \
char *__tmp = (char *)p; \
for (__i = 0; __i < sizeof (*(p)); ++__i) \
*__tmp++ = 0; \
}))
typedef struct fd_set {
__fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
} fd_set;
#if __BSD_VISIBLE
#define fds_bits __fds_bits
#endif
#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS))
#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n))
#if __BSD_VISIBLE
#define FD_COPY(f, t) (void)(*(t) = *(f))
#endif
#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0)
#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n))
#define FD_ZERO(p) do { \
fd_set *_p; \
__size_t _n; \
\
_p = (p); \
_n = _howmany(FD_SETSIZE, _NFDBITS); \
while (_n > 0) \
_p->__fds_bits[--_n] = 0; \
} while (0)
#if !defined (__INSIDE_CYGWIN_NET__)

View File

@ -10,11 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -33,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)time.h 8.5 (Berkeley) 5/4/95
* $FreeBSD: head/sys/sys/time.h 340664 2018-11-20 07:11:23Z imp $
* $FreeBSD: head/sys/sys/time.h 346176 2019-04-13 04:46:35Z imp $
*/
#ifndef _SYS_TIME_H_
@ -191,8 +191,15 @@ sbttobt(sbintime_t _sbt)
static __inline int64_t
sbttons(sbintime_t _sbt)
{
uint64_t ns;
return ((1000000000 * _sbt) >> 32);
ns = _sbt;
if (ns >= SBT_1S)
ns = (ns >> 32) * 1000000000;
else
ns = 0;
return (ns + (1000000000 * (_sbt & 0xffffffffu) >> 32));
}
static __inline sbintime_t
@ -333,6 +340,61 @@ tvtosbt(struct timeval _tv)
return (((sbintime_t)_tv.tv_sec << 32) + ustosbt(_tv.tv_usec));
}
/* Operations on timespecs */
#define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
#define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec)
#define timespeccmp(tvp, uvp, cmp) \
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
((tvp)->tv_sec cmp (uvp)->tv_sec))
#define timespecadd(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \
if ((vsp)->tv_nsec >= 1000000000L) { \
(vsp)->tv_sec++; \
(vsp)->tv_nsec -= 1000000000L; \
} \
} while (0)
#define timespecsub(tsp, usp, vsp) \
do { \
(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
if ((vsp)->tv_nsec < 0) { \
(vsp)->tv_sec--; \
(vsp)->tv_nsec += 1000000000L; \
} \
} while (0)
#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#define timercmp(tvp, uvp, cmp) \
(((tvp)->tv_sec == (uvp)->tv_sec) ? \
((tvp)->tv_usec cmp (uvp)->tv_usec) : \
((tvp)->tv_sec cmp (uvp)->tv_sec))
#define timeradd(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
if ((vvp)->tv_usec >= 1000000) { \
(vvp)->tv_sec++; \
(vvp)->tv_usec -= 1000000; \
} \
} while (0)
#define timersub(tvp, uvp, vvp) \
do { \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) { \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
} \
} while (0)
#endif
#endif /* __BSD_VISIBLE */
/*

View File

@ -533,7 +533,8 @@ int unlinkat (int, const char *, int);
* confstr values per IEEE Std 1003.1, 2004 Edition
*/
#ifdef __CYGWIN__ /* Only defined on Cygwin for now. */
/* Only defined on Cygwin and RTEMS for now. */
#if defined (__CYGWIN__) || defined(__rtems__)
#define _CS_PATH 0
#define _CS_POSIX_V7_ILP32_OFF32_CFLAGS 1
#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS

View File

@ -11,11 +11,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -85,6 +85,9 @@ it is 2 for <<"zh">> (Chinese), <<"ja">> (Japanese), and <<"ko">> (Korean),
and 1 for everything else. Specifying <<"cjknarrow">> or <<"cjkwide">>
forces a width of 1 or 2, respectively, independent of charset and language.
This implementation also supports the modifier <<"cjksingle">>
to enforce single-width character properties.
If you use <<NULL>> as the <[locale]> argument, <<setlocale>> returns a
pointer to the string representing the current locale. The acceptable
values for <[category]> are defined in `<<locale.h>>' as macros
@ -480,6 +483,7 @@ __loadlocale (struct __locale_t *loc, int category, char *new_locale)
int mbc_max;
wctomb_p l_wctomb;
mbtowc_p l_mbtowc;
int cjksingle = 0;
int cjknarrow = 0;
int cjkwide = 0;
@ -594,11 +598,13 @@ restart:
}
if (c && c[0] == '@')
{
/* Modifier */
/* Modifier "cjksingle" is recognized to enforce single-width mode. */
/* Modifiers "cjknarrow" or "cjkwide" are recognized to modify the
behaviour of wcwidth() and wcswidth() for East Asian languages.
For details see the comment at the end of this function. */
if (!strcmp (c + 1, "cjknarrow"))
if (!strcmp (c + 1, "cjksingle"))
cjksingle = 1;
else if (!strcmp (c + 1, "cjknarrow"))
cjknarrow = 1;
else if (!strcmp (c + 1, "cjkwide"))
cjkwide = 1;
@ -893,6 +899,7 @@ restart:
loc->wctomb = l_wctomb;
loc->mbtowc = l_mbtowc;
__set_ctype (loc, charset);
/* Set CJK width mode (1: ambiguous-wide, 0: normal, -1: disabled). */
/* Determine the width for the "CJK Ambiguous Width" category of
characters. This is used in wcwidth(). Assume single width for
single-byte charsets, and double width for multi-byte charsets
@ -907,6 +914,8 @@ restart:
|| strncmp (locale, "ja", 2) == 0
|| strncmp (locale, "ko", 2) == 0
|| strncmp (locale, "zh", 2) == 0));
if (cjksingle)
loc->cjk_lang = -1; /* Disable CJK dual-width */
#ifdef __HAVE_LOCALE_INFO__
ret = __ctype_load_locale (loc, locale, (void *) l_wctomb, charset,
mbc_max);

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for newlib 3.1.0.
# Generated by GNU Autoconf 2.68 for newlib 3.3.0.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -556,8 +556,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
PACKAGE_VERSION='3.1.0'
PACKAGE_STRING='newlib 3.1.0'
PACKAGE_VERSION='3.3.0'
PACKAGE_STRING='newlib 3.3.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1240,7 +1240,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures newlib 3.1.0 to adapt to many kinds of systems.
\`configure' configures newlib 3.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1310,7 +1310,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of newlib 3.1.0:";;
short | recursive ) echo "Configuration of newlib 3.3.0:";;
esac
cat <<\_ACEOF
@ -1402,7 +1402,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
newlib configure 3.1.0
newlib configure 3.3.0
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@ -1457,7 +1457,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by newlib $as_me 3.1.0, which was
It was created by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@ -2541,7 +2541,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
VERSION='3.1.0'
VERSION='3.3.0'
# Some tools Automake needs.
@ -4025,7 +4025,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by newlib $as_me 3.1.0, which was
This file was extended by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -4082,7 +4082,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
newlib config.status 3.1.0
newlib config.status 3.3.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for newlib 3.1.0.
# Generated by GNU Autoconf 2.68 for newlib 3.3.0.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -556,8 +556,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
PACKAGE_VERSION='3.1.0'
PACKAGE_STRING='newlib 3.1.0'
PACKAGE_VERSION='3.3.0'
PACKAGE_STRING='newlib 3.3.0'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
@ -1240,7 +1240,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures newlib 3.1.0 to adapt to many kinds of systems.
\`configure' configures newlib 3.3.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1310,7 +1310,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of newlib 3.1.0:";;
short | recursive ) echo "Configuration of newlib 3.3.0:";;
esac
cat <<\_ACEOF
@ -1402,7 +1402,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
newlib configure 3.1.0
newlib configure 3.3.0
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@ -1457,7 +1457,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by newlib $as_me 3.1.0, which was
It was created by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@ -2541,7 +2541,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
VERSION='3.1.0'
VERSION='3.3.0'
# Some tools Automake needs.
@ -4025,7 +4025,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by newlib $as_me 3.1.0, which was
This file was extended by newlib $as_me 3.3.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -4082,7 +4082,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
newlib config.status 3.1.0
newlib config.status 3.3.0
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"

Some files were not shown because too many files have changed in this diff Show More