Unfortunately fgrep is now deprecated in a very pushy way.
Make sure to use grep -F instead all around, even in docs
and comments/
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Provide the same debugging opportunities for api_fatal() as we do for a
core-dumping signal:
1) Break into any attached debugger
2) Start JIT debugger (if configured) (keeping these under DEBUGGING doesn't seem helpful)
3) Write a coredump (if rlim_core > 1MB)
4) Write a stackdump (if that failed, or 0 < rlim_core <= 1MB)
Pre-format a command to be executed on a fatal error to run 'dumper'
(using an absolute path).
Factor out executing a pre-formatted command, so we can use that for
invoking the JIT debugger in try_to_debug() (if error_start is present
in the CYGWIN env var) and to invoke dumper when a fatal error occurs.
On a fatal error, if the core file size limit is greater than 1MB,
invoke dumper to write a core dump. Otherwise, if that limit is greater
than 0, write a .stackdump file, as previously.
Adjust and clarify the associated documentation.
Also: Fix so that the error_start JIT debugger is now invoked, even when
ulimit -c is zero.
Also: Fix uses of console_printf() inside exec_prepared_command(). It's
output is written via the Windows console device, so needs to use
Windows-style line endings.
Also: consistently return non-zero from try_to_debug() if we debugged.
Future work: Truncate or remove the file written, if it exceeds the
maximum size set by the ulimit.
Future work: Using the words "fatal error" could probably be improved
on. This means exiting on one of the "certain signals whose default
action is to cause the process to terminate and produce a core dump
file".
This function closes or sets the close-on-exec flag for a specified
range of file descriptors. It is available on FreeBSD and Linux.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
Currently init_semihosting() assumes the return value from _open()
call as the file descriptor handle and that is incorrect.
The semihost _open() call returns the fdtable index returned by the
__add_fdentry() for the file opened.
From: Rich Felker <dalias@aerifal.cx>
Date: Mon, 7 Nov 2022 22:17:55 -0500
the rule that longest digit sequence not beginning with a zero is
greater only applies when both sequences being compared are
non-degenerate. this is spelled out explicitly in the man page, which
may be deemed authoritative for this nonstandard function: "If one or
both of these is empty, then return what strcmp(3) would have
returned..."
we were wrongly treating any sequence of digits not beginning with a
zero as greater than a non-digit in the other string.
Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Set symbol '__jvt_base$' as weak. So if the symbol is not set in the
linker script, the address would be 0. We initialize jvt CSR only if
the address is not 0.
Also use csr number directly instead of using symbolic name to prevent the
backward incompatible issue.
psabi reference:
2d770815dc/riscv-elf.adoc (table-jump-relaxation)
The i960 port has a lot of references to sim files that have never been
included in the tree afaict, and thus has never worked. Delete all the
code to simplify.
This is a .c file, not assembly, and it's a duplicate (same content)
as the existing sim-lseek.c. Delete it since it's unused and doesn't
actually compile.
Basically the startup code needs to clear memory from _edata to _end. In the
past it's been done with a fairly naive copy loop. This changes the code to
just call memset and let memset figure out a sensible way to handle the
operation given the size and alignment requirements.
I don't have performance data on this. I cobbled it together some time ago in
response to seeing some of the GCC tests with larger .bss sections taking an
insane amount of time to just get from _start to main. With the fixes to the
H8 decoder in the simulator it may not matter nearly as much anymore.
This has been in my tester for months. Naturally it does not cause any
regressions in the H8 port.
Similar to what's been done in the ports, but this time in generic code.
Add missing #includes to pick up prototypes. Add prototypes for various
internal functions where needed. Fix signatures of various functions to match
what's provided by the headers (read, sbrk, write, unlink).
Nearly done with this effort ;-)
Pushed to the trunk,
I guess I must have missed this when working through the trivial port specific
changes.
This adds an include of stdlib.h to get a prototype for exit().
Pushed to the trunk.
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.
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.
... 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'".
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.
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.
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.
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.
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>
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.
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.
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.