aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/loongarch
AgeCommit message (Collapse)AuthorFilesLines
2023-08-14LoongArch: Add minuimum binutils required versiondengjianbo4-8/+7
LoongArch glibc can add some LASX/LSX vector instructions codes, change the required minimum binutils version to 2.41 which could support vector instructions. HAVE_LOONGARCH_VEC_ASM is removed accordingly.
2023-08-14LoongArch: Redefine macro LEAF/ENTRY.dengjianbo1-10/+26
The following usage of macro LEAF/ENTRY are all feasible: 1. LEAF(fcn) -- the align value of fcn is .align 3(default value) 2. LEAF(fcn, 6) -- the align value of fcn is .align 6
2023-08-04LoongArch: Fix static PIE condition for toolchain bootstrapping.Yang Yujie2-2/+2
This patch allows the static PIE startfile rcrt1.o to be built without requiring libgcc_s.so from GCC, which depends on libc in the first place.
2023-07-17configure: Use autoconf 2.71Siddhesh Poyarekar2-37/+38
Bump autoconf requirement to 2.71 to allow regenerating configure on more recent distributions. autoconf 2.71 has been in Fedora since F36 and is the current version in Debian stable (bookworm). It appears to be current in Gentoo as well. All sysdeps configure and preconfigure scripts have also been regenerated; all changes are trivial transformations that do not affect functionality. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2023-07-11LoongArch: Fix soft-float bug about _dl_runtime_resolve{,lsx,lasx}caiyinyu3-11/+9
2023-07-11LoongArch: Add vector implementation for _dl_runtime_resolve.caiyinyu6-69/+178
2023-07-11LoongArch: config: Added HAVE_LOONGARCH_VEC_ASM.caiyinyu2-0/+43
This patch checks if assembler supports vector instructions to generate LASX/LSX code or not, and then define HAVE_LOONGARCH_VEC_ASM macro We have added support for vector instructions in binutils-2.41 See: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=75b2f521b101d974354f6ce9ed7c054d8b2e3b7a commit 75b2f521b101d974354f6ce9ed7c054d8b2e3b7a Author: mengqinggang <mengqinggang@loongson.cn> Date: Thu Jun 22 10:35:28 2023 +0800 LoongArch: gas: Add lsx and lasx instructions support gas/ChangeLog: * config/tc-loongarch.c (md_parse_option): Add lsx and lasx option. (loongarch_after_parse_args): Add lsx and lasx option. opcodes/ChangeLog: * loongarch-opc.c (struct loongarch_ase): Add lsx and lasx instructions.
2023-07-07LoongArch: config: Rewrite check on static PIE.caiyinyu2-14/+14
It's better to add "\" before "EOF" and remove "\" before "$".
2023-06-13LoongArch: Add support for dl_runtime_profilecaiyinyu5-4/+220
This commit can fix the FAIL item: elf/tst-sprof-basic.
2023-05-30Fix misspellings in sysdeps/ -- BZ 25337Paul Pluzhnikov2-2/+2
2023-03-13LoongArch: Add get_rounding_mode.caiyinyu1-0/+38
2023-03-02LoongArch: Update libm-test-ulps.caiyinyu1-0/+1
2023-03-02LoongArch: Further refine the condition to enable static PIEXi Ruoyao2-0/+7
Before GCC r13-2728, it would produce a normal dynamic-linked executable with -static-pie. I mistakely believed it would produce a static-linked executable, so failed to detect the breakage. Then with Binutils 2.40 and (vanilla) GCC 12, libc_cv_static_pie_on_loongarch is mistakenly enabled and cause a building failure with "undefined reference to _DYNAMIC". Fix the issue by disabling static PIE if -static-pie creates something with a INTERP header.
2023-02-27LoongArch: Add math-barriers.hXi Ruoyao1-0/+28
This patch implements the LoongArch specific math barriers in order to omit the store and load from stack if possible. Signed-off-by: Xi Ruoyao <xry111@xry111.site> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2023-01-31Regenerate configure.Carlos O'Donell1-2/+3
Run using vanilla upstream autoconf 2.69. Minor whitespace change to sysdeps/loongarch/configure and sysdeps/mach/configure, and nothing else.
2023-01-06Update copyright dates with scripts/update-copyrightsJoseph Myers85-85/+85
2022-12-07LoongArch: Use medium cmodel build libc_nonshared.a.Chenghua Xu3-0/+38
This patch is used to fix address out-of-bounds error when building Chrome.
2022-11-29LoongArch: Add support for ilogb[f]Xiaolin Tang2-0/+78
Add inline assembler for the ilogb functions. Passes GLIBC regression.
2022-11-29LoongArch: Add support for scalb[f]Xiaolin Tang2-0/+120
Add inline assembler for the scalb functions. Passes GLIBC regression.
2022-11-29LoongArch: Add support for scalbn[f]Xiaolin Tang2-0/+58
Add inline assembler for the scalbn functions. Passes GLIBC regression. GCC 13, LoongArch support ___builtin_scalbn{,f} with -fno-math-errno, but only "libm" can use -fno-math-errno in GLIBC, and scalbn is in libc instead of libm because __printf_fp calls it.
2022-11-29LoongArch: Use __builtin_logb{,f} with GCC >= 13Xiaolin Tang1-0/+10
GCC 13 compiles these built-ins instead of generic implementation for function logb. Link: https://gcc.gnu.org/r13-3922 Co-Authored-By: Xi Ruoyao <xry111@xry111.site>
2022-11-29LoongArch: Use __builtin_llrint{,f} with GCC >= 13Xiaolin Tang1-0/+10
GCC 13 compiles these built-ins instead of generic implementation for function llrint. Link: https://gcc.gnu.org/r13-3920 Co-Authored-By: Xi Ruoyao <xry111@xry111.site>
2022-11-29LoongArch: Use __builtin_lrint{,f} with GCC >= 13Xiaolin Tang1-0/+10
GCC 13 compiles these built-ins instead of generic implementation for function lrint. Link: https://gcc.gnu.org/r13-3920 Co-Authored-By: Xi Ruoyao <xry111@xry111.site>
2022-11-29LoongArch: Use __builtin_rint{,f} with GCC >= 13Xi Ruoyao1-0/+9
GCC 13 compiles these built-ins to frint.{d,s} instruction. Link: https://gcc.gnu.org/r13-3919
2022-11-14LoongArch: Hard Float Support for fmaximum_mag_num{f/ }, fminimum_mag_num{f/ }.Xiaolin Tang4-0/+192
Use hardware Floating-point instruction f{maxa/mina}.{s/d}, fclass.{s/d} to implement fmaximum_mag_num{f/ }, fminimum_mag_num{f/ }. * sysdeps/loongarch/fpu/s_fmaximum_mag_num.c: New file. * sysdeps/loongarch/fpu/s_fmaximum_mag_numf.c: Likewise. * sysdeps/loongarch/fpu/s_fminimum_mag_num.c: Likewise. * sysdeps/loongarch/fpu/s_fminimum_mag_numf.c: Likewise.
2022-11-14LoongArch: Hard Float Support for fmaximum_mag{f/ }, fminimum_mag{f/ }.Xiaolin Tang4-0/+160
Use hardware Floating-point instruction f{maxa/mina}.{s/d}, fclass.{s/d} to implement fmaximum_mag{f/ }, fminimum_mag{f/ }. * sysdeps/loongarch/fpu/s_fmaximum_mag.c: New file. * sysdeps/loongarch/fpu/s_fmaximum_magf.c: Likewise. * sysdeps/loongarch/fpu/s_fminimum_mag.c: Likewise. * sysdeps/loongarch/fpu/s_fminimum_magf.c: Likewise.
2022-11-14LoongArch: Hard Float Support for fmaxmag{f/ }, fminmag{f/ }.Xiaolin Tang4-0/+116
Use hardware Floating-point instruction f{maxa/mina}.{s/d}, to implement fmaxmag{f/ }, fminmag{f/ }. * sysdeps/loongarch/fpu/s_fmaxmag.c: New file. * sysdeps/loongarch/fpu/s_fmaxmagf.c: Likewise. * sysdeps/loongarch/fpu/s_fminmag.c: Likewise. * sysdeps/loongarch/fpu/s_fminmagf.c: Likewise.
2022-11-14LoongArch: Hard Float Support for fmaximum_num{f/ }, fminimum_num{f/ }.Xiaolin Tang4-0/+193
Use hardware Floating-point instruction f{max/min}.{s/d}, fclass.{s/d} to implement fmaximum_num{f/ }, fminimum_num{f/ }. * sysdeps/loongarch/fpu/s_fmaximum_num.c: New file. * sysdeps/loongarch/fpu/s_fmaximum_numf.c: Likewise. * sysdeps/loongarch/fpu/s_fminimum_num.c: Likewise. * sysdeps/loongarch/fpu/s_fminimum_numf.c: Likewise.
2022-11-14LoongArch: Hard Float Support for fmaximum{f/ }, fminimum{f/ }.Xiaolin Tang4-0/+160
Use hardware Floating-point instruction f{max/min}.{s/d}, fclass.{s/d} to implement fmaximum{f/ }, fminimum{f/ }. * sysdeps/loongarch/fpu/s_fmaximum.c: New file. * sysdeps/loongarch/fpu/s_fmaximumf.c: Likewise. * sysdeps/loongarch/fpu/s_fminimum.c: Likewise. * sysdeps/loongarch/fpu/s_fminimumf.c: Likewise.
2022-11-14LoongArch: Hard Float Support for float-point classification functions.Xiaolin Tang11-0/+333
Use hardware Floating-point instruction fclass.{s/d} to implement classification functions, i.e finite{f/ }, fpclassify{f/ }, isnan{f/ }, isinf{f/ }, issignaling{f/ }. * sysdeps/loongarch/fpu/s_finite.c: New file. * sysdeps/loongarch/fpu/s_finitef.c: Likewise. * sysdeps/loongarch/fpu/s_fpclassify.c: Likewise. * sysdeps/loongarch/fpu/s_fpclassifyf.c: Likewise. * sysdeps/loongarch/fpu/s_isinf.c: Likewise. * sysdeps/loongarch/fpu/s_isinff.c: Likewise. * sysdeps/loongarch/fpu/s_isnan.c: Likewise. * sysdeps/loongarch/fpu/s_isnanf.c: Likewise. * sysdeps/loongarch/fpu/s_issignaling.c: Likewise. * sysdeps/loongarch/fpu/s_issignalingf.c: Likewise. * sysdeps/loongarch/fpu_control.h: Add _FCLASS_* macro.
2022-11-14LoongArch: Use __builtin_{fma, fmaf} to implement function {fma, fmaf}.Xiaolin Tang1-0/+4
Use __builtin_{fma, fmaf} to implement function {fma, fmaf} instead of the generic implementation. * sysdeps/loongarch/fpu/math-use-builtins-fma.h: New file.
2022-11-03elf: Introduce <dl-call_tls_init_tp.h> and call_tls_init_tp (bug 29249)Florian Weimer1-1/+1
This makes it more likely that the compiler can compute the strlen argument in _startup_fatal at compile time, which is required to avoid a dependency on strlen this early during process startup. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
2022-10-18Use PTR_MANGLE and PTR_DEMANGLE unconditionally in C sourcesFlorian Weimer1-2/+0
In the future, this will result in a compilation failure if the macros are unexpectedly undefined (due to header inclusion ordering or header inclusion missing altogether). Assembler sources are more difficult to convert. In many cases, they are hand-optimized for the mangling and no-mangling variants, which is why they are not converted. sysdeps/s390/s390-32/__longjmp.c and sysdeps/s390/s390-64/__longjmp.c are special: These are C sources, but most of the implementation is in assembler, so the PTR_DEMANGLE macro has to be undefined in some cases, to match the assembler style. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-10-18Introduce <pointer_guard.h>, extracted from <sysdep.h>Florian Weimer3-0/+3
This allows us to define a generic no-op version of PTR_MANGLE and PTR_DEMANGLE. In the future, we can use PTR_MANGLE and PTR_DEMANGLE unconditionally in C sources, avoiding an unintended loss of hardening due to missing include files or unlucky header inclusion ordering. In i386 and x86_64, we can avoid a <tls.h> dependency in the C code by using the computed constant from <tcb-offsets.h>. <sysdep.h> no longer includes these definitions, so there is no cyclic dependency anymore when computing the <tcb-offsets.h> constants. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-10-08LoongArch: Fix the condition to use PC-relative addressing in start.SXi Ruoyao3-12/+47
A start.o compiled from start.S with -DPIC and no -DSHARED is used by both crt1.o and rcrt1.o. So the LoongArch static PIE patch unintentionally introduced PC-relative addressing for main and __libc_start_main into crt1.o. While the latest Binutils (trunk, which will be released as 2.40) supports the PC-relative relocs against an external function by creating a PLT entry, the 2.39 release branch doesn't (and won't) support this. An error is raised: "PLT stub does not represent and symbol not defined." So, we need the following changes: 1. Check if ld supports the PC-relative relocs against an external function. If it's not supported, we deem static PIE unsupported. 2. Change start.S. If static PIE is supported, use PC-relative addressing for main and __libc_start_main and rely on the linker to create PLT entries. Otherwise, restore the old behavior (using GOT to address these functions). An alternative would be adding a new "static-pie-start.S", and some custom logic into Makefile to build rcrt1.o with it. And, restore start.S to the state before static PIE change so crt1.o won't contain PC-relative relocs against external symbols. But I can't see any benefit of this alternative, so I'd just keep it simple. Tested by building glibc with the following configurations: 1. Binutils trunk + GCC trunk. Static PIE enabled. All tests passed. 2. Binutils 2.39 branch + GCC trunk. Static PIE disabled. Tests related to ifunc failed (it's a known issue). All other tests passed. 3. Binutils 2.39 branch + GCC 12 branch, cross compilation with build-many-glibcs.py from x86_64-linux-gnu. Static PIE disabled. Build succeeded.
2022-09-30LoongArch: Add static PIE supportXi Ruoyao3-3/+95
If the compiler is new enough, enable static PIE support. In the static PIE version of _start (in rcrt1.o), use la.pcrel instead of la.got because in a static PIE we cannot use GOT entries until the dynamic relocations for GOT are resolved.
2022-09-26Use atomic_exchange_release/acquireWilco Dijkstra1-2/+2
Rename atomic_exchange_rel/acq to use atomic_exchange_release/acquire since these map to the standard C11 atomic builtins. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2022-09-01LoongArch: Add soft float support.caiyinyu11-12/+85
2022-08-30LoongArch: Use __builtin_{fmax,fmaxf,fmin,fminf} with GCC >= 13Xi Ruoyao2-0/+20
GCC 13 compiles these built-ins to {fmax,fmin}.{s/d} instruction, use them instead of the generic implementation. Link: https://gcc.gnu.org/r13-2085 Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2022-08-30LoongArch: Fix ptr mangling/demangling features.caiyinyu2-2/+2
2022-08-26csu: Change start code license to have link exceptionSzabolcs Nagy1-2/+18
The start code can get linked into dynamic linked executables where LGPL would require shipping the source or linkable binaries when the executable is distributed. On some targets the license exception was missing in start.S (which is compiled into crt1.o and Scrt1.o which may end up linked into PDE and PIE binaries). I did not review what other code may end up in executables, just fixed the start.S license inconsistency across targets. Reviewed-by: Carlos O'Donell <carlos@redhat.com>
2022-08-24LoongArch: Fix dl-machine.h code formatting.Xi Ruoyao1-8/+4
No functional change.
2022-08-12LoongArch: Add pointer mangling support.caiyinyu2-0/+14
2022-07-26LoongArch: Hard Float Supportcaiyinyu22-0/+2372
2022-07-26LoongArch: Build Infrastructurecaiyinyu8-0/+223
2022-07-26LoongArch: Linux ABIcaiyinyu3-0/+116
2022-07-26LoongArch: Linux Syscall Interfacecaiyinyu2-0/+44
2022-07-26LoongArch: Generic <math.h> and soft-fp Routinescaiyinyu5-0/+321
2022-07-26LoongArch: Thread-Local Storage Supportcaiyinyu4-0/+249
2022-07-26LoongArch: ABI Implementationcaiyinyu18-0/+959