aboutsummaryrefslogtreecommitdiff
path: root/libgloss
AgeCommit message (Collapse)AuthorFilesLines
2019-07-23Stack Pointer and Stack Limit initialization refactored.Alexander Fedotov2-89/+227
SP initialization changes: 1. set default value in semihosting case as well 2. moved existing SP & SL init code for processor modes in separate routine and made it as "hook" 3. init SP for processor modes in Thumb mode as well Add new macro FN_RETURN, FN_EH_START and FN_EH_END.
2019-06-25Arm: Use lrdimon-v2m_nano when semihosting v2 and nano selected respectivelyAlexander Fedotov1-1/+1
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.
2019-05-15Make .data section placement coincide with _fdata symbolFaraz Shahbazker22-0/+22
The _fdata symbol in MIPS linker scripts is aligned to a 16-byte boundary. The ALIGN function does not implicitly update current location counter. If sections positioned after the assignment do not have the same natural alignment as the ALIGN function then the start of the section group will not coincide with the value of the symbol. Given the linker command sequence: symbol = ALIGN (NN); (.section*) where the idiom implies a desire to mark the beginning of .section with symbol, there must be an assignment to the location counter between the assignment to symbol and the .section pattern. libgloss/ * mips/array.ld: Update the location counter to match _fdata. * mips/cfe.ld: Likewise. * mips/ddb-kseg0.ld: Likewise. * mips/ddb.ld: Likewise. * mips/dve.ld: Likewise. * mips/idt.ld: Likewise. * mips/idt32.ld: Likewise. * mips/idt64.ld: Likewise. * mips/idtecoff.ld: Likewise. * mips/jmr3904app-java.ld: Likewise. * mips/jmr3904app.ld: Likewise. * mips/jmr3904dram-java.ld: Likewise. * mips/jmr3904dram.ld: Likewise. * mips/lsi.ld: Likewise. * mips/mti32.ld: Likewise. * mips/mti64.ld: Likewise. * mips/mti64_64.ld: Likewise. * mips/mti64_n32.ld: Likewise. * mips/nullmon.ld: Likewise. * mips/pmon.ld: Likewise. * mips/sde32.ld: Likewise. * mips/sde64.ld: Likewise.
2019-04-29Fix order of eh_frame sections in linker scriptsFaraz Shahbazker18-18/+118
The compiler driver positions the linker script at the end of the linker command-line, after crtend.o. As a result, any INPUT objects and archive GROUPs introduced by the linker script are placed after crtend.o and the end-of-frame marker provided by crtend.o ends up in between .eh_frames instead of being at the end. This has always been a problem, but a binutils update to clean-up redundant NULL markers in .eh_frame exposes it as a execution failure in exception-handling tests. This patch re-orders .eh_frames in all MIPS linker scripts so that the one from crtend.o is always placed last. libgloss/ * mips/array.ld: Re-order to place .eh_frame from crtend.o after all other .eh_frame sections. * mips/cfe.ld: Likewise. * mips/ddb-kseg0.ld: Likewise. * mips/ddb.ld: Likewise. * mips/dve.ld: Likewise. * mips/idt.ld: Likewise. * mips/idt32.ld: Likewise. * mips/idt64.ld: Likewise. * mips/jmr3904app.ld: Likewise. * mips/lsi.ld: Likewise. * mips/mti32.ld: Likewise. * mips/mti64.ld: Likewise. * mips/mti64_64.ld: Likewise. * mips/mti64_n32.ld: Likewise. * mips/nullmon.ld: Likewise. * mips/pmon.ld: Likewise. * mips/sde32.ld: Likewise. * mips/sde64.ld: Likewise.
2019-04-18MSP430: Make the inclusion of run_*_array fns depend on defined assembler ↵Jozef Lawrynowicz3-22/+74
symbols Many of the MSP430 crt functions (e.g. to initialize bss) are linked "dynamically", based on symbols defined in the program. The GNU assembler defines the symbols corresponding to the crt functions by examining the section names in the input file. If GCC has been configured with --enable-initfini-array, then .init_array and .fini_array will hold pointers to global constructors/destructors. These sections can also hold functions that need to be executed for other purposes. The attached patch puts the __crt0_run_{preinit,init,fini}_array and __crt0_run_array functions in their own object files, so they will only be linked when needed. Successfully regtested the DejaGNU GCC testsuite using the binutils and newlib changes together with GCC trunk configured with --enable-initfini-array.
2019-04-16Fix incorrect assembly code in _msp430_run_arrayJozef Lawrynowicz1-2/+2
2019-04-15Fix definition of write() to use const char * for the type of the bufferJozef Lawrynowicz1-4/+5
2019-04-12Align comments and spaces in libgloss/arm/crt0.S and ↵Alexander Fedotov1-67/+68
newlib/libc/sys/arm/crt0.S to ease further code alignment.
2019-04-11Include code in trap.S for APCS only.Christophe Lyon1-1/+1
The code in trap.S is to support the old APCS chunked stack variant, which dates back to the Acorn days, so put it under #ifndef __ARM_EABI__. * libgloss/arm/trap.S: Use __ARM_EABI rather than PREFER_THUMB. * newlib/libc/sys/arm/trap.S: Use __ARM_EABI rather than __thumb2__.
2019-04-03Add a dummy interrupt handler to nios2 crt0.s.Sandra Loosemore1-1/+13
The location of the handler at offset 0x20 from the start of memory, immediately after the 32-byte reset vector, matches the expectations of real hardware (e.g., a 3c120 board).
2019-03-14Add semihosting docs for nios2 and m68kcygwin-3_0_4-releaseJeff Johnston2-0/+411
Author: Sandra Loosemore <sandra@codesourcery.com> Date: Wed Mar 13 20:22:16 2019 -0700 Add semihosting documentation for nios2 and m68k. QEMU maintainers have asked for a specification of the nios2 semihosting interface. Since it's essentially a copy of the m68k implementation, this patch adds a document for that target as well.
2019-02-11AArch32: Fix the build for M class semihostingTamar Christina1-1/+3
The M class cores don't support Semihosting v2 mixed mode, but we were accidentally using the new immediates for it. My last patch changed the immediates which broke the build because doing a full multi-lib build including M architectures now results in an assembler error instead of silently doing the wrong thing. This fixes the issue by changing the defines around such that According to the specs any M class build uses the normal semihosting instructions. Regtested on arm-none-eabi and no issues, using a build with m class multilibs too.
2019-02-08AArch32: Add support for HLT to Mixed Mode modelsTamar Christina2-7/+13
The Semihosting v2 protocol requires us to output the Armv8-a HLT instruction when in mixed mode (SEMIHOST_V2_MIXED_MODE), however it also requires this to be done for Armv7-a and earlier architectures. The HLT instruction is defined in the undefined encoding space for older architectures but simulators such as QEMU already trap on it [1] for all architectures and is a requirement for semihosting v2 [2]. Unfortunately the GAS restricts the use of HLT to Armv8-a which requires us to use the instruction encodings we want directly in crt0. This patch does this, I have not updated newlib/libc/* as that is quite out of date already. A proper sync is needed in order to get things back in sync. A different patch for this would be best. [1] https://github.com/qemu/qemu/commit/19a6e31c9d2701ef648b70ddcfc3bf64cec8c37e [2] https://developer.arm.com/docs/100863/latest/the-semihosting-interface
2018-11-20Add libgloss install-pdf and install-html targets.Jim Wilson2-1/+30
The toplevel makefile used by binutils/gcc/newlib/etc has install-pdf and install-html targets, but they fail because libgloss doesn't support them. Tested with an arm-eabi combined tree build and install, and verifying that the install-pdf and install-html targets now work, and that the pdf and html doc files are now in the install tree. libgloss/ * Makefile.in (install-html, install-pdf): New. * doc/Makefile.in (htmldir, pdfdir): New. (porting.ps): Delete white space on blank line. (install-pdf, install-html): New.
2018-11-19Enable return code with semi-hosting SYS_EXIT_EXTENDEDMatthew Malcomson2-22/+20
The _exit function currently passes -1 as a "sig" to the _kill function as an invalid signal number so that _kill can distinguish between an abort and a standard exit. For boards using the SYS_EXIT_EXTENDED semi-hosting operation to return a status code, this means that the "status" paramter to _exit is ignored and the return code is always -1. https://developer.arm.com/docs/100863/latest/semihosting-operations/sys_exit_extended-0x20 This patch puts shared code between _kill and _exit into a new function _kill_shared that takes the semi-hosting "reason" to use (if semi-hosting is available) as an argument. For semi-hosting _kill_shared provides that "reason". Without the "sig" argument being used to distinguish between a normal and abnormal exit, the _exit function can provide the return code to be used if the SYS_EXIT_EXTENDED operation is available. Hence the exit code can be returned.
2018-10-31Initialize SVE system registers.Tamar Christina1-0/+27
This patch initializes the SVE system registers if available and initializes the vector length to the maximum supported. This is done according to the SVE specification [1]. [1] https://developer.arm.com/docs/ddi0584/latest/arm-architecture-reference-manual-supplement-the-scalable-vector-extension-sve-for-armv8-a
2018-10-08[Aarch64] Syscalls: fix prototypesChristophe Lyon1-18/+19
This patch is similar the arm one committed recently. 2018-10-08 Christophe Lyon <christophe.lyon@linaro.org> * libgloss/aarch64/syscalls.c (_sbrk): Fix prototype. (_getpid, _write, _swiwrite, _lseek, _swilseek, _read, _wriread): Likewise.
2018-10-08[ARM] Make _kill() a noreturn function.Christophe Lyon2-4/+6
AngelSWI_Reason_ReportException does not return accoring to the ARM documentation, so it is valid to mark _kill() as noreturn. This way, the compiler does not warn about _exit() returning a value despite being noreturn. 2018-10-01 Christophe Lyon <christophe.lyon@linaro.org> * libgloss/arm/_exit.c (_exit): Declare _kill() as noreturn. * libgloss/arm/_exit.c (_kill): Likewise. Remove the return statements. * newlib/libc/sys/arm/syscalls.c (_kill): Likewise..
2018-10-05 [Aarch64] Fix warning in _sbrkChristophe Lyon1-1/+1
2018-10-01 Christophe Lyon <christophe.lyon@linaro.org> * libgloss/aarch64/syscalls.c (_sbrk): Cast "__heap_limit" to "char *".
2018-09-13Committed, CRIS port: fix fallout from time_t defaulting to 64 bits, part 1Hans-Peter Nilsson2-5/+21
It's been a while... I see the CRIS port broke with the time_t-default-to-64-bit change, observable by a few test-cases in the gcc fortran(!) tests failing, regressing when trying a recent newlib. This is a two-part belt-and-suspenders change: adjust the CRIS port gettimeofday syscall (the only one in newlib/CRIS passing a time_t or struct timeval) to handle a userspace 64-bit time_t and secondly default time_t to 32-bit long anyway. I considered making the local "kernel_timeval" copy in _gettimeofday conditional on (userspace) time_t being 64 bits, but thought it not worth bothering with the few move insns. The effect of a 64-bit time_t is however observable as longer simulation time when running the gcc testsuite and as bigger binaries without any actual upside from the larger time_t size, so I thought better make the default for this port go back to being a "long" again. Tested by running the gcc testsuite over the three combinations of two parts of the patch and observing the expected changes. Committed. libgloss: Adjust for syscall and userspace having different time_t or timeval. * cris/linunistd.h (kernel_time_t, kernel_suseconds_t, kernel_timeval): New types. (gettimeofday): Change the type of the first argument to be a pointer to a struct kernel_timeval. * cris/gensyscalls (_gettimeofday): Use an intermediate struct kernel_timeval for the syscall and initialize the result from that. Signed-off-by: Hans-Peter Nilsson <hp@axis.com>
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-08-08Add BSP and semihosting library for nios2-generic-nommu QEMU emulation.Sandra Loosemore28-0/+5848
2018-08-01Patch from Richard Earnshaw <Richard.Earnshaw@arm.com>newlib-snapshot-20180802Jeff Johnston1-4/+8
* aarch64/cpu-init/rdimon-aem-el3.S (cpu_init_hook): Simplify entry/exit sequences. Add CFI unwind rules.
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-07-11Fix AArch32 semihosting SYS_EXIT call on semihosting v1.Tamar Christina1-0/+6
The current SYS_EXIT has a bug that when making the call it always uses the v2 calling convention. This is undefined behavior according to the semihosting specification: https://developer.arm.com/docs/100863/latest/semihosting-operations/sys_exit-0x18 This patch fixes it by making sure v1 passes the argument directly in the register instead of in a block. And for v2 it does the same if the v2 extension isn't supported. The sequence generated now is 12424: ebfffecd bl 11f60 <_has_ext_exit_extended> 12428: e3500000 cmp r0, #0 1242c: 11a0500d movne r5, sp 12430: 059d5000 ldreq r5, [sp] 12434: e1a00004 mov r0, r4 12438: e1a01005 mov r1, r5 1243c: ef00f000 svc 0x0000f000 Signed-off-by: Tamar Christina <tamar.christina@arm.com>
2018-05-03libgloss: microblaze: adjust handlers to be weak.Ben Levinsky2-2/+4
Previously, hw exception handler stub and interrupt handler stub for microbaze were unable to be overwritten. Change to weak to fix this. Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
2018-02-16add forward declaration to main() to prevent warningsJaap de Wolff1-0/+2
2018-02-16adapt prototypes arm/syscalls.c to usual prototypes, and do not rely on ↵Jaap de Wolff1-48/+49
implicit conversions
2018-01-18RISC-V: isatty: return 0 on errorChih-Mao Chen1-1/+1
2018-01-17ansification: remove _HAVE_STDCYaakov Selkowitz1-4/+0
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _EXFUN, _EXFUN_NOTHROWYaakov Selkowitz5-6/+6
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _DEFUNYaakov Selkowitz107-233/+118
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _VOIDYaakov Selkowitz2-2/+2
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _DEFUN_VOIDYaakov Selkowitz4-7/+7
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _PARAMSYaakov Selkowitz8-73/+73
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _NOARGSYaakov Selkowitz3-3/+3
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17ansification: remove _ANDYaakov Selkowitz64-85/+85
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
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-12-26RISC-V: Fix libnosys build.Jim Wilson2-0/+4
2017-10-24Fixed semihosting for AArch64 when heapinfo parameters are not provided by ↵Alexander Fedotov2-26/+59
debugger
2017-10-09Fix multido compilation on ARMTamar Christina1-2/+2
The previous multi-build implementation was copying the config.status from the parent multilib directory when building the different semihosting variants. It did so because the configuration doesn't change. However when you use a relative path to configure it turns out that the paths inside the config.status are also relative. To fix this, the srcdir is adjusted from the initial configuration instead of copying it. Tested on aarch64-none-elf and arm-none-eabi. Signed-off-by: Tamar Christina <tamar.christina@arm.com>
2017-10-09adjust libnosys config for aarch64 to avoid linker error when switching from ↵Alexander Fedotov2-0/+4
rdimon.specs to nosys.specs
2017-08-24move ILP32 sanity check on heap base code under ARM_RDI_MONITORAlexander Fedotov-B556131-4/+5
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 Cheng9-0/+4340
Contributor list: - Andrew Waterman <andrew@sifive.com> - Palmer Dabbelt <palmer@dabbelt.com> - Kito Cheng <kito.cheng@gmail.com> - Alex Suykov <alex.suykov@gmail.com>