Commit Graph

21483 Commits

Author SHA1 Message Date
Mike Frysinger 1ed68b884c libgloss: merge rx into top-level Makefile
Avoid a recursive make to speed things up a bit.
A rx-elf build shows installed objects & libs produce same code.
2024-01-19 20:26:52 -05:00
Mike Frysinger 3342c0ef81 libgloss: merge xstormy16 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A xstormy16-elf build shows installed objects & libs produce same code.
2024-01-19 20:26:52 -05:00
Mike Frysinger 695404d16f libgloss: merge nds32 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A nds32le-elf build shows installed objects & libs produce same code.
2024-01-19 20:26:52 -05:00
Mike Frysinger f4c8e1623b libgloss: merge mcore into top-level Makefile
Avoid a recursive make to speed things up a bit.
A mcore-elf build shows installed objects & libs produce same code.
2024-01-19 20:26:52 -05:00
Mike Frysinger 41de4b00f7 libgloss: merge mn10200 into top-level Makefile
Avoid a recursive make to speed things up a bit.
Untested, but follows the same pattern as mn10300, but simpler.
2024-01-19 20:26:52 -05:00
Mike Frysinger 25f6d8772e libgloss: merge mn10300 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A mn10300-elf build shows installed objects & libs produce same code.
2024-01-19 20:26:52 -05:00
Mike Frysinger 56211d0e14 libgloss: merge i386 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A i386-elf build shows installed objects & libs produce same code other
than a rename from cygmon-gmon.o & cygmon-salib.o to i386_libcygmon_a-*.o
due to the use of custom CPPFLAGS in here.
2024-01-19 20:26:52 -05:00
Mike Frysinger 20dcee2c27 libgloss: merge frv into top-level Makefile
Avoid a recursive make to speed things up a bit.
A frv-elf build shows installed objects & libs produce same code.
2024-01-19 20:26:52 -05:00
Mike Frysinger 787b83bb9b libgloss: merge msp430 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A msp430-elf build shows installed objects & libs produce same code.
2024-01-19 20:21:05 -05:00
Mike Frysinger f904792808 libgloss: msp430: delete custom .S.o rule
This was added to specify -Wa,-gdwarf2 when compiling the assembly
files.  Considering the size of these .S files, it seems unnecessary
overkill and complicates the build system.  All but one of these
compile down to 6 or fewer lines, and those hardly need extra debug
for anyone who is poking msp430 assembly.  The 1 file that is larger
than that (crt_move_highdata.S) is still <15 insns.

This will also simplify merging it into the top-level Makefile.
2024-01-19 20:21:05 -05:00
Mike Frysinger f5c40e04e5 libgloss: msp430: split up crt0.S source
The build system compiles crt0.S many times to produce independent
object files by defining different -DLxxx symbols for each.  This
complicates the build, and has led to some bugs in the source and
build (see the previous cleanup commits in here).  The crt_bss.S
file has also been duplicated with crt0.S leading to confusion as
to which one is the "real" one.  The only reason to keep them in
one file is to make management of the section numbers when calling
START_CRT_FUNC a little easier, but that seems trivial to check
with a quick grep across all the files.

