aboutsummaryrefslogtreecommitdiff
path: root/libgloss
AgeCommit message (Collapse)AuthorFilesLines
2021-11-06libgloss: regenerate aclocal.m4 & configure w/newer versionsMike Frysinger160-53935/+61640
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-06libgloss/newlib: update configure.ac in Makefile.in filesMike Frysinger1-4/+4
The maintainer rules refer to configure.in directly, so update that after renaming all the configure.ac files.
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-15libgloss: add missing aclocal.m4 filesMike Frysinger5-5/+1954
These subdirs were missing aclocal.m4 files pulling in macros from ../acinclude.m4 which caused some macros to not be expanded. For example, autoconf complains: configure.ac:25: error: possibly undefined macro: LIB_AC_PROG_CC If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. These were generated with aclocal-1.9 as that seems to be what was used in these dirs previously, and with whatever version of autoconf the specific subdir was using. This should minimize diffs.
2021-09-15libgloss: epiphany: rename symbol prefix cache varMike Frysinger2-14/+14
Autoconf emits a warning for this: configure.ac:75: warning: AC_CACHE_VAL(libc_symbol_prefix, ...): suspicious cache-id, must contain _cv_ to be cached Rename the variable to match the naming in libnosys/ subdir.
2021-09-15libgloss: fix AC_LANG_SOURCE warnings w/newer autoconfMike Frysinger2-8/+8
When running autoconf-2.69 in here, we get: configure.ac:57: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2503: _AC_PREPROC_IFELSE is expanded from... ../../lib/autoconf/general.m4:2518: AC_PREPROC_IFELSE is expanded from... configure.ac:57: the top level configure.ac:61: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from... ../../lib/autoconf/general.m4:2503: _AC_PREPROC_IFELSE is expanded from... ../../lib/autoconf/general.m4:2518: AC_PREPROC_IFELSE is expanded from... configure.ac:61: the top level Add AC_LANG_PROGRAM wrappings to fix these.
2021-09-13libgloss/newlib: rename configure.in to configure.acMike Frysinger54-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-07-06Fix builds on iq2000 and visiumJeff Law4-0/+4
visium and iq2000 have libgloss configure bits that reference target_makefile_frag, but it's never set. This leads to failures during the configure process and an empty libgloss/<target>/Makefile. Naturally bad things happen with an empty Makefile. This patch initializes target_makefile_frag for both targets in their configure.in files and updates the generated configure files. This fixes the build failures. I've been using it in my tester for about a week and both targets have flipped from consistently failing to consistently passing. * libgloss/visium/configure.in (target_makefile_frag): Define. * libgloss/visium/configure: Regenerated. * libgloss/iq2000/configure.in (target_makefile_frag): Define. * libgloss/iq2000/configure: Regenerated.
2021-07-05libgloss/or1k: Correct the IMMU SXE and UXE flagsStafford Horne1-10/+10
These have been defined incorrectly, as per specification and CPU implementations SXE is bit 6 and UXE is bit 7. This was noticed when tracking down our test suite mmu test failures. Test Suite: https://github.com/openrisc/or1k-tests/blob/master/native/or1k/or1k-mmu.c#L68-L72 Spec: https://raw.githubusercontent.com/openrisc/doc/master/openrisc-arch-1.3-rev1.pdf See section 8.4.8 Instruction Translation Lookaside Buffer Way y Translate Registers where these are defined. Signed-off-by: Stafford Horne <shorne@gmail.com>
2021-06-09libgloss: pru: Remove sim ld scriptDimitar Dimitrov4-289/+3
Binutils LD default linker script was recently fixed to allow memory sizes to be set via command line. Use this feature to remove the special sim linker script in libgloss. It is acceptable to require newer Binutils version here because simulator target is only used for regression testing the toolchain. Real HW targets are not affected. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2021-06-09libgloss: pru: Place sim syscalls into their own sectionsDimitar Dimitrov1-2/+2
This should help reduce final ELF size if using --gc-sections linker option. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
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-09-30libgloss: aarch64: Add support for Armv8-R AArch64Alex Coplan via Newlib4-4/+38
This patch adds support for Armv8-R AArch64. Armv8-R AArch64 has no EL3, so we don't set vbar_el3, and adjust the code to set up the MPU for Armv8-R. So build a different flavour of the startup code to support that. We also add a specs file that uses this alternative startup code which can be used with Armv8-R AArch64 models.
2020-09-25Add C-SKY port for libglossJojo R27-0/+6805
This patch contain all libgloss for C-SKY Contributor list: - Lifang Xia <lifang_xia@c-sky.com> - Jojo R <jiejie_rong@c-sky.com> - Xianmiao Qu <xianmiao_qu@c-sky.com> - Yunhai Shang <yunhai_shang@c-sky.com>
2020-09-04MSP430: Fix calculation of string length in sbrk.cJozef Lawrynowicz1-1/+1
2020-09-03MSP430: Fix message in sbrk.c printing binary characterJozef Lawrynowicz1-2/+2
The call to write() in sbrk.c was using the wrong value for the length argument, causing the NUL terminating character of the string to be printed.
2020-09-03Fix warnings when building for msp430-elfJozef Lawrynowicz1-0/+3
The MSP430 target supports both 16-bit and 20-bit size_t and intptr_t. Some implicit casts in Newlib expect these types to be "long", (a 32-bit type on MSP430) which causes warnings during compilation such as: "cast from pointer to integer of different size"
2020-08-07MSP430: Increase the amount of main memory available in sim ld scriptsJozef Lawrynowicz2-2/+2
The main memory region of the GDB simulator ends at address 0xFFBF, but the simulator linker scripts do not make full use of this available memory. >From 61f3d212741acee583e21ff2c2808775584ecad6 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz <jozef.l@mittosystems.com> Date: Mon, 3 Aug 2020 19:38:23 +0100 Subject: [PATCH 2/2] MSP430: Increase the amount of main memory available in sim ld scripts The main memory region of the GDB simulator ends at address 0xFFBF, but the simulator linker scripts do not make full use of this available memory.
2020-08-07MSP430: Word align __*_array_start symbols in sim linker scriptsJozef Lawrynowicz2-0/+7
__{preinit,init,fini}_array_start symbols must be word aligned in linker scripts. If the section preceding the __*_array_start symbol has an odd size, then a NULL byte will be present between the start symbol and the .*_array section itself, when the section gets automatically word-aligned. This results in a branch to an invalid address when the CRT startup code tries to run through the functions listed in the array sections. >From de115144d05ecbaa82c9c737cc261715ca4b7d67 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz <jozef.l@mittosystems.com> Date: Mon, 3 Aug 2020 19:09:46 +0100 Subject: [PATCH 1/2] MSP430: Word align __*_array_start symbols in sim linker scripts __{preinit,init,fini}_array_start symbols must be word aligned in linker scripts. If the section preceding the __*_array_start symbol has an odd size, then a NULL byte will be present between the start symbol and the .*_array section itself, when the section gets automatically word-aligned. This results in a branch to an invalid address when the CRT startup code tries to run through the functions listed in the array sections.
2020-07-02pru: Fix memory corruption on syscall returnDimitar Dimitrov1-0/+1
In the initial code I missed one level of pointer indirection. Instead of storing errno in impure_data, _impure_ptr was corrupted. Only simulator is impacted. Real targets have no OS and no syscalls. This resolves a bunch of stdio cases from the GCC testsuite: FAIL->PASS: gcc.c-torture/execute/printf-2.c -O0 execution test Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2020-03-02arm: Finish moving newlib to unified syntax for Thumb1Richard Earnshaw1-0/+11
Most code in newlib already uses unified syntax, but just a couple of laggards remain. This patch removes these and means the the entire code base has now been converted.
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-02-06libgloss: Fix lseek semihosting bug on nios2 and m68kSandra Loosemore2-2/+2
When off_t is 32 bits, the value needs to be sign-extended to 64 bits before shifting right to extract the high-order word. Previously negative offsets were incorrectly encoded. Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
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>
2020-01-29Use remove-advertising-clause script to edit BSD licensesKeith Packard7-19/+7
This edits licenses held by Berkeley and NetBSD, both of which have removed the advertising requirement from their licenses. Signed-off-by: Keith Packard <keithp@keithp.com>
2019-12-16MSP430: Support new msp430-elfbare targetJozef Lawrynowicz2-2/+2
Update the target triplet glob used when configuring for msp430 to support a new msp430-elfbare target being added to gcc.
2019-12-14Implement the unlink system call for the moxie simulator.Anthony Green1-2/+2
Corresponding support for this was just added to the gdb moxie simulator. Unlink support is required by the GCC testsuite.
2019-11-02Fix libgloss being built for disabled multilibsJozef Lawrynowicz2-0/+2
Target libraries are considered to be built for GCC's "host", not GCC's "target". The "host" variable must be set by configure scripts using "config-ml.in" to determine multilib support, otherwise disabled multilibs (specified as a configure argument with --disable-<multilib>) will still be built for the subdirectories those configure scripts reside in.
2019-10-31Initial PRU port for libgloss and newlibDimitar Dimitrov21-0/+5338
Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2019-10-25MSP430: Add missing build rule for unlink() to libgloss MakefileJozef Lawrynowicz1-0/+1
2019-09-04Adjust nios2 and m68k semihosting for sys/stat.h changes.Sandra Loosemore4-12/+12
Commit 72ff9acad2ab54e80a19ddaec0106065c817e3f6 caused st_atime, st_ctime, and st_mtime to be defined as macros. This collided with use of these identifiers as field names in struct gdb_stat (which represents the GDB RSP encoding of struct stat) in libgloss semihosting support for nios2 and m68k. This patch renames the affected fields of struct gdb_stat. Signed-off-by: Sandra Loosemore <sandra@codesourcery.com>
2019-08-20Fix regression in visium caused by sys/stat.h changeJeff Law2-6/+6
2019-08-19Revert previous change to sys/stat.h and fix cris libglossJeff Johnston1-6/+12
- revert previous fix which altered sys/stat.h - fix libgloss/cris/gensyscalls to undef st_atime, st_mtime, and st_ctime macros which cannot be used with new_stat structure
2019-08-05Align libgloss/arm and libc/sys/arm sources: miscellaneous fixesAlexander Fedotov2-61/+47
1. Trim trailing spaces 2. Align comments, function declarations and definitions
2019-08-05Align libgloss/arm and libc/sys/arm sources: HeapInfo and __heap_limitAlexander Fedotov1-6/+6
Applied changes from commit 8d98f95: * arm/crt0.S: Initialise __heap_limit when ARM_RDI_MONITOR is defined. * arm/syscalls.c: define __heap_limit global symbol. * arm/syscalls.c (_sbrk): Honour __heap_limit. Applied changes from commit 8d98f95: Fixed semihosting for ARM when heapinfo not provided by debugger
2019-07-30Align _end symbol to at least 4 in all MIPS scriptsFaraz Shahbazker16-0/+16
Left-over part of commit 84b2a020daa17d8ee5c9ec979c3d56f95e69573b The _end marker must be aligned to 4-bytes to ensure that the last element written does not reach beyond the address of _end. This is also necessary as the termination condition is an equality test instead of an ordered test so (_end - _fbss) must be a multiple of 4-bytes. The alignment is already correct for mti*.ld files, fix it for all remaining MIPS scripts that don't already align to at least 4.
2019-07-24MSP430: Remove .init/.fini sectionsJozef Lawrynowicz5-157/+62
The .init/.fini sections are not required for msp430-elf, and add unnecessary code bloat to the CRT library. These sections are specified as "unused" by the MSP430 EABI. .init existed to call __crt0_run_{init,preinit}_array which run through the functions in .{init,preinit}_array. __crt0_run_{init,preinit}_array are already dynamically included like the other crt0 functions, so these can be placed before the call to main, which ensures they are still called if needed. With these functions moved, .init has no purpose and can be removed. .fini existed to call __crt0_run_fini_array. However, the "__msp430_fini" symbol which marks the start of .fini has never been used, so no termination routines have ever been run for msp430. On returning from main(), _exit() is called which just loops forever. So there is no current expectation that __crt0_run_fini_array will get called by the CRT code. Further work is to ensure functions registered with atexit can be optionally called during program termination, and then __crt0_run_fini_array can be registered with atexit during program initialization. The mechanisms for supporting the "-minrt" option have also been removed. "-minrt" enabled a "minimum runtime environment" by removing calls to functions which run global static initializers and constructors. Since this behaviour is now dynamic, and these functions are only included when needed, the minrt versions of the CRT object files are no longer required.
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__.