Commit Graph

25 Commits

Author SHA1 Message Date
Simon Cook 8c87ffd372 libgloss: riscv: Install machine/syscall.h
A recent change to the Makefile.in for riscv resulted in the
machine/syscall.h header not being installed. This updates the file
to install this file again.

Signed-off-by: Simon Cook <simon.cook@embecosm.com>
2022-10-20 16:53:06 +02:00
Palmer Dabbelt f59ff93046 libgloss: riscv: Convert to non-recursive automake
PR 29515 points out our documentation builds are broken, let's just move
over to the new non-recursive builds.

Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
2022-08-26 16:47:48 +02:00
Mike Frysinger 754f8def0d libgloss: merge stub arch configure scripts up a level
For about half the ports, we don't need a subdir configure script.
They're using the config/default.m[ht] rules, and they aren't doing
any unique configure tests, so they exist just to pass top-level
settings down to create the arch Makefile.  We can just as easily
do that from the top-level Mkaefile directly and skip configure.

Most of the remaining configure scripts could be migrated up to
the top-level too, but that would require care in each subdir.
So let's be lazy and put that off to another day.
2022-01-26 04:32:54 -05:00
Mike Frysinger a100e80fc9 require autoconf-2.69 exactly
The newlib & libgloss dirs are already generated using autoconf-2.69.
To avoid merging new code and/or accidental regeneration using diff
versions, leverage config/override.m4 to pin to 2.69 exactly.  This
matches what gcc/binutils/gdb are already doing.

The README file already says to use autoconf-2.69.

To accomplish this, it's just as simple as adding -I flags to the
top-level config/ dir when running aclocal.  This is because the
override.m4 file overrides AC_INIT to first require the specific
autoconf version before calling the real AC_INIT.
2022-01-14 15:24:33 -05:00
Mike Frysinger 7f8fa1de4f libgloss: hardcode AC_CONFIG_AUX_DIR path
In order to transition to automake, we have to use hardcoded paths in
the AC_CONFIG_AUX_DIR macro call (since automake evaluates the path
itself, and doesn't expand vars), so simplify all the calls here.
2022-01-10 19:50:35 -05:00
Mike Frysinger 873da400e0 libgloss: regenerate aclocal.m4 & configure w/newer versions
Regenerate the files using automake-1.15 & autoconf-2.69 to match the
binutils/gdb/gcc projects.  Ran:

libgloss $ find -name configure.ac -printf '%h\n' | while read d; do
  (cd $d; export WANT_AUTOCONF=2.69 WANT_AUTOMAKE=1.15;
   aclocal-1.15 -I.. && autoconf-2.69); done
2021-11-06 14:14:50 -04:00
Lewis Revill 92e488d5b8 libgloss/riscv: Fix hard coded reference to configure.in after rename
The file configure.in was renamed to configure.ac in libgloss/riscv but
the hard coded name in the Makefile for that directory was not updated.
This patch simply renamed this to configure.ac.
2021-10-27 17:44:48 +02:00
Mike Frysinger 920617998e libgloss/newlib: rename configure.in to configure.ac
The .in name has been deprecated for a long time in favor of .ac.
2021-09-13 10:14:37 -04:00
Christoph Muellner 0cb40f415b RISC-V: Reliably initialize t0 in _times()
The current implementation does not reliably initialize t0 once.
Additionally the initialization requires two calls to _gettimeofday().
Let's sacrifice a byte to keep the initialization status
and reduce the maximum number of calls to _gettimeofday().

This has caused issues in an application that invokes clock().
The problematic situation is as follows:

1) The program calls clock() which calls _times().
2) _gettimeofday(&t0, 0) puts 0 in t0.tv_usec (because less than 1 us has
   elapsed since the beginning of time).
3) _gettimeofday(&t, 0) puts 1 in t.tv_usec (since now more than 1 us has
   elapsed since the beginning of time).
4) That call to clock() returns 1 (the value from step 3 minus the value in
   step 2).
5) The program does a second call to clock().
6) The code above still sees 0 in t0 so it tries to update t0 again and
   _gettimeofday(&t0, 0) puts 1 in t0.tv_usec.
7) The _gettimeofday(&t, 0) puts 1 in t.tv_usec (since less than 1us has
   elapsed since step 3).
8) clock() returns 0 (step 7 minus step 6) and indicates that time is
   moving backwards.

