Commit Graph

794 Commits

Author SHA1 Message Date
Mike Frysinger 4d9808d404 libgloss: start a MAINTAINERS file 2024-01-24 17:15:35 -05:00
Mike Frysinger 752489c76e libgloss: merge cr16 into top-level Makefile
Avoid a recursive make to speed things up a bit.
A cr16-elf build shows installed objects & libs produce same code.

The test targets were dropped as they didn't actually work -- there
is no test.o rule in here.
2024-01-23 08:19:54 -05:00
Dimitar Dimitrov 276dd12f69 libgloss: pru: Trim crt0-minrt.o
Strip a few more instructions from crt0-minrt.S:
  - Remove "halt" and rely on the infinite loop after main()'s return.
  - Remove main()'s argc and argv argument initialization.  Host loader
    does not set them, and typical firmware does not use them, either.
  - Remove the __dso_handle symbol.

This should be safe because the default crt0.S is fully standards
compliant.  Whereas crt0-minrt.S has been documented from the beginning
to intentionally miss features in order to reduce firmware size, while
still enabling typical PRU firmware to operate.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-01-23 09:49:02 +01:00
Dimitar Dimitrov d5c4edca81 libgloss: merge pru into top-level Makefile
Avoid a recursive make to speed things up a bit.  This change was
inspired by the recent similar patch for c6x:
https://sourceware.org/pipermail/newlib/2023/020869.html

While at it, fork crt0-minrt.S into a separate source file instead of
relying on a predefined macro to generate two different object files.
This improves clarity, simplifies the build rules, and would allow
further optimization in crt0-minrt.S to be implemented more cleanly.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-01-23 09:49:02 +01:00
Mike Frysinger 5a8c23a73a 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.
2024-01-22 20:41:22 -05:00
Mike Frysinger fd4e96f1af 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.
2024-01-22 20:41:22 -05:00
Mike Frysinger 40b1b5c7a9 libgloss: xc16x: drop old stub port
First off, afaict, xc16x support has never been merged into gcc.
Upstream merge isn't strictly required for new ports, but it seems
like people should merge eventually in some shape, and considering
the libgloss port was merged in 2009, ~14 years seems like plenty
of leeway.  Which is to say, no one else can seem to build this
which makes updating & testing things very difficult.

Ignoring that, from what I can tell, this port has only ever built
and installed a crt0.o file.  It defines libeval.a & libcygmon.a
targets, but nothing depends on them.  The SCRIPTS & BSP variables
are always empty.  The original port merge define these in the
configure script as substitutes, but never set the vars, so they
were always replaced with nothing.

I actually broke this build 2 years ago when merging the configure
up a level in commit 30f244155b
("libgloss: merge subdirs that have unique makefile_frags up a
level").  I saw that it was exporting a bunch of vars in the
configure script, but never set them, so I incorrectly assumed
they weren't used.  Which means the Makefile has been setting them
to invalid values like literal @bsp_list@ and @script_list@.

Considering no one has complained, I have to assume no one cares
about this port, and we can all stop wasting time on it.
2024-01-19 22:47:00 -05:00
Mike Frysinger 2f0cd375f3 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.
2024-01-19 22:23:48 -05:00
Mike Frysinger fecb0e5e78 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger ae46a835fe 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger 7ba23b6825 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger 9b35bf859a 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;
2024-01-19 22:23:47 -05:00
Mike Frysinger 74674f2cc8 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger 50e0b04fbe 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger 026422b030 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger 3ecd983a7d 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger ad17cf6d67 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger 8c5bb84b6b 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger 22257fc681 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.
2024-01-19 22:23:47 -05:00
Mike Frysinger bf37122a72 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).
2024-01-19 22:23:47 -05:00
Mike Frysinger 770dd85aaf 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.
2024-01-19 20:26:52 -05:00
Mike Frysinger 5798c3bbc7 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.
2024-01-19 20:26:52 -05:00
Mike Frysinger af075aed1d 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.
2024-01-19 20:26:52 -05:00
Mike Frysinger 4172a3c618 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.
2024-01-19 20:26:52 -05:00
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
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
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
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
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