aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/mips
Commit message (Collapse)AuthorAgeFilesLines
* libc: add _get_tp() private functionKonstantin Belousov2021-04-092-1/+104
| | | | | | | | which returns pointer to tcb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623
* mips: fix some mcount nitsKyle Evans2019-09-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The symbol version for _mcount was removed 12 years ago in r169525 from gmon/Symbol.map, to be added to the per-arch Symbol.map. mips was overlooked in this, so _mcount has no symver. Add it back to where it should have been, rather than where it would go if it were added today, since we're correcting a historical mistake. Additionally, _mcount is getting thrown into .mdebug.abi32 in the llvm80/90 world as it's not getting explicitly thrown into .text, so do this now. This fixes the libc build that was previously failing due to relocations in .mdebug.abi32. This is specifically due to the way clang's integrated AS works and that they emit the .mdebug.abiNN section early in the process. An LLVM bug has been submitted[0] and an agreement has been made that the mips backend should switch to .text following .mdebug.abiNN for compatibility. [0] https://bugs.llvm.org/show_bug.cgi?id=43119 Reviewed by: imp, arichardson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21435 Notes: svn path=/head/; revision=351681
* mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUMKyle Evans2019-08-224-3/+1
| | | | | | | | | | | | | | | | | | | machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via machine/reg.h. Many of the regnum definitions are too short and too generic to be exposing to any userland application including one of these two headers. Moreover, these actively cause build failures in googletest (template <typename T1 ...> expanding to template <typename 9 ...>). Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of the userland consumers to define as needed. Discussed with: imp, jhb Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Notes: svn path=/head/; revision=351409
* libc: mips: remove unused longjmp.cKyle Evans2019-08-221-105/+0
| | | | | | | | | Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Notes: svn path=/head/; revision=351407
* Fix initial exec TLS mode for dynamically loaded shared objects.Konstantin Belousov2019-03-291-0/+64
| | | | | | | | | | | | | | | | | | | | | | | | If dso uses initial exec TLS mode, rtld tries to allocate TLS in static space. If there is no space left, the dlopen(3) fails. If space if allocated, initial content from PT_TLS segment is distributed to all threads' pcbs, which was missed and caused un-initialized TLS segment for such dso after dlopen(3). The mode is auto-detected either due to the relocation used, or if the DF_STATIC_TLS dynamic flag is set. In the later case, the TLS segment is tried to allocate earlier, which increases chance of the dlopen(3) to succeed. LLD was recently fixed to properly emit the flag, ld.bdf did it always. Initial test by: dumbbell Tested by: emaste (amd64), ian (arm) Tested by: Gerald Aryeetey <aryeeteygerald_rogers.com> (arm64) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D19072 Notes: svn path=/head/; revision=345703
* Remove MD __sys_* private symbols.Brooks Davis2018-12-051-3/+0
| | | | | | | | | | | | | No references to any of these exist in the tree. The list was also erratic with different architectures exporting different things (arm64 and riscv exported none). Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18425 Notes: svn path=/head/; revision=341509
* Reimplement brk() and sbrk() to avoid the use of _end.Mark Johnston2018-06-044-147/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, libc.so would initialize its notion of the break address using _end, a special symbol emitted by the static linker following the bss section. Compatibility issues between lld and ld.bfd could cause the wrong definition of _end (libc.so's definition rather than that of the executable) to be used, breaking the brk()/sbrk() interface. Avoid this problem and future interoperability issues by simply not relying on _end. Instead, modify the break() system call to return the kernel's view of the current break address, and have libc initialize its state using an extra syscall upon the first use of the interface. As a side effect, this appears to fix brk()/sbrk() usage in executables run with rtld direct exec, since the kernel and libc.so no longer maintain separate views of the process' break address. PR: 228574 Reviewed by: kib (previous version) MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D15663 Notes: svn path=/head/; revision=334626
* Replace MD assembly exect() with a portable version.Brooks Davis2018-04-122-53/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Originally, on the VAX exect() enable tracing once the new executable image was loaded. This was possible because tracing was controllable through user space code by setting the PSL_T flag. The following instruction is a system call that activated tracing (as all instructions do) by copying PSL_T to PSL_TP (trace pending). The first instruction of the new executable image would trigger a trace fault. This is not portable to all platforms and the behavior was replaced with ptrace(PT_TRACE_ME, ...) since FreeBSD forked off of the CSRG repository. Platforms either incorrectly call execve(), trigger trace faults inside the original executable, or do contain an implementation of this function. The exect() interfaces is deprecated or removed on NetBSD and OpenBSD. Submitted by: Ali Mashtizadeh <ali@mashtizadeh.com> Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D14989 Notes: svn path=/head/; revision=332443
* Remove architecture specific shmat.S files.Brooks Davis2018-04-051-7/+0
| | | | | | | | | | | | These files are identical to the generated system calls. In the case of MIPS, the file was already disconnected from the build. Submitted by: Ali Mashtizadeh <ali@mashtizadeh.com> Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D14976 Notes: svn path=/head/; revision=332080
* Move softfloat symbol map entries to softfloat/Symbol.map.John Baldwin2018-03-051-18/+0
| | | | | | | | | | | | | The arm, mips, and riscv MD Symbol.map files listed some (but not all) of the softfloat symbols that were actually defined in softfloat.c. While here, also remove entries for __fixuns[sd]fsi which are provided by libcompiler_rt and not by libc. Sponsored by: DARPA / AFRL Notes: svn path=/head/; revision=330525
* Fix makecontext() on MIPS O32.John Baldwin2018-02-051-1/+15
| | | | | | | | | | | | | | | The GP register can be clobbered by the callback, so save it in S1 while invoking the callback function. While here, add a comment expounding on the treatment of GP for the various ABIs and the assumptions made. Reviewed by: jmallett (earlier version) Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14179 Notes: svn path=/head/; revision=328893
* Remove limitation of 6 arguments for makecontext() on mips.John Baldwin2018-01-311-1/+1
| | | | | | | | | | | This implementation spills additional arguments on the stack so works fine with more than 6 arguments. I believe the check was just copied over from sparc64 (which doesn't support spilling onto the stack) Sponsored by: DARPA / AFRL Notes: svn path=/head/; revision=328632
* Consistently use 16-byte alignment for MIPS N32 and N64.John Baldwin2018-01-311-4/+2
| | | | | | | | | | | | | | | | | - Add a new <machine/abi.h> header to hold constants shared between C and assembly such as CALLFRAME_SZ. - Add a new STACK_ALIGN constant to <machine/abi.h> and use it to replace hardcoded constants in the kernel and makecontext(). As a result of this, ensure the stack pointer on N32 and N64 is 16-byte aligned for N32 and N64 after exec(), after pthread_create(), and when sending signals rather than 8-byte aligned. Reviewed by: jmallett Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D13875 Notes: svn path=/head/; revision=328629
* Clarify some comments in the MIPS makecontext().John Baldwin2018-01-271-5/+4
| | | | | | | | | | | - N32 and N64 do not have a $a0-3 gap. - Use 'sp += 4' to skip over the gap for O32 rather than '+= i'. It doesn't make a functional change, but makes the code match the comment. Sponsored by: DARPA / AFRL Notes: svn path=/head/; revision=328457
* SPDX: Fix some License ID tags for libc.Pedro F. Giffuni2017-12-271-1/+1
| | | | Notes: svn path=/head/; revision=327248
* Fix fabs() for MIPS when used on -0.0Alex Richardson2017-11-281-3/+2
| | | | | | | | | | | | | | | | | It would previously return negative zero for -0.0 since -0.0 does not compare less than 0. The issue was discovered when running the libc++ test suite on softfloat MIPS64. I have verified that both clang and GCC generate sensible code for the builtin. For soft float they clear the sign bit using integer operations and in hard float mode they use abs.d. Reviewed by: #mips, jhb, brooks, imp, emaste Approved by: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D13135 Notes: svn path=/head/; revision=326342
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-255-0/+10
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326193
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-182-1/+5
| | | | | | | | | | | | | | | | | | | | The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* Include {u,}{div,mod}si3() on mips in libcompiler_rt.John Baldwin2017-08-211-4/+0
| | | | | | | | | | | These builtins were listed in the mips-specific Symbol.map for libc but were not implemented. Compiling mips with recent clang requires these symbols. Sponsored by: DARPA / AFRL Notes: svn path=/head/; revision=322766
* Replace SOFTFLOAT with __mips_soft_float, which gcc/clang define for us.Brooks Davis2017-03-164-14/+10
| | | | | | | | | | | | | | | | | | D8376 extended softfloat/hardfloat support, but used a macro that never actually gets set except in libc and msun's Makefile.inc. So libc and libm got built correctly, but any program including fenv.h itself assumed it was on a hardfloat systen and emitted inline fpu instructions for fedisableexcept() and friends. Using __mips_soft_float makes everything work in all cases, since it's a compiler-internal macro that is always set correctly for the target PR: 217845 Submitted by: Dan Nelson <dnelson_1901@yahoo.com> MFC after: 1 week Notes: svn path=/head/; revision=315424
* Garbage collect unused gdtoa related files on mips.Brooks Davis2017-03-022-14/+0
| | | | | | | | | | Reviewed by: emase, imp, jhb MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9841 Notes: svn path=/head/; revision=314558
* Correct an misunderstanding of MDSRCS.Brooks Davis2017-03-021-1/+1
| | | | | | | | | | | | | | | MDSRCS it intended to allow assembly versions of funtions with C implementations listed in MISRCS. The selection of the correct machdep_ldis?.c for a given architecture does not follow this pattern and the file should be added to SRCS directly. Reviewed by: emaste, imp, jhb MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9841 Notes: svn path=/head/; revision=314557
* Correct MDSRCS use in <arch>/string/Makefile.inc.Brooks Davis2017-03-021-6/+11
| | | | | | | | | | | | | | | | - Remove .c files which duplicate entries in MISRCS. - Use the same, less merge conflict prone style in all cases. - Use MDSRCS for mips (.c and .S files both ended up in SRCS). - Remove pointless sparc64 Makefile.inc. - Remove uninformative foreign VCS ID entries. Reviewed by: emaste, imp, jhb MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9841 Notes: svn path=/head/; revision=314556
* Add full softfloat and hardfloat support for MIPS.Ruslan Bukin2016-10-314-5/+23
| | | | | | | | | | | | | | This adds new target architectures for hardfloat: mipselhf mipshf mips64elhf mips64hf. Tested in QEMU only. Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D8376 Notes: svn path=/head/; revision=308130
* Fix strchr, strrchr implementation: convert c to charRuslan Bukin2016-10-132-0/+10
| | | | | | | | | | | | | (according to standard). Discussed with: andrew Reviewed by: emaste Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D8239 Notes: svn path=/head/; revision=307219
* Reduce duplicate NOASM and PSEUDO definitionsBrooks Davis2016-09-081-3/+1
| | | | | | | | | | | | | | | | The initial value of NOASM is nearly the same in all cases and the initial value of PSEUDO is the same in all cases so reduce duplication (and hopefully, future merge conflicts) by machine independent defaults. Also document the PSEUDO variable. Reviewed by: jhb, kib Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D7820 Notes: svn path=/head/; revision=305630
* Rewrite ptrace(2) wrappers in C.Konstantin Belousov2016-08-292-72/+1
| | | | | | | | | | | | | Besides removing hand-translation to assembler, this also adds missing wrappers for arm64 and risc-v. Reviewed by: emaste, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D7694 Notes: svn path=/head/; revision=305012
* Remove unusedd and obsolete openbsd_poll system call. (Phase 1)George V. Neville-Neil2016-08-181-1/+1
| | | | | | | | | Reported by: brooks Reviewed by: brooks,jhb Differential Revision: https://reviews.freebsd.org/D7548 Notes: svn path=/head/; revision=304395
* Replace use of the pipe(2) system call with pipe2(2) with a zero flagsBrooks Davis2016-06-222-58/+1
| | | | | | | | | | | | | | | | | | | value. This eliminates the need for machine dependant assembly wrappers for pipe(2). It also make passing an invalid address to pipe(2) return EFAULT rather than triggering a segfault. Document this behavior (which was already true for pipe2(2), but undocumented). Reviewed by: andrew Approved by: re (gjb) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D6815 Notes: svn path=/head/; revision=302092
* libc: stop exporting cerrorEd Maste2016-03-301-1/+0
| | | | | | | | | | | | | i386 stopped exporting .cerror in r240152, and likewise for amd64 in r240178. It is not used by other libraries on any platform, so apply the same change to the remaining architectures. Reviewed by: jhibbits, jilles Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5774 Notes: svn path=/head/; revision=297418
* libc: stop exporting curbrk and minbrk in the private namespaceEd Maste2016-03-241-2/+0
| | | | | | | | | | | | They are not used anywhere else in the base system and are an internal implementation detail that does not need to be exposed. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5728 Notes: svn path=/head/; revision=297238
* Fix the implementations of PSEUDO_NOERROR and PSEUDO.Brooks Davis2016-01-211-7/+21
| | | | | | | | | | | | | | | The PSEUDO* macros should not declare <syscall>, only _<syscall> and __sys_<syscall>. This was causing the interposing C wrappers to be ignored due to link order. Reviewed by: kib Obtained from: CheriBSD (4e8e13c90fc6a80e1520de44a6864cfd78b3b56d) MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D4097 Notes: svn path=/head/; revision=294515
* Add include for declaration of _set_tp(). Eliminates -Wmissing-prototypes ↵Craig Rodrigues2015-09-201-0/+1
| | | | | | | warnings. Notes: svn path=/head/; revision=288019
* Removed unused special fork() implementations.Brooks Davis2015-05-292-58/+1
| | | | | | | | | | | | | | The arm version hasn't been used in ages. The mips version uses a valid, but pointless check of v1 and has been unhooked from the build since r276630. Differential Revision: https://reviews.freebsd.org/D2592 Reviewed by: emaste Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=283751
* The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), andKonstantin Belousov2015-04-181-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | pwrite(2) syscalls are wrapped to provide compatibility with pre-7.x kernels which required padding before the off_t parameter. The fcntl(2) contains compatibility code to handle kernels before the struct flock was changed during the 8.x CURRENT development. The shims were reasonable to allow easier revert to the older kernel at that time. Now, two or three major releases later, shims do not serve any purpose. Such old kernels cannot handle current libc, so revert the compatibility code. Make padded syscalls support conditional under the COMPAT6 config option. For COMPAT32, the syscalls were under COMPAT6 already. Remove WITHOUT_SYSCALL_COMPAT build option, which only purpose was to (partially) disable the removed shims. Reviewed by: jhb, imp (previous versions) Discussed with: peter Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=281714
* libc: Eliminate duplicate copies of __vdso_gettc.cEd Maste2015-04-022-49/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2152 Notes: svn path=/head/; revision=281004
* Use zero register instead of immediate 0x0 in MIPS assemblyEd Maste2015-01-291-1/+1
| | | | | | | | | | | It seems GAS makes the substitution automatically, but Clang's integrated assembler does not (yet). It fails with "invalid operand for instruction." Reported by: sbruno Notes: svn path=/head/; revision=277877
* Remove duplicate copies of trivial getcontextx.cEd Maste2015-01-122-78/+3
| | | | | | | | | | | | | Only i386 and amd64 provide a non-trivial __getcontextx(). Use a common trivial implementation in gen/ for other architectures, rather than copying the file to each MD subdirectory. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1472 Notes: svn path=/head/; revision=277078
* Add FPU support for MIPS setjmp(3)/longjmp(3).Brooks Davis2014-11-212-4/+153
| | | | | | | | | | | | | | | | This change saves/restores the callee-saved MIPS floating point registers as documented by the o32/n32/n64 spec ("MIPSpro N32 ABI Handbook", Table 2-1) for the _setjmp(3), _longjmp(3), setjmp(3) and longjmp(3) C library functions. This is only included when the C library is built with hardware floating point support (or when "SOFTFLOAT" is not defined). Submitted by: sson MFC after: 1 month Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=274816
* Remove ia64.Marcel Moolenaar2014-07-071-3/+0
| | | | | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan Notes: svn path=/head/; revision=268351
* Convert from WITHOUT_SYSCALL_COMPAT to MK_SYSCALL_COMPAT.Warner Losh2014-04-051-1/+1
| | | | Notes: svn path=/head/; revision=264155
* Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}Marcel Moolenaar2014-03-041-1/+1
| | | | | | | | | | | | | | if not already defined. This allows building libc from outside of lib/libc using a reach-over makefile. A typical use-case is to build a standard ILP32 version and a COMPAT32 version in a single iteration by building the COMPAT32 version using a reach-over makefile. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=262722
* Remove clause 3 and 4 from TNF licensesEd Maste2013-05-295-35/+0
| | | | | | | | | | Per the NetBSD Foundation statement Third parties are encouraged to change the license on any files which have a 4-clause license contributed to the NetBSD Foundation to a 2-clause license. Notes: svn path=/head/; revision=251091
* The getcontext() from the __fillcontextx() call in theKonstantin Belousov2013-05-281-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | check_deferred_signal() returns twice, since handle_signal() emulates the return from the normal signal handler by sigreturn(2)ing the passed context. Second return is performed on the destroyed stack frame, because __fillcontextx() has already returned. This causes undefined and bad behaviour, usually the victim thread gets SIGSEGV. Avoid nested frame and the need to return from it by doing direct call to getcontext() in the check_deferred_signal() and using a new private libc helper __fillcontextx2() to complement the context with the extended CPU state if the deferred signal is still present. The __fillcontextx() is now unused, but is kept to allow older libthr.so to be used with the new libc. Mark __fillcontextx() as returning twice [1]. Reported by: pgj Pointy hat to: kib Discussed with: dim Tested by: pgj, dim Suggested by: jilles [1] MFC after: 1 week Notes: svn path=/head/; revision=251047
* Rework the __vdso_* symbols attributes to only make the symbols weak,Konstantin Belousov2013-01-302-0/+50
| | | | | | | | | | | | | but use normal references instead of weak. This makes the statically linked binaries to use fast gettimeofday(2) by forcing the linker to resolve references and providing the neccessary functions. Reported by: bde Tested by: marius (sparc64) MFC after: 2 weeks Notes: svn path=/head/; revision=246117
* Implement _set_tpOleksandr Tymoshenko2012-03-061-0/+4
| | | | Notes: svn path=/head/; revision=232581
* Make the sys/ucontext.h self-contained by changing the return typeKonstantin Belousov2012-02-011-1/+1
| | | | | | | | | | of __getcontextx_size(3) from size_t to int. PR: ports/164654 MFC after: 1 month Notes: svn path=/head/; revision=230864
* Add API for obtaining extended machine context states that cannot beKonstantin Belousov2012-01-212-1/+71
| | | | | | | | | | | | | | fit into existing mcontext_t. On i386 and amd64 do return the extended FPU states using getcontextx(3). For other architectures, getcontextx(3) returns the same information as getcontext(2). Tested by: pho MFC after: 1 month Notes: svn path=/head/; revision=230429
* Convert softfloat to use the standard exception flag and rounding macrosDavid Schultz2012-01-161-14/+14
| | | | | | | | | in fenv.h instead of the non-standard and incomplete ones in ieeefp.h. Thanks to Ian Lepore for testing this patch. Notes: svn path=/head/; revision=230189
* Change index() and rindex() to a weak alias.Ed Schouten2012-01-052-2/+2
| | | | | | | | | | | This allows people to still write statically linked applications that call strchr() or strrchr() and have a local variable or function called index. Discussed with: bde@ Notes: svn path=/head/; revision=229571