Commit Graph

21435 Commits

Author SHA1 Message Date
Mike Frysinger a84860f488 libgloss: sparc: add missing m4 include
Commit 8d75828378 ("libgloss: merge
sparc configure script up a level") missed including the sparc
acinclude.m4 file which meant none of the sparc-specific vars were
propagating to the sub-makefile.
2023-12-29 21:07:08 -05:00
Mike Frysinger 98230b7db1 libgloss: xtensa: fix crt0.o rule
Don't hardcode a custom rule for this -- reuse libobjs_a_SOURCES
which was designed for this exact scenario.
2023-12-29 20:59:38 -05:00
Hans-Peter Nilsson ddb614993a newlib MMIX: Fix compilation warnings that recent gcc treats as errors
Without this, when building with recent gcc, we'll see errors when
compiling for --target mmix the first being:
  CC       libc/sys/mmixware/libc_a-chmod.o
In file included from /x/newlib/libc/sys/mmixware/chmod.c:17:
/x/newlib/libc/sys/mmixware/chmod.c: In function 'chmod':
/x/newlib/libc/sys/mmixware/sys/syscall.h:139:6: error: implicit declaration \
of function 'sprintf' [-Wimplicit-function-declaration]
  139 |      sprintf (buf, "UNIMPLEMENTED %s in %s\n", __FUNCTION__,
 __FILE__); \

Other warnings also quelled.

	* libc/sys/mmixware/sys/syscall.h: Include stdio.h, string.h
	and unistd.h.
	* libc/sys/mmixware/_exit.c: Call __unreachable after simulator exit.
	* libc/sys/mmixware/chown.c (chown): Match declaration in unistd.h.
	* libc/sys/mmixware/getpid.c (_getpid): Ditto.
	* libc/sys/mmixware/kill.c (_kill): Ditto.
	* libc/sys/mmixware/link.c (_link): Ditto.
	* libc/sys/mmixware/read.c (_read): Ditto.
	* libc/sys/mmixware/sbrk.c (_sbrk): Ditto.
	* libc/sys/mmixware/unlink.c (_unlink): Ditto.
	* libc/sys/mmixware/write.c (_write): Ditto.
2023-12-29 19:29:20 +01:00
Thomas Schwinge 1a177610d8 GCN: Implement '_exit' instead of 'exit'
... so that all of 'exit', '_exit', '_Exit' work.  'exit' thus becomes the
standard 'newlib/libc/stdlib/exit.c'.  (Getting 'atexit' functional needs
further work elsewhere.)

See also commit 5841b2f6a4
"nvptx: Implement '_exit' instead of 'exit'".
2023-12-23 10:26:58 +01:00
Jeff Law 1df8f9f09b Fix epiphany libgloss for c99/gcc-14
So in this case we mostly need to include an internal header
(epiphany-syscalls.h).  In a few cases an explicit prototype is added.  We've
also got a return with no value in a function with a non-void return type.
Finally the asm_syscall interface expects a pointer as its first argument.  In
a few cases we've actually got an int (file descriptor) which we just cast to a
void *.

It's slightly more than Jeff J's pre-approval, but I think still reasonable.
2023-12-22 21:29:56 -07:00
Jeff Law 5e79655f38 Fix most of m32r libgloss for c99/gcc-14
Make implicit its explicit, add missing prototypes and header includes.  This
does not fix m32r-stub.c which needs more than the trivial work that Jeff J has
pre-approved.
2023-12-22 21:21:52 -07:00
Jeff Law 73ba287338 Fix mcore libgloss port for c99/gcc-14
Missing headers and prototypes, much like other ports.
2023-12-22 21:17:36 -07:00
Jeff Law a1a21442bc Fix rl78 libgloss port for c99/gcc-14
Needed a prototype for SYS_write and the prototype for write was incorrect
(returns an int, not a char *).
2023-12-22 21:00:35 -07:00
Jeff Law f7d5bd9bbf Fix c6x libgloss port for c99/gcc-14
Just one missing header in this case...
2023-12-22 20:57:47 -07:00
Jeff Law 886eadb78e Fix ft32 libgloss for c99/gcc-14
Just one missing header for this libgloss port.
2023-12-22 20:48:21 -07:00
Jeff Law 9f3e8ba3b2 Fix frv libgloss bits for c99/gcc-14\
Same as we've seen elsewhere.  Add missing prototype and header include.
2023-12-22 20:40:21 -07:00
Jeff Law dc7ee58132 Fix newlib H8/300 bits for C99/gcc-14
Similar to other patches.  This adds a missing prototype and #include to some
H8/300 specific code in newlib.  Pushed to the trunk given Jeff J's
pre-approval for these kinds of changes.
2023-12-22 20:25:10 -07:00
Jeff Law 7382f54405 Fix v850 libgloss for c99/gcc-14
So the prior patch for sysnecv850 was in newlib.  This time we're fixing v850
bits in libgloss.

Like other patches submitted recently, this converts implicit ints to explicit
ints, adds a missing prototype and header includes.
2023-12-22 20:19:58 -07:00
Jeff Law bdcfea3a24 Fix iq2000 libgloss for c99/gcc-14
Similar to the others in this space.  Make implicit ints explicit ints. Add
prototype for _write in sbrk.c.
2023-12-21 12:43:27 -07:00
Jeff Johnston 188ca64934 Optimize strpbrk.c 2023-12-21 14:04:49 -05:00
Jeff Law 7a45daad91 Re: libgloss c99 fixes for mn10300-elf
Very similar to other patches in this space.  Avoid implicit int types and add
missing #includes so that this code works with gcc-14.
2023-12-21 00:01:54 -07:00
Jeff Johnston 5fa3b84da0 Regenarate libgloss/Makefile.in 2023-12-20 17:13:18 -05:00
Craig Blackmore 73bce6597c newlib: Fix long double for unsupported rounding modes and exceptions
RISC-V newlib fails to build for soft float multilibs since long double
support was enabled in:

  commit 04798b7bb6
  Author: Kito Cheng <kito.cheng@sifive.com>
  Date:   Mon Dec 4 15:41:39 2023 +0800

      RISC-V: Support long double math

      Long double for RISC-V is using 128 bit IEEE 754 format like Aarch64,
      so we reference AArch64 to support that.

The RISC-V soft floating point environment only supports the
FE_TONEAREST rounding mode and does not support exceptions.  Guard long
double rounding and exception support with ifdefs based on the presence
of the relevant rounding modes and exceptions.

Tested on gcc/g++ testsuite using RISC-V GNU Newlib Toolchain built by
riscv-gnu-toolchain with multilibs:

    riscv-sim/-march=rv32i/-mabi=ilp32/-mcmodel=medlow
    riscv-sim/-march=rv32iac/-mabi=ilp32/-mcmodel=medlow
    riscv-sim/-march=rv32im/-mabi=ilp32/-mcmodel=medlow
    riscv-sim/-march=rv32imac/-mabi=ilp32/-mcmodel=medlow
    riscv-sim/-march=rv32imafc/-mabi=ilp32f/-mcmodel=medlow
    riscv-sim/-march=rv64imac/-mabi=lp64/-mcmodel=medlow

Co-authored-by: Simon Cook <simon.cook@embecosm.com>
2023-12-20 16:54:22 -05:00
Xiao Zeng b639245932 newlib: libc: Improved the readability of strcspn with minor optimization
Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
2023-12-19 23:23:31 -05:00
Jeff Law c1a61029fe Fix various v850 problems
These fixes fall into a few different buckets.  First c99 doesn't allow a
parameter without a type.  So in cases where the type had previously been an
implicit int, make it an explicit int.  Second, for return values, don't allow
them to be implicit ints either, make them explicit. In a few cases change c89
function definitions to c99 function definitions.   Lastly include <stdlib.h>
in sbrk.c to get the prototype for abort () which we call when we detect a
heap/stack collision.
2023-12-19 20:56:04 -07:00
Mike Frysinger 30c469f2e8 libgloss: doc: generate single page & split html manuals
By default, only split node html manuals are generated.  Change the
default to single page, and add an extra rule to also generate the
split page manual.
2023-12-19 17:04:41 -05:00
Mike Frysinger 751a3427e0 libgloss: drop $(INCLUDES) when using $(AS)
Since $(AS) is the assembler, passing it a list of preprocessor include
flags doesn't make much sense.  The files aren't preprocessed which means
`#include` lines aren't respected, and while it would affect `.include`
usage, we never use that, and it's extremely unlikely to change.  Plus,
it's extremely unlikely we'd have .s files in common places to include vs
contained entirely within a specific arch dir, and at that point, it can
be included directly (with no flags), or the arch can add the unique set
of include paths that it needs for itself.
2023-12-19 14:00:03 -05:00
Jeff Johnston f81bf08f7c Add generated files for Revert patch 2023-12-19 13:58:12 -05:00
Mike Frysinger b67114d7d8 Revert "Fix libgloss/newlib build to conditionally use top include dir"
This reverts commit 17ac400c11.

The build failures were due to incorrectly using $(INCLUDES) when
running $(AS).  Let's roll this back and drop $(INCLUDES) from the
$(AS) invocations.
2023-12-19 13:37:02 -05:00
Freddie Chopin 60c6397133 Remove curly braces in `@author` tag in .texi files
Curly braces cause documentation build failure with texinfo 7.1 (works fine
up to 7.0.3):
2023-12-19 13:28:18 -05:00
Jeff Law c2c9f05a05 libgloss fix for bfin port
gcc-14 will complain loudly both for calling a function without an in-scope
prototype or when the in scope prototype differs from the known signature.

"main" happens to be one of the functions the compiler knows about.  So not
only do we need to prototype it, we need to make sure the prototype matches
what GCC thinks it should be.

This fixes the bfin libgloss port to do the right thing for bfin-elf.
2023-12-18 21:29:51 -07:00
Jeff Law 57e311e0de Re: Fix moxie libgloss issues with c99
Two libgloss issues specific to moxie-elf that show up build with GCC trunk.

First, putnum.c uses "print" without a prototype.  So I added one based on the
function's definition in print.c.  Second sim-inbyte.c uses read, which comes
from unistd.h, so this adds a suitable #include.
2023-12-16 21:11:10 -07:00
Jeff Law 17a6aff334 Fix fr30 libgloss build
gcc-14 will default to c99 and as a result a fair amount of old code in newlib
(particularly libgloss) is failing to build.  I don't offhand know how many
patches will be necessary to fix the various failures. I'll just pick them off
one by one from my tree.

This particular patch works around the return-mismatch problem syscalls.c for
fr30.

That file is a bit odd in that most functions are declared as returning an
integer, but the implementations look like:

> int
> _read (file, ptr, len)
>      int    file;
>      char * ptr;
>      int    len;
> {
>   asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0");
>   asm ("int   #10");
>
>   return;
> }

Note the lack of a value on the "return" statement.  The assumption is that the
interrupt handler implementing syscalls will put the return value into the
proper register, so falling off the end of the C function or returning with no
value works in the expected way.  It's not good code, but it probably works.

Working from that assumption I decided to just use a pragma to disable the
upgraded diagnostic from GCC -- essentially preserving existing behavior.

This is the only fr30 specific issue that needs to be resolved and the only
issue (so far) I've seen of this specific nature.
2023-12-14 10:30:13 -07:00
Hans-Peter Nilsson 3bafe2fae7 newlib cris: Fix compilation warnings that recent gcc treats as errors
For the newlib part, warnings are all from lack of sync between
libc/machine/cris/sys/signal.h and libc/include/sys/signal.h.  This
commit gets them sufficiently in sync again, functionality-wise and
declaration-wise.  Still, nothing is declared that isn't supported at
the system level (i.e. in libgloss system calls and handled by the
CRIS simulator in the gdb project).
2023-12-06 18:46:49 +01:00
Hans-Peter Nilsson 7cce4cdd6e libgloss/cris: Make C declarations present and match them
This is the libgloss part.
Recently, there was a change in gcc such that implicit function
declarations and type mismatches are now errors, no longer just
warnings.  Fix by adding and correcting declarations warned about;
including the right header or adding a declaration (for "main" in
lcrt0.c) and adjust to those types as necessary.
2023-12-06 18:45:57 +01:00
Corinna Vinschen 0737bda6ff Cygwin: fallocate(2): fix debug output
Fixes: e01c50c7b0 ("Cygwin: introduce fallocate(2)")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-05 22:20:48 +01:00
Corinna Vinschen 7f88c8e0b3 Cygwin: fallocate(2): fix offset and length sanity check
- len must not be <= 0
- offset + len must not exceed off_t (max. file size)

Fixes: e01c50c7b0 ("Cygwin: introduce fallocate(2)")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-05 22:20:42 +01:00
Corinna Vinschen 295bef07d6 Cygwin: posix_fallocate(3): fix offset and length sanity check
- len must not be <= 0
- offset + len must not exceed off_t (max. file size)

Fixes: 7636b58590 ("* autoload.cc (NtSetInformationFile): Define.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-05 22:19:05 +01:00
Dimitar Dimitrov 14d786873c pru: libm: Fix incorrect function name
Upstream GCC changed -Wimplicit-function-declaration warning into an
error. The build break about missing fpclassifyf function prototype
exposed a bug in the PRU port of libm.

The fix is to use the fpclassify macro for both double and float types.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2023-12-04 17:01:05 +01:00
Kito Cheng 04798b7bb6 RISC-V: Support long double math
Long double for RISC-V is using 128 bit IEEE 754 format like Aarch64,
so we reference AArch64 to support that.
2023-12-04 10:26:41 +01:00
Kito Cheng bcd1883560 RISC-V: Fix -Wint-conversion warning
Upstream GCC has change this warning into error by default, so...we need
to explicitly convert the type from pointer from/to integer, generally
it's unsafe, but we know what we are doing here.

However it's not safe for ilp32 on RV64, but we didn't support that yet, so I
think this fix is good enough now :)
2023-12-04 10:26:41 +01:00
Corinna Vinschen c0d2f38742 Cygwin: fallocate(2): drop useless zeroing pointer
The out pointer is only used if data_chunk_count is > 0,
so there's no reason to set it to NULL in the error case.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-04 10:20:55 +01:00
Jon Turney 97b1f4db06
Cygwin: CI: drop IRC notification from AppVeyor via notifico
Drop IRC status notification from AppVeyor via notifico, as we no longer
run tests there.
2023-12-03 13:05:18 +00:00
Kuan-Wei Chiu b64d0d53af newlib: libc: Fix indentation
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
2023-12-02 22:22:26 -05:00
Kuan-Wei Chiu 65f7ab0bb9 newlib: libc: Fix memory leak in computematchjumps()
In cases where malloc fails for the 'g->matchjump' allocation, the code
path does not handle the failure gracefully, potentially leading to a
memory leak. This fix ensures proper cleanup by freeing the allocated
memory for 'pmatches' before returning.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
2023-12-01 19:28:55 +01:00
Corinna Vinschen 10da646880 Cygwin: drop stray fs_info::check_ssd declaration
This is just a leftover from development

Fixes: 8b01c5d690 ("Cygwin: fs_info: check for SSD")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-12-01 09:56:05 +01:00
Corinna Vinschen cb21f8bc56 Cygwin: doc: add missing change to posix_spawnp
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30 22:38:59 +01:00
Corinna Vinschen 832e91422c Cygwin: sparse support: enable automatic sparsifying of files on SSDs
Given that SSDs don't have a seek penalty, we can enable
automatic sparsifying of files on SSDs, even if the "sparse"
mount option is not set.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30 22:37:35 +01:00
Corinna Vinschen 8b01c5d690 Cygwin: fs_info: check for SSD
During fs_info::update, check for the file being on an SSD.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30 22:37:35 +01:00
Corinna Vinschen 61f49ada90 Cygwin: ntdll.h: add missing NtQueryVolumeInformationFile definitions
In preparation of using the FileFsSectorSizeInformation info class,
add a couple of missing definitions.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30 22:37:35 +01:00
Corinna Vinschen f816787c57 Cygwin: ntdll.h: add missing POBJECT_NAME_INFORMATION
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30 22:37:35 +01:00
Corinna Vinschen 013de6b097 Cygwin: revert autoloading of DiscardVirtualMemory
Commit a3ae2a7348 ("Cygwin: don't autoload some kernel32 functions")
erroneously removed DiscardVirtualMemory from the list of autloaded
functions.  DiscardVirtualMemory is not available on Windows 8.1.

Fixes: a3ae2a7348 ("Cygwin: don't autoload some kernel32 functions")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2023-11-30 22:37:35 +01:00
Jon Turney 127166f707
Cygwin: Add '--names-only' flag to cygcheck
Add '--names-only' flag to cygcheck, to output just the bare package
names.
2023-11-29 14:34:10 +00:00
Kuan-Wei Chiu 5f15d7c581 RISC-V: Fix timeval conversion in _gettimeofday()
Replace multiplication with division for microseconds calculation from
nanoseconds in _gettimeofday function.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
2023-11-29 10:14:55 +01:00
Mike Frysinger dab15f6740 newlib: filter out versions from newlib.h to simplify autoreconf
We've been manually editing newlib.hin after generating it with
autoheader to drop the version defines that we keep in the separate
_newlib_version.h header.  This is confusing for people, and is an
easy source of mistakes/errors.

Since we're already running sed on newlib.h during configure to
filter out defines we don't want to expose, add the version macros
there too.  This way we don't have to manually edit newlib.hin.

This simplifies the autoreconf step in exchange for a slightly more
complicated configure+sed step, but seems worth the trade-off.
2023-11-28 12:50:44 -05:00