Commit Graph

21478 Commits

Author SHA1 Message Date
Mike Frysinger 930bc1bdf5 libgloss: merge xc16x into top-level Makefile
Avoid a recursive make to speed things up a bit.
Untested as this target has never been merged into gcc.
2023-12-31 02:07:39 -05:00
Mike Frysinger 13a24be553 libgloss: merge microblaze into top-level Makefile
Avoid a recursive make to speed things up a bit.
A microblaze-elf build shows installed objects & libs produce same code.
2023-12-31 02:07:36 -05:00
Mike Frysinger d02e94a8f1 libgloss: microblaze: use port-specific sbrk
The default search path uses the common sbrk.c over the microblaze
one, so add a rule to force the microblaze variant instead.
2023-12-31 02:07:04 -05:00
Mike Frysinger 77ea6c9a32 libgloss: merge tic6x into top-level Makefile
Avoid a recursive make to speed things up a bit.
A tic6x-elf build shows installed objects & libs produce same code.
2023-12-31 01:49:29 -05:00
Mike Frysinger d091fe38a3 libgloss: merge sparc_leon into top-level Makefile
Avoid a recursive make to speed things up a bit.
A sparc-elf build shows installed objects & libs produce same code.
2023-12-31 01:44:51 -05:00
Mike Frysinger 1b1ed5c82f libgloss: sparc_leon: workaround newer newlib pthread APIs
Fix a compile error due to duplicate pthreads types:
.../libgloss/sparc_leon/mutex.c:50:8: error: conflicting types for ‘pthread_mutex_t’; have ‘struct pthread_mutex’
   50 |      } pthread_mutex_t;
In file included from .../newlib/libc/include/sys/types.h:221,
                 from .../libgloss/sparc_leon/mutex.c:26:
.../newlib/libc/include/sys/_pthreadtypes.h:154:20: note: previous declaration of ‘pthread_mutex_t’ with type ‘pthread_mutex_t’ {aka ‘long unsigned int’}
  154 | typedef __uint32_t pthread_mutex_t;      /* identify a mutex */

.../libgloss/sparc_leon/mutex.c:57:8: error: conflicting types for ‘pthread_mutexattr_t’; have ‘struct <anonymous>’
   57 |      } pthread_mutexattr_t;
../newlib/libc/include/sys/_pthreadtypes.h:169:3: note: previous declaration of ‘pthread_mutexattr_t’ with type ‘pthread_mutexattr_t’
  169 | } pthread_mutexattr_t;
2023-12-31 01:44:38 -05:00
Mike Frysinger 97965dfea5 libgloss: merge sparc into top-level Makefile
Avoid a recursive make to speed things up a bit.
A sparc-elf build shows installed objects & libs produce same code.
2023-12-31 01:44:38 -05:00
Mike Frysinger f37eecdedc libgloss: sparc: always install erc32 sim files
These are already compiled for all sparc targets, so we might as well
install them all the time so they can be used with the erc32 sim.
2023-12-31 01:44:16 -05:00
Mike Frysinger 9681f7fe53 libgloss: merge ft32 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A ft32-elf build shows installed objects & libs produce same code.

Mention of ft32-elf-common.ld is dropped as it has never existed
in the tree, and has been an (ignored) error in the past.
2023-12-31 01:44:16 -05:00
Mike Frysinger d206ca3887 libgloss: ft32: 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.
2023-12-31 01:44:14 -05:00
Mike Frysinger a6d07d27c9 libgloss: merge fr30 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A fr30-elf build shows installed objects & libs produce same code.

A lot of code seems like it hasn't been migrated, but that's because
it's all disabled/unused (i.e. all the test & mon code).  It looks
like a lot of copy & paste holdovers from the original port.
2023-12-31 01:44:14 -05:00
Mike Frysinger a9a7312fa6 libgloss: merge or1k into top-level Makefile
Avoid a recursive make to speed things up a bit.
A or1k-elf build shows installed objects & libs produce same code.
2023-12-31 01:44:12 -05:00
Mike Frysinger 89d8c49036 libgloss: merge epiphany into top-level Makefile
Avoid a recursive make to speed things up a bit.
A epiphany-elf build shows installed objects & libs produce same code.
2023-12-31 01:44:10 -05:00
Mike Frysinger b9dc98d3f4 libgloss: xtensa: fix CPPFLAGS clobbering
No sub-Makefile.inc file should ever set CPPFLAGS directly.  That is
a global/common variable.  Instead, ports should set the per-target
CPPFLAGS to include what they need.

Further, per-target CPPFLAGS should respect $(AM_CPPFLAGS).
2023-12-31 01:44:06 -05:00
Mike Frysinger 9b1d4a2c83 [RFC] newlib: libc: start manual appendix to hold various ABI constants
The newlib errno values end up being exposed way beyond newlib itself,
so it can be helpful to have a reference of the names & values of them
all.  When using a GNU stack, the errno values might be shared across
all of them without any translation layers.

Consider:
* user's code
* GNU newlib (libc)
* GNU libgloss (OS bindings)
* GNU simulator (syscall handler)

