aboutsummaryrefslogtreecommitdiff
path: root/libgcc
AgeCommit message (Collapse)AuthorFilesLines
2025-05-28Daily bump.GCC Administrator1-0/+8
2025-05-27AVR: target/120441 - Fix f7_exp for |x| ≥ 512.Georg-Johann Lay1-2/+2
f7_exp limited exponents to 512, but 1023 * ln2 ≈ 709, hence 1024 is a correct limit. libgcc/config/avr/libf7/ PR target/120441 * libf7.c (f7_exp): Limit aa->expo to 10 (not to 9). (cherry picked from commit 672569cee76a1927d14b5eb754a5ff0b9cee1bc8)
2025-05-23Update ChangeLog and version files for releasereleases/gcc-14.3.0Richard Biener3-0/+12
2025-05-02Daily bump.GCC Administrator1-0/+11
2025-05-01libgcc, Darwin: Drop the legacy library build for macOS >= 10.12 [PR116809].Mark Mentovai4-9/+9
From macOSX15 SDK, the unwinder no longer exports some of the symbols used in that library which (a) causes bootstrap fail and (b) means that the legacy library is no longer useful. No open branch of GCC emits references to this library - and any already -built code that depends on the symbols would need rework anyway. We have been asked to extend this back to the earliest OS vesion supported by the SDK (10.12). PR target/116809 libgcc/ChangeLog: * config.host: Build legacy libgcc_s.1 on hosts before macOS 10.12. * config/i386/t-darwin: Remove reference to legacy libgcc_s.1 * config/rs6000/t-darwin: Likewise. * config/t-darwin-libgccs1: New file. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit d9cafa0c4f0a81304d9b95a78ccc8e9003c6d7a3)
2025-03-28Daily bump.GCC Administrator1-0/+14
2025-03-28libgcc: Fix up unwind-dw2-btree.h [PR119151]Jakub Jelinek1-2/+21
The following testcase shows a bug in unwind-dw2-btree.h. In short, the header provides lock-free btree data structure (so no parent link on nodes, both insertion and deletion are done in top-down walks with some locking of just a few nodes at a time so that lookups can notice concurrent modifications and retry, non-leaf (inner) nodes contain keys which are initially the base address of the left-most leaf entry of the following child (or all ones if there is none) minus one, insertion ensures balancing of the tree to ensure [d/2, d] entries filled through aggressive splitting if it sees a full tree while walking, deletion performs various operations like merging neighbour trees, merging into parent or moving some nodes from neighbour to the current one). What differs from the textbook implementations is mostly that the leaf nodes don't include just address as a key, but address range, address + size (where we don't insert any ranges with zero size) and the lookups can be performed for any address in the [address, address + size) range. The keys on inner nodes are still just address-1, so the child covers all nodes where addr <= key unless it is covered already in children to the left. The user (static executables or JIT) should always ensure there is no overlap in between any of the ranges. In the testcase a bunch of insertions are done, always followed by one removal, followed by one insertion of a range slightly different from the removed one. E.g. in the first case [&code[0x50], &code[0x59]] range is removed and then we insert [&code[0x4c], &code[0x53]] range instead. This is valid, it doesn't overlap anything. But the problem is that some non-leaf (inner) one used the &code[0x4f] key (after the 11 insertions completely correctly). On removal, nothing adjusts the keys on the parent nodes (it really can't in the top-down only walk, the keys could be many nodes above it and unlike insertion, removal only knows the start address, doesn't know the removed size and so will discover it only when reaching the leaf node which contains it; plus even if it knew the address and size, it still doesn't know what the second left-most leaf node will be (i.e. the one after removal)). And on insertion, if nodes aren't split at a level, nothing adjusts the inner keys either. If a range is inserted and is either fully bellow key (keys are - 1, so having address + size - 1 being equal to key is fine) or fully after key (i.e. address > key), it works just fine, but if the key is in a middle of the range like in this case, &code[0x4f] is in the middle of the [&code[0x4c], &code[0x53]] range, then insertion works fine (we only use size on the leaf nodes), and lookup of the addresses below the key work fine too (i.e. [&code[0x4c], &code[0x4f]] will succeed). The problem is with lookups after the key (i.e. [&code[0x50, &code[0x53]]), the lookup looks for them in different children of the btree and doesn't find an entry and returns NULL. As users need to ensure non-overlapping entries at any time, the following patch fixes it by adjusting keys during insertion where we know not just the address but also size; if we find during the top-down walk a key which is in the middle of the range being inserted, we simply increase the key to be equal to address + size - 1 of the range being inserted. There can't be any existing leaf nodes overlapping the range in correct programs and the btree rebalancing done on deletion ensures we don't have any empty nodes which would also cause problems. The patch adjusts the keys in two spots, once for the current node being walked (the last hunk in the header, with large comment trying to explain it) and once during inner node splitting in a parent node if we'd otherwise try to add that key in the middle of the range being inserted into the parent node (in that case it would be missed in the last hunk). The testcase covers both of those spots, so succeeds with GCC 12 (which didn't have btrees) and fails with vanilla GCC trunk and also fails if either the if (fence < base + size - 1) fence = iter->content.children[slot].separator = base + size - 1; or if (left_fence >= target && left_fence < target + size - 1) left_fence = target + size - 1; hunk is removed (of course, only with the current node sizes, i.e. up to 15 children of inner nodes and up to 10 entries in leaf nodes). 2025-03-10 Jakub Jelinek <jakub@redhat.com> Michael Leuchtenburg <michael@slashhome.org> PR libgcc/119151 * unwind-dw2-btree.h (btree_split_inner): Add size argument. If left_fence is in the middle of [target,target + size - 1] range, increase it to target + size - 1. (btree_insert): Adjust btree_split_inner caller. If fence is smaller than base + size - 1, increase it and separator of the slot to base + size - 1. * gcc.dg/pr119151.c: New test. (cherry picked from commit 21109b37e8585a7a1b27650fcbf1749380016108)
2025-02-21Daily bump.GCC Administrator1-0/+9
2025-02-20LoongArch: Fix the issue of function jump out of range caused by crtbeginS.o ↵Lulu Cheng1-0/+6
[PR118844]. Due to the presence of R_LARCH_B26 in /usr/lib/gcc/loongarch64-linux-gnu/14/crtbeginS.o, its addressing range is [PC-128MiB, PC+128MiB-4]. This means that when the code segment size exceeds 128MB, linking with lld will definitely fail (ld will not fail because the order of the two is different). The linking order: lld: crtbeginS.o + .text + .plt ld : .plt + crtbeginS.o + .text To solve this issue, add '-mcmodel=extreme' when compiling crtbeginS.o. PR target/118844 libgcc/ChangeLog: * config/loongarch/t-crtstuff: Add '-mcmodel=extreme' to CRTSTUFF_T_CFLAGS_S. (cherry picked from commit ae14d7d04da8c6cb542269722638071f999f94d8)
2025-02-10Daily bump.GCC Administrator1-0/+5
2025-02-09libgcc: On FreeBSD use GCC's crt objects for static linkingDimitry Andric1-1/+1
Add crtbeginT.o to extra_parts on FreeBSD. This ensures we use GCC's crt objects for static linking. Otherwise it could mix crtbeginT.o from the base system with libgcc's crtend.o, possibly leading to segfaults. libgcc: PR target/118685 * config.host (*-*-freebsd*): Add crtbeginT.o to extra_parts. Signed-off-by: Dimitry Andric <dimitry@andric.com>
2025-01-10Daily bump.GCC Administrator1-0/+10
2025-01-09openmp: Add crtoffloadtableS.o and use it [PR117851]Jakub Jelinek3-2/+7
Unlike crtoffload{begin,end}.o which just define some symbols at the start/end of the various .gnu.offload* sections, crtoffloadtable.o contains const void *const __OFFLOAD_TABLE__[] __attribute__ ((__visibility__ ("hidden"))) = { &__offload_func_table, &__offload_funcs_end, &__offload_var_table, &__offload_vars_end, &__offload_ind_func_table, &__offload_ind_funcs_end, }; The problem is that linking this into PIEs or shared libraries doesn't work when it is compiled without -fpic/-fpie - __OFFLOAD_TABLE__ for non-PIC code is put into .rodata section, but it really needs relocations, so for PIC it should go into .data.rel.ro/.data.rel.ro.local. As I think we don't want .data.rel.ro section in non-PIE binaries, this patch follows the path of e.g. crtbegin.o vs. crtbeginS.o and adds crtoffloadtableS.o next to crtoffloadtable.o, where crtoffloadtableS.o is compiled with -fpic. 2024-11-30 Jakub Jelinek <jakub@redhat.com> PR libgomp/117851 gcc/ * lto-wrapper.cc (find_crtoffloadtable): Add PIE_OR_SHARED argument, search for crtoffloadtableS.o rather than crtoffloadtable.o if true. (run_gcc): Add pie_or_shared variable. If OPT_pie or OPT_shared or OPT_static_pie is seen, set pie_or_shared to true, if OPT_no_pie is seen, set pie_or_shared to false. Pass it to find_crtoffloadtable. libgcc/ * configure.ac (extra_parts): Add crtoffloadtableS.o. * Makefile.in (crtoffloadtableS$(objext)): New goal. * configure: Regenerated. (cherry picked from commit f089ef880e385e2193237b1f53ec81dac4141680)
2025-01-07Daily bump.GCC Administrator1-0/+4
2025-01-06or1k: add .note.GNU-stack section on linuxStafford Horne1-0/+5
In the OpenRISC build we get the following warning: ld: warning: __modsi3_s.o: missing .note.GNU-stack section implies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker Fix this by adding a .note.GNU-stack to indicate the stack does not need to be executable for the lib1funcs. Note, this is also needed for the upcoming glibc 2.41. libgcc/ * config/or1k/lib1funcs.S: Add .note.GNU-stack section on linux.
2024-09-24Daily bump.GCC Administrator1-0/+9
2024-09-23libgcc, Darwin: From macOS 11, make that the earliest supported.Iain Sandoe2-1/+7
For libgcc, we have (so far) supported building a DSO that supports earlier versions of the OS than the target. From macOS 11, there are APIs that do not exist on earlier OS versions, so limit the libgcc range to macOS11..current. libgcc/ChangeLog: * config.host: From macOS 11, limit earliest macOS support to macOS 11. * config/t-darwin-min-11: New file. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> (cherry picked from commit 43eab54939d37d4e634a692910d31adafc053e38)
2024-08-28Daily bump.GCC Administrator1-0/+7
2024-08-27MIPS: Include missing mips16.S in libgcc/lib1funcs.SYunQiang Su1-1/+1
mips16.S was missing since commit 29b74545531f6afbee9fc38c267524326dbfbedf Date: Thu Jun 1 10:14:24 2023 +0800 MIPS: Add speculation_barrier support Without mips16.S included, some symbols will miss for mips16, and so some software will fail to build. libgcc/ChangeLog: * config/mips/lib1funcs.S: Includes mips16.S. (cherry picked from commit 9522fc8bb7812f2ad50eb038e0938bfd958e730f)
2024-08-01Update ChangeLog and version files for releasereleases/gcc-14.2.0Jakub Jelinek3-0/+12
2024-06-22Daily bump.GCC Administrator1-0/+13
2024-06-21AArch64: Fix cpu features initialization [PR115342]Wilco Dijkstra1-106/+75
The CPU features initialization code uses CPUID registers (rather than HWCAP). The equality comparisons it uses are incorrect: for example FEAT_SVE is not set if SVE2 is available. Using HWCAPs for these is both simpler and correct. The initialization must also be done atomically to avoid multiple threads causing corruption due to non-atomic RMW accesses to the global. libgcc: PR target/115342 * config/aarch64/cpuinfo.c (__init_cpu_features_constructor): Use HWCAP where possible. Use atomic write for initialization. Fix FEAT_PREDRES comparison. (__init_cpu_features_resolver): Use atomic load for correct initialization. (__init_cpu_features): Likewise. (cherry picked from commit d7cbcfe7c33645eaf95f175f19884d443817857b)
2024-06-13Daily bump.GCC Administrator1-0/+8
2024-06-12arm: Add .type and .size to __gnu_cmse_nonsecure_call [PR115360]Andre Vieira1-0/+2
This patch adds missing assembly directives to the CMSE library wrapper to call functions with attribute cmse_nonsecure_call. Without the .type directive the linker will fail to produce the correct veneer if a call to this wrapper function is to far from the wrapper itself. The .size was added for completeness, though we don't necessarily have a usecase for it. libgcc/ChangeLog: PR target/115360 * config/arm/cmse_nonsecure_call.S: Add .type and .size directives. (cherry picked from commit c559353af49fe5743d226ac3112a285b27a50f6a)
2024-06-11Daily bump.GCC Administrator1-0/+4
2024-06-10libgcc/aarch64: also provide AT_HWCAP2 fallbackJan Beulich1-0/+3
Much like AT_HWCAP is already provided in case the platform headers don't have the value (yet). libgcc/ * config/aarch64/cpuinfo.c: Provide AT_HWCAP2.
2024-06-02Daily bump.GCC Administrator1-0/+8
2024-06-01AVR: target/115317 - Make isinf(-Inf) return -1.Georg-Johann Lay1-7/+12
PR target/115317 libgcc/config/avr/libf7/ * libf7-asm.sx (__isinf): Map -Inf to -1. gcc/testsuite/ * gcc.target/avr/torture/pr115317-isinf.c: New test. (cherry picked from commit f12454278dc725fec3520a5d870e967d79292ee6)
2024-05-19Daily bump.GCC Administrator1-0/+8
2024-05-18AVR: target/115065 - Tweak __clzhi2.Wolfgang Hospital1-4/+4
The libgcc implementation of __clzhi2 can be tweaked by one cycle in some situations by re-arranging the instructions. It also reduces the WCET by 1 cycle. libgcc/ PR target/115065 * config/avr/lib1funcs.S (__clzhi2): Tweak. (cherry picked from commit 988838da722dea09bd81ee9d49800a6f24980372)
2024-05-13Daily bump.GCC Administrator1-0/+11
2024-05-10AVR: target/114981 - Tweak __builtin_powif / __powisf2Georg-Johann Lay2-1/+157
Implement __powisf2 in assembly. PR target/114981 libgcc/ * config/avr/t-avr (LIB2FUNCS_EXCLUDE): Add _powisf2. (LIB1ASMFUNCS) [!avrtiny]: Add _powif. * config/avr/lib1funcs.S (mov4): New .macro. (L_powif, __powisf2) [!avrtiny]: New module and function. gcc/testsuite/ * gcc.target/avr/pr114981-powif.c: New test. (cherry picked from commit af64af69c3cc85dbe00c520651a54850bf5cadc1)
2024-05-09Daily bump.GCC Administrator1-0/+11
2024-05-09AVR: target/114981 - Support __builtin_powi[l] / __powidf2.Georg-Johann Lay3-8/+35
This supports __powidf2 by means of a double wrapper for already existing f7_powi (renamed to __f7_powi by f7-renames.h). It tweaks the implementation so that it does not perform trivial multiplications with 1.0 any more, but instead uses a move. It also fixes the last statement of f7_powi, which was wrong. Notice that f7_powi was unused until now. PR target/114981 libgcc/config/avr/libf7/ * libf7-common.mk (F7_ASM_PARTS): Add D_powi * libf7-asm.sx (F7MOD_D_powi_, __powidf2): New module and function. * libf7.c (f7_powi): Fix last (wrong) statement. Tweak trivial multiplications with 1.0. gcc/testsuite/ * gcc.target/avr/pr114981-powil.c: New test. (cherry picked from commit de4eea7d7ea86e54843507c68d6672eca9d8c7bb)
2024-05-07Update ChangeLog and version files for releasereleases/gcc-14.1.0Jakub Jelinek3-0/+12
2024-05-01Daily bump.GCC Administrator1-0/+8
2024-04-30libgcc: Do use weakrefs for glibc 2.34 on GNU HurdJakub Jelinek1-1/+1
On Mon, Apr 29, 2024 at 01:44:24PM +0000, Joseph Myers wrote: > > glibc 2.34 and later doesn't have separate libpthread (libpthread.so.0 is a > > dummy shared library with just some symbol versions for compatibility, but > > all the pthread_* APIs are in libc.so.6). > > I suspect this has caused link failures in the glibc testsuite for Hurd, > which still has separate libpthread. > > https://sourceware.org/pipermail/libc-testresults/2024q2/012556.html So like this then? 2024-04-30 Jakub Jelinek <jakub@redhat.com> * gthr.h (GTHREAD_USE_WEAK): Don't redefine to 0 for glibc 2.34+ on GNU Hurd. (cherry picked from commit 3146a92a77f1fccec71a880c7f890a1251aeab41)
2024-04-26Daily bump.GCC Administrator1-0/+4
2024-04-25libgcc: Don't use weakrefs for glibc 2.34Jakub Jelinek1-0/+9
glibc 2.34 and later doesn't have separate libpthread (libpthread.so.0 is a dummy shared library with just some symbol versions for compatibility, but all the pthread_* APIs are in libc.so.6). So, we don't need to do the .weakref dances to check whether a program has been linked with -lpthread or not, in dynamically linked apps those will be always true anyway. In -static linking, this fixes various issues people had when only linking some parts of libpthread.a and getting weird crashes. A hack for that was what e.g. some Fedora glibcs used, where libpthread.a was a library containing just one giant *.o file which had all the normal libpthread.a *.o files linked with -r together. libstdc++-v3 actually does something like this already since r10-10928, the following patch is meant to fix it even for libgfortran, libobjc and whatever else uses gthr.h. 2024-04-25 Jakub Jelinek <jakub@redhat.com> * gthr.h (GTHREAD_USE_WEAK): Redefine to 0 for GLIBC 2.34 or later.
2024-04-22Daily bump.GCC Administrator1-0/+5
2024-04-21AVR: target/114794 - Tweak __udivmodqi4Georg-Johann Lay1-3/+3
libgcc/ PR target/114794 * config/avr/lib1funcs.S (__udivmodqi4): Tweak.
2024-04-20Daily bump.GCC Administrator1-0/+8
2024-04-19libgcc: Another __divmodbitint4 bug fix [PR114762]Jakub Jelinek1-3/+10
The following testcase is miscompiled because the code to decrement vn on negative value with all ones in most significant limb (even partial) and 0 in most significant bit of the second most significant limb doesn't take into account the case where all bits below the most significant limb are zero. This has been a problem both in the version before yesterday's commit where it has been done only if un was one shorter than vn before this decrement, and is now problem even more often when it is done earlier. When we decrement vn in such case and negate it, we end up with all 0s in the v2 value, so have both the problems with UB on __builtin_clz* and the expectations of the algorithm that the divisor has most significant bit set after shifting, plus when the decremented vn is 1 it can SIGFPE on division by zero even when it is not division by zero etc. Other values shouldn't get 0 in the new most significant limb after negation, because the bitint_reduce_prec canonicalization should reduce prec if the second most significant limb is all ones and if that limb is all zeros, if at least one limb below it is non-zero, carry in will make it non-zero. The following patch fixes it by checking if at least one bit below the most significant limb is non-zero, in that case it decrements, otherwise it will do nothing (but e.g. for the un < vn case that also means the divisor is large enough that the result should be q 0 r u). 2024-04-18 Jakub Jelinek <jakub@redhat.com> PR libgcc/114762 * libgcc2.c (__divmodbitint4): Perform the decrement on negative v with most significant limb all ones and the second least significant limb with most significant bit clear always, regardless of un < vn. * gcc.dg/torture/bitint-70.c: New test.
2024-04-19Daily bump.GCC Administrator1-0/+8
2024-04-18libgcc: Fix up __divmodbitint4 [PR114755]Jakub Jelinek1-56/+49
The following testcase aborts on aarch64-linux but does not on x86_64-linux. In both cases there is UB in the __divmodbitint4 implemenetation. When the divisor is negative with most significant limb (even when partial) all ones, has at least 2 limbs and the second most significant limb has the most significant bit clear, when this number is negated, it will have 0 in the most significant limb. Already in the PR114397 r14-9592 fix I was dealing with such divisors, but thought the problem is only if because of that un < vn doesn't imply the quotient is 0 and remainder u. But as this testcase shows, the problem is with such divisors always. What happens is that we use __builtin_clz* on the most significant limb, and assume it will not be 0 because that is UB for the builtins. Normally the most significant limb of the divisor shouldn't be 0, as guaranteed by the bitint_reduce_prec e.g. for the positive numbers, unless the divisor is just 0 (but for vn == 1 we have special cases). The following patch moves the handling of this corner case a few lines earlier before the un < vn check, because adjusting the vn later is harder. 2024-04-18 Jakub Jelinek <jakub@redhat.com> PR libgcc/114755 * libgcc2.c (__divmodbitint4): Perform the decrement on negative v with most significant limb all ones and the second least significant limb with most significant bit clear always, regardless of un < vn. * gcc.dg/torture/bitint-69.c: New test.
2024-04-16Daily bump.GCC Administrator1-0/+7
2024-04-15m68k: Quiet up cppcheck warning [PR114689]Jakub Jelinek1-1/+1
cppcheck apparently warns on the | !!sticky part of the expression and using | (!!sticky) quiets it up (it is correct as is). The following patch adds the ()s, and also adds them around mant >> 1 just in case it makes it clearer to all readers that the expression is parsed that way already. 2024-04-15 Jakub Jelinek <jakub@redhat.com> PR libgcc/114689 * config/m68k/fpgnulib.c (__truncdfsf2): Add parentheses around !!sticky bitwise or operand to quiet up cppcheck. Add parentheses around mant >> 1 bitwise or operand.
2024-04-11Daily bump.GCC Administrator1-0/+7
2024-04-10aarch64: Add support for _BitIntAndre Vieira2-1/+10
This patch adds support for C23's _BitInt for the AArch64 port when compiling for little endianness. Big Endianness requires further target-agnostic support and we therefor disable it for now. gcc/ChangeLog: * config/aarch64/aarch64.cc (TARGET_C_BITINT_TYPE_INFO): Declare MACRO. (aarch64_bitint_type_info): New function. (aarch64_return_in_memory_1): Return large _BitInt's in memory. (aarch64_function_arg_alignment): Adapt to correctly return the ABI mandated alignment of _BitInt(N) where N > 128 as the alignment of TImode. (aarch64_composite_type_p): Return true for _BitInt(N), where N > 128. libgcc/ChangeLog: * config/aarch64/t-softfp (softfp_extras): Add floatbitinthf, floatbitintbf, floatbitinttf and fixtfbitint. * config/aarch64/libgcc-softfp.ver (GCC_14.0.0): Add __floatbitinthf, __floatbitintbf, __floatbitinttf and __fixtfbitint. gcc/testsuite/ChangeLog: * gcc.target/aarch64/bitint-alignments.c: New test. * gcc.target/aarch64/bitint-args.c: New test. * gcc.target/aarch64/bitint-sizes.c: New test. * gcc.target/aarch64/bitfield-bitint-abi.h: New header. * gcc.target/aarch64/bitfield-bitint-abi-align16.c: New test. * gcc.target/aarch64/bitfield-bitint-abi-align8.c: New test.
2024-04-10Daily bump.GCC Administrator1-0/+7