Signed-off-by: Christoph Muellner <cmuellner@gcc.gnu.org>
2021-08-04 11:44:33 +02:00
Kito Cheng 20d0081998 RISC-V: Using SYS_clock_gettime64 for rv32 libgloss.
- RISC-V 32 bits linux/glibc didn't provide gettimeofday anymore
   after upstream, because RV32 didn't have backward compatible issue,
   so RV32 only support 64 bits time related system call.

 - So using clock_gettime64 call instead for rv32 libgloss.
2021-04-13 12:54:49 +02:00
Yeting Kuo 6aa0ab1c5d RISC-V: Use __bss_start for the starting point of .bss.
It's more flexible for the positions of .bss and .data.
2021-02-05 10:29:21 +01:00
Craig Blackmore 865cd30dcc RISC-V: Add semihosting support 2020-12-16 16:40:34 -05:00
Georg Sauthoff 9b51beeb2a Only pass the minimum number of syscall arguments
Previously, __internal_syscall() compiled into asm-code that unconditionally
sets the syscall argument registers a0 to a5.

For example, the instruction sequence for a exit syscall looked like
this:

    li    a0, 1   # in ther caller of exit()
    # ...         # in newlib:
    li    a1, 0   # unused arguments
    li    a2, 0
    li    a3, 0
    li    a4, 0
    li    a5, 0
    li    a7, 93  # exit syscall number

(i.e. the binary contains then 5 superfluous instructions for this
one argument syscall)

This commit changes the RISC-V syscall code such that only the required
syscall argument registers are set.

GCC detects that argc is known at compile time and thus evaluates all the
if-statements where argc is used at compile time (tested with -O2 and -Os).
2020-02-11 09:41:52 +01:00
Jim Wilson 8ef32f2dcf RISC-V: Use newlib nano specific libm.
The libm gamma functions use the _gamma_signgam field of the reentrant
structure, which changes offset with the --enable-newlib-reent-small
configure option, which means we need to use a newlib nano specific
version of libm in addition to libc in the nano.specs file.  Reported
by Keith Packard.  There is a riscv-gnu-toolchain patch that goes
along with this to create the new libm_nano.a file.

Signed-off-by: Jim Wilson <jimw@sifive.com>
2020-01-31 12:42:52 +01:00
Jim Wilson 77ac27dcf8 RISC-V: Add _LITE_EXIT in crt0.S.
This patch adds _LITE_EXIT in crt0.S to enable "lite exit" technique in
RISC-V. The changes have been tested in riscv/riscv-gnu-toolchain by
riscv-dejagnu with riscv-sim.exp/riscv-sim-nano.exp.
2019-05-22 17:41:25 -07:00
Denis Ivanov 9e032fd939 RISC-V: Fix _sbrk, it's failed only when return value is -1.
Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
2018-08-29 15:49:00 +02:00
Denis Ivanov 258996b696 RISC-V: Fixed return code in _times syscall.
Upon successful completion, times() shall return the elapsed real time,
in clock ticks, since an arbitrary point in the past (for example,
system start-up time).

Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
2018-08-29 15:49:00 +02:00
Sebastian Huber 6158b30e3e RISC-V: Do not use _init/_fini
Introduce new host configuration variable "have_init_fini" which is set
to "yes" by default.  Override it for RISC-V to "no".

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2018-07-30 10:47:57 +02:00
Chih-Mao Chen f2c9e55faf RISC-V: isatty: return 0 on error 2018-01-18 09:21:10 +01:00
Jim Wilson 9588ff7555 RISC-V: Add gdb sim and newlib nano support. Fix a few misc minor bugs. 2017-12-26 12:31:33 -08:00
Jim Wilson 28d5b98038 RISC-V: Moved syscalls to separate files to fix aliasing problems. 2017-12-26 12:27:52 -08:00
Jim Wilson 347b083911 RISC-V: Updated syscall to take 6 arguments 2017-12-26 12:26:19 -08:00
Jim Wilson a6633677b9 RISC-V: Add nanosleep functionality 2017-12-26 12:24:45 -08:00
Kito Cheng 6864c08b94 Change license to FreeBSD License for RISC-V
- For prevent confuse about what BSD license variant we used, 2- or
   3-clause license, we change the license to FreeBSD license to make
   it unambiguously refers to the 2-clause license.
2017-08-21 11:08:54 +02:00
Kito Cheng c496cbb6bd Add RISC-V port for libgloss
Contributor list:
    - Andrew Waterman  <andrew@sifive.com>
    - Palmer Dabbelt  <palmer@dabbelt.com>
    - Kito Cheng  <kito.cheng@gmail.com>
    - Alex Suykov  <alex.suykov@gmail.com>
2017-08-17 14:51:05 -04:00