When the user program tries to open a file that doesn't exist, it will
call through newlib -> libgloss -> sim.  How is the error code handled ?
The user program relies on newlib's ENOENT constant.  If newlib & libgloss
don't agree on this value, then libgloss has to maintain a mapping of the
different constants {"EAGAIN", NEWLIB_EAGAIN, LIBGLOSS_EAGAIN}.  No one
does this of course -- libgloss just uses newlib's values directly.  If
libgloss & the OS don't agree on this value, then libgloss again has to
maintain a mapping of {"EAGAIN", NEWLIB_EAGAIN, OS_EAGAIN}.  No one does
this with the GNU simulator -- it returns newlib's values directly.  The
simulator definitely has to maintain a mapping of the target's EAGAIN
values and whatever OS it is running on.  Having this be documented all
the way down is important so people writing simulator ports know what
values to use.

People implementing a minimal bootloader environment can easily be in the
same boat -- they are trying to glue one world (e.g. Das U-Boot's machine
independent API runtime) with another world (e.g. libgloss), and that will
need to maintain the mapping of values in order for the programs to run
unmodified.

Start an appendix in the libc manual to hold these constants.  These pages
are automatically generated using the preprocessor and a script from the
GNU simulator project.  If people are amenable to this direction, I can
port that script over to newlib & strip it down, and also add a few more
appendix chapters for other important ABI constants (e.g. signals).
2023-12-31 01:44:03 -05:00
Mike Frysinger bf09d568b8 libgloss: merge visium into top-level Makefile
Avoid a recursive make to speed things up a bit.
A visium-elf build shows installed objects & libs produce same code.
2023-12-31 01:44:03 -05:00
Mike Frysinger 7eb6429d4d libgloss: visium: fix sbrk search path
The code was loading the common ../sbrk.c file rather than the visium
specific sbrk.c due to VPATH setup.  Add an explicit rule for this one
file so we make sure the correct one is used.
2023-12-31 01:43:46 -05:00
Mike Frysinger fdbef75837 libgloss: merge m32r into top-level Makefile
Avoid a recursive make to speed things up a bit.
A m32r-elf build shows installed objects & libs produce same code.
2023-12-31 01:43:46 -05:00
Mike Frysinger 4745e6e0b3 libgloss: merge rl78 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A rl78-elf build shows installed objects & libs produce same code.
2023-12-31 01:43:43 -05:00
Mike Frysinger 922be0e27a 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.
2023-12-31 01:43:38 -05:00
Mike Frysinger a542db4dfb 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.
2023-12-31 01:43:21 -05:00
Mike Frysinger ac271d7471 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.
2023-12-31 01:42:55 -05:00
Mike Frysinger b188e79773 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.
2023-12-31 01:42:53 -05:00
Mike Frysinger e575fe9176 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.
2023-12-31 01:42:51 -05:00
Mike Frysinger c76c963320 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.
2023-12-31 01:42:49 -05:00
Mike Frysinger b439dda4df 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.
2023-12-31 01:42:47 -05:00
Mike Frysinger 207914637a 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.
2023-12-31 01:42:44 -05:00
Mike Frysinger 39b4a2bd06 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.
2023-12-31 01:42:40 -05:00
Mike Frysinger b24d6278ba 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.
2023-12-31 01:42:37 -05:00
Mike Frysinger ef9cbcad29 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.
2023-12-31 01:42:37 -05:00
Mike Frysinger 466514c020 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.
2023-12-31 01:42:37 -05:00
Mike Frysinger 025679996d 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").
2023-12-31 01:42:37 -05:00
Mike Frysinger 6f6d67a012 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.
2023-12-31 01:42:37 -05:00
Mike Frysinger 79ae6461b8 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.
2023-12-31 01:42:30 -05:00
Mike Frysinger 233230b1e1 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.
2023-12-31 01:42:28 -05:00
Mike Frysinger 42f5917f00 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.
2023-12-29 21:14:56 -05:00
Mike Frysinger f1055d1a84 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.
2023-12-29 21:14:56 -05:00
Mike Frysinger 616db3e80c 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.
2023-12-29 21:14:56 -05:00
Mike Frysinger 6a1b0abc3d 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.
2023-12-29 21:14:55 -05:00
Mike Frysinger 83da562c52 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.
2023-12-29 21:08:59 -05:00
Mike Frysinger 01f6c45f07 libgloss: doc: unify duplicate copyright/license content
Use @copying & @insertcopying directives to define the copyright &
license block only once, and then inserted at the same places as it
was before.
2023-12-29 21:08:59 -05:00
Mike Frysinger acbd70eab3 libgloss: doc: fix dir info entry usage
Wrapping the dir info with @ifnottex means it's included in all other
outputs like html which makes no sense.  Switch to @direntry which is
specific for this content and is automatically written to the output
that makes sense, and omitted from the rest.
2023-12-29 21:08:59 -05:00
Mike Frysinger ce02b2abc3 libgloss: fix up incorrect "it's" 2023-12-29 21:08:59 -05: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
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