aboutsummaryrefslogtreecommitdiff
path: root/libgloss/riscv
AgeCommit message (Collapse)AuthorFilesLines
2024-01-10RISC-V: fix setting up std streams in init_semihosting()Venkata Ramanaiah Nalamothu1-9/+10
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-08RISC-V: Initialize the jvt CSRHau Hsu1-0/+11
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: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/2d770815dc9a8b11e61ea1abd487cb25ee56ad5e/riscv-elf.adoc#table-jump-relaxation
2023-12-04RISC-V: Fix -Wint-conversion warningKito Cheng1-1/+5
Upstream GCC has change this warning into error by default, so...we need to explicitly convert the type from pointer from/to integer, generally it's unsafe, but we know what we are doing here. However it's not safe for ilp32 on RV64, but we didn't support that yet, so I think this fix is good enough now :)
2023-11-29RISC-V: Fix timeval conversion in _gettimeofday()Kuan-Wei Chiu1-1/+1
Replace multiplication with division for microseconds calculation from nanoseconds in _gettimeofday function. Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
2023-09-18Bring back libsim.a for riscvAlexey Lapshin1-0/+4
2022-10-20libgloss: riscv: Install machine/syscall.hSimon Cook1-0/+3
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-08-26libgloss: riscv: Convert to non-recursive automakePalmer Dabbelt2-330/+71
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-01-26libgloss: merge stub arch configure scripts up a levelMike Frysinger4-4182/+3
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-14require autoconf-2.69 exactlyMike Frysinger2-19/+6
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-10libgloss: hardcode AC_CONFIG_AUX_DIR pathMike Frysinger2-55/+5
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.
2021-11-06libgloss: regenerate aclocal.m4 & configure w/newer versionsMike Frysinger2-159/+815
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-10-27libgloss/riscv: Fix hard coded reference to configure.in after renameLewis Revill1-1/+1
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-09-13libgloss/newlib: rename configure.in to configure.acMike Frysinger1-0/+0
The .in name has been deprecated for a long time in favor of .ac.
2021-08-04RISC-V: Reliably initialize t0 in _times()Christoph Muellner1-4/+9
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-04-13RISC-V: Using SYS_clock_gettime64 for rv32 libgloss.Kito Cheng2-0/+22
- 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-02-05RISC-V: Use __bss_start for the starting point of .bss.Yeting Kuo1-1/+1
It's more flexible for the positions of .bss and .data.
2020-12-16RISC-V: Add semihosting supportCraig Blackmore21-1/+692
2020-02-11Only pass the minimum number of syscall argumentsGeorg Sauthoff18-29/+48
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-01-31RISC-V: Use newlib nano specific libm.Jim Wilson1-1/+1
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>
2019-05-22RISC-V: Add _LITE_EXIT in crt0.S.Jim Wilson1-0/+13
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.
2018-08-29RISC-V: Fix _sbrk, it's failed only when return value is -1.Denis Ivanov2-7/+12
Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
2018-08-29RISC-V: Fixed return code in _times syscall.Denis Ivanov1-2/+2
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-07-30RISC-V: Do not use _init/_finiSebastian Huber1-11/+0
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-01-18RISC-V: isatty: return 0 on errorChih-Mao Chen1-1/+1
2017-12-26RISC-V: Add gdb sim and newlib nano support. Fix a few misc minor bugs.Jim Wilson4-6/+111
2017-12-26RISC-V: Moved syscalls to separate files to fix aliasing problems.Jim Wilson37-450/+513
2017-12-26RISC-V: Updated syscall to take 6 argumentsJim Wilson2-22/+26
2017-12-26RISC-V: Add nanosleep functionalityJim Wilson2-0/+13
2017-08-21Change license to FreeBSD License for RISC-VKito Cheng3-3/+3
- 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-17Add RISC-V port for libglossnewlib-snapshot-20170818Kito Cheng7-0/+4332
Contributor list: - Andrew Waterman <andrew@sifive.com> - Palmer Dabbelt <palmer@dabbelt.com> - Kito Cheng <kito.cheng@gmail.com> - Alex Suykov <alex.suykov@gmail.com>