Considering how complicated the build is now, and the bugs we've
had as a result, split the crt0.S file up into multiple source
files so we don't have to compile it multiple times.  This will
also simplify merging it into the top-level Makefile.
2024-01-19 20:21:05 -05:00
Mike Frysinger 2b0fd70308 libgloss: msp430: delete stub crt_init.o
This object is created by compiling crt0.S with -DLinit, but there
has never been an "#if Linit" check in crt0.S, so this has always
produced a stub object file.  Drop compiling it entirely.
2024-01-19 20:21:05 -05:00
Mike Frysinger 0ed55d03b7 libgloss: msp430: delete outdated/wrong code
The #if 0 & comment imply this code doesn't exist and is never used,
except there's another #if Lrun_fini_array section below which *does*
define this function, which makes this code comment confusing.  This
seems to be a hold over of the cleanup of the minrt code in the old
commit 884b05b54e ("MSP430: Remove
.init/.fini sections").
2024-01-19 20:21:05 -05:00
Mike Frysinger 58da258561 libgloss: add per-file & per-dir flag support
This logic is copied from what's used in newlib today.  This allows
subdirs to easily define per-directory flags & per-file flags without
having to setup unique automake rules for each one.
2024-01-19 20:20:46 -05:00
Mike Frysinger 0714c6305a libgloss: add some objcopy/objdump build rules
A bunch of ports have manual rules to generate disassembly, srec, and
binary files from test programs.  Add top-level pattern rules so every
test program gets this for free, and we don't have to duplicate it in
every subdir.
2024-01-19 20:09:28 -05:00
Mike Frysinger 1adfc9ac37 libgloss: check for objcopy & objdump properly
A bunch of ports hack together these values rather than setting them
up in the configure script for everyone.
2024-01-19 19:51:35 -05:00
Corinna Vinschen 3f2d03a780 Cygwin: remove warnings from testsuite build
- drop unused variable
- remove deprectated usage of std::pointer_to_unary_function.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19 15:11:32 +01:00
Corinna Vinschen 47f079b98e fputwc: call __fputwc directly
Avoid another hop in the call stack.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19 11:51:01 +01:00
Corinna Vinschen 422c4f0451 memccpy: fix pointer assignment
The local vars dst and src are unsigned pointers, but two assignments
cast their value to signed explicitely.  This results in the warning
"pointer targets in assignment from ‘char *’ to ‘unsigned char *’
differ in signedness [-Wpointer-sign]" in case of -Wall.

Fix the cast.

Fixes: d254189b38 ("2002-07-23  Jeff Johnston  <jjohnstn@redhat.com>")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19 11:51:01 +01:00
Corinna Vinschen 29ec33360d ORIENT: avoid "expression has no effect" warning
The warning "right-hand operand of comma expression has no effect
[-Wunused-value]" crops up with -Wall in cases where ORIENT is called
without checking or assigning its value.

Explicitely void the expression in these cases to avoid the warning.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19 11:51:01 +01:00
Corinna Vinschen d13d9220bf _fputwc_r: actually return result of __fputwc
Compiling with -Wall uncovered a bug in _fputwc_r introduced in
commit 09119463a1 ("stdio: split byte- and wide-char-oriented
low-level output functions").  The underlying function __fputwc
has been accidentally called without fetching its return value.
So the return value of _fputwc_r (and thus fputwc) was undefined.

Fixes: 09119463a1 ("stdio: split byte- and wide-char-oriented low-level output functions"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-19 11:13:39 +01:00
Corinna Vinschen d45261f62a Cygwin: replace all `fgrep' with `grep -F'
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>
2024-01-18 10:53:25 +01:00
Corinna Vinschen 70b27cee0c Cygwin: copy doc changes from commit 241b50a7ab to release notes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-17 12:39:50 +01:00
Jon Turney 07cccc74a5
Cygwin: Update documentation for cygwin_stackdump 2024-01-16 14:07:08 +00:00
Jon Turney aa8224826c
Cygwin: Treat api_fatal() similarly to a core-dumping signal
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)
2024-01-16 14:07:07 +00:00
Jon Turney a83b93e662
Cygwin: Define and use __WCOREFLAG
Also fix a typo in description of exit status
2024-01-16 14:07:06 +00:00
Jon Turney b7868e7410
Cygwin: Disable writing core dumps by default.
Change the default core limit from unlimited to 0 (disabled)
2024-01-16 14:07:05 +00:00
Jon Turney 91457377d6
Cygwin: Make 'ulimit -c' control writing a coredump
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".
2024-01-16 14:07:03 +00:00
Christian Franke d8c0fb090c Cygwin: introduce close_range(2)
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>
2024-01-15 12:52:56 +01:00
Corinna Vinschen 4ecfb5b729 Cygwin: api docs: add missing fallocate
Also add notes in terms of fallocate quirks.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-15 11:04:29 +01:00
Jon Turney 241b50a7ab
Cygwin: Clarifications in 3.5 changes doc 2024-01-12 13:40:28 +00:00
Corinna Vinschen 5edd189d1c Cygwin: path.cc: fix comment starting with // but ending in */
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-11 13:21:54 +01:00
Jon Turney d11629ddb3
Cygwin: Fix a stray '\n' in cygcheck manpage
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2024-01-10 16:43:13 +00:00
Venkata Ramanaiah Nalamothu c419bbb341 RISC-V: fix setting up std streams in init_semihosting()
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.
2024-01-10 10:46:56 +01:00
Brian Inglis 9a863f713a fix strverscmp comparison of digit sequence with non-digits
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>
2024-01-08 17:01:25 +01:00
Hau Hsu 573458e7fc RISC-V: Initialize the jvt CSR
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)
2024-01-08 13:12:06 +01:00
Corinna Vinschen 94d871eeac Cygwin: check remote drives for being SSDs as well
This enables automatic sparse file support for remote SSDs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-01-08 11:45:13 +01:00
Mike Frysinger 6bbeed74ca libgloss: merge i960 into top-level Makefile
Avoid a recursive make to speed things up a bit.
I can't test this as current versions of binutils doesn't support i960.
2024-01-03 03:49:10 -05:00
Mike Frysinger 6879bfa7c2 libgloss: i960: delete dead/broken code
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.
2024-01-03 03:48:41 -05:00
Mike Frysinger 6a3bc17465 libgloss: merge v850 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A v850e-elf build shows installed objects & libs produce same code.
2024-01-03 03:47:59 -05:00
Mike Frysinger 50d6410160 libgloss: merge moxie into top-level Makefile
Avoid a recursive make to speed things up a bit.
A moxie-elf build shows installed objects & libs produce same code.
2024-01-03 03:44:26 -05:00
Mike Frysinger cd75406286 libgloss: moxie: delete unused/invalid assembly file
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.
2024-01-03 03:41:55 -05:00
Mike Frysinger a2ddc21f80 libgloss: fix up incorrect "it's" 2024-01-03 00:14:42 -05:00
Xiao Zeng 99f3898dfc newlib: libc: Improved the readability of strspn with minor optimization
Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
2024-01-02 14:11:07 -05:00
Jeff Johnston 26f7004bf7 Changes for newlib 4.4.0 snapshot
- bump up version to 4.4.0
2023-12-31 12:00:18 -05:00
Jeff Law ec119e1084 Minor improvement to H8 startup code
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.
2023-12-31 09:08:21 -07:00
Jeff Law 3d10b04f1e Fix various c99/gcc-14 issues in generic libgloss code
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,
2023-12-29 21:31:27 -07:00
Jeff Law 7ef32a98cd Fix another missing header file for mcore libgloss
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.
2023-12-29 21:23:26 -07:00
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