diff --git a/toolchain/gcc/patches/11.3.0/001-Revert-Cleanup-range-of-address-calculations.patch b/toolchain/gcc/patches/11.3.0/001-Revert-Cleanup-range-of-address-calculations.patch deleted file mode 100644 index a97e061d6b..0000000000 --- a/toolchain/gcc/patches/11.3.0/001-Revert-Cleanup-range-of-address-calculations.patch +++ /dev/null @@ -1,160 +0,0 @@ -From: Felix Fietkau -Date: Tue, 16 Nov 2021 10:39:51 +0100 -Subject: [PATCH] Revert "Cleanup range of address calculations." - -This reverts commit 47923622c663ffad8b14aa93706183290d4f6791. -This commit is causing issues with offset of struct members. - -https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103255 ---- - delete mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr78655.c - ---- a/gcc/gimple-range.cc -+++ b/gcc/gimple-range.cc -@@ -431,9 +431,8 @@ gimple_ranger::range_of_range_op (irange - m_cache.register_dependency (lhs, op2); - } - -- if (gimple_code (s) == GIMPLE_ASSIGN -- && gimple_assign_rhs_code (s) == ADDR_EXPR) -- return range_of_address (r, s); -+ if (range_of_non_trivial_assignment (r, s)) -+ return true; - - if (range_of_expr (range1, op1, s)) - { -@@ -447,84 +446,48 @@ gimple_ranger::range_of_range_op (irange - return true; - } - --// Calculate the range of an assignment containing an ADDR_EXPR. -+// Calculate the range of a non-trivial assignment. That is, is one -+// inolving arithmetic on an SSA name (for example, an ADDR_EXPR). - // Return the range in R. --// If a range cannot be calculated, set it to VARYING and return true. -+// -+// If a range cannot be calculated, return false. - - bool --gimple_ranger::range_of_address (irange &r, gimple *stmt) -+gimple_ranger::range_of_non_trivial_assignment (irange &r, gimple *stmt) - { -- gcc_checking_assert (gimple_code (stmt) == GIMPLE_ASSIGN); -- gcc_checking_assert (gimple_assign_rhs_code (stmt) == ADDR_EXPR); -+ if (gimple_code (stmt) != GIMPLE_ASSIGN) -+ return false; - -- bool strict_overflow_p; -- tree expr = gimple_assign_rhs1 (stmt); -- poly_int64 bitsize, bitpos; -- tree offset; -- machine_mode mode; -- int unsignedp, reversep, volatilep; -- tree base = get_inner_reference (TREE_OPERAND (expr, 0), &bitsize, -- &bitpos, &offset, &mode, &unsignedp, -- &reversep, &volatilep); -- -- -- if (base != NULL_TREE -- && TREE_CODE (base) == MEM_REF -- && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) -+ tree base = gimple_range_base_of_assignment (stmt); -+ if (base) - { -- tree ssa = TREE_OPERAND (base, 0); -- gcc_checking_assert (irange::supports_type_p (TREE_TYPE (ssa))); -- range_of_expr (r, ssa, stmt); -- range_cast (r, TREE_TYPE (gimple_assign_rhs1 (stmt))); -- -- poly_offset_int off = 0; -- bool off_cst = false; -- if (offset == NULL_TREE || TREE_CODE (offset) == INTEGER_CST) -+ if (TREE_CODE (base) == MEM_REF) - { -- off = mem_ref_offset (base); -- if (offset) -- off += poly_offset_int::from (wi::to_poly_wide (offset), -- SIGNED); -- off <<= LOG2_BITS_PER_UNIT; -- off += bitpos; -- off_cst = true; -+ if (TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) -+ { -+ int_range_max range1; -+ tree ssa = TREE_OPERAND (base, 0); -+ if (range_of_expr (range1, ssa, stmt)) -+ { -+ tree type = TREE_TYPE (ssa); -+ range_operator *op = range_op_handler (POINTER_PLUS_EXPR, -+ type); -+ int_range<2> offset (TREE_OPERAND (base, 1), -+ TREE_OPERAND (base, 1)); -+ op->fold_range (r, type, range1, offset); -+ return true; -+ } -+ } -+ return false; - } -- /* If &X->a is equal to X, the range of X is the result. */ -- if (off_cst && known_eq (off, 0)) -- return true; -- else if (flag_delete_null_pointer_checks -- && !TYPE_OVERFLOW_WRAPS (TREE_TYPE (expr))) -- { -- /* For -fdelete-null-pointer-checks -fno-wrapv-pointer we don't -- allow going from non-NULL pointer to NULL. */ -- if(!range_includes_zero_p (&r)) -- return true; -- } -- /* If MEM_REF has a "positive" offset, consider it non-NULL -- always, for -fdelete-null-pointer-checks also "negative" -- ones. Punt for unknown offsets (e.g. variable ones). */ -- if (!TYPE_OVERFLOW_WRAPS (TREE_TYPE (expr)) -- && off_cst -- && known_ne (off, 0) -- && (flag_delete_null_pointer_checks || known_gt (off, 0))) -+ if (gimple_assign_rhs_code (stmt) == ADDR_EXPR) - { -+ // Handle "= &a" and return non-zero. - r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt))); - return true; - } -- r = int_range<2> (TREE_TYPE (gimple_assign_rhs1 (stmt))); -- return true; -- } -- -- // Handle "= &a". -- if (tree_single_nonzero_warnv_p (expr, &strict_overflow_p)) -- { -- r = range_nonzero (TREE_TYPE (gimple_assign_rhs1 (stmt))); -- return true; - } -- -- // Otherwise return varying. -- r = int_range<2> (TREE_TYPE (gimple_assign_rhs1 (stmt))); -- return true; -+ return false; - } - - // Calculate a range for phi statement S and return it in R. ---- a/gcc/gimple-range.h -+++ b/gcc/gimple-range.h -@@ -62,7 +62,7 @@ protected: - ranger_cache m_cache; - private: - bool range_of_phi (irange &r, gphi *phi); -- bool range_of_address (irange &r, gimple *s); -+ bool range_of_non_trivial_assignment (irange &r, gimple *s); - bool range_of_builtin_call (irange &r, gcall *call); - bool range_with_loop_info (irange &r, tree name); - void range_of_ssa_name_with_loop_info (irange &, tree, class loop *, ---- a/gcc/range-op.cc -+++ b/gcc/range-op.cc -@@ -3447,7 +3447,6 @@ pointer_table::pointer_table () - set (GT_EXPR, op_gt); - set (GE_EXPR, op_ge); - set (SSA_NAME, op_identity); -- set (INTEGER_CST, op_integer_cst); - set (ADDR_EXPR, op_addr); - set (NOP_EXPR, op_convert); - set (CONVERT_EXPR, op_convert); diff --git a/toolchain/gcc/patches/11.3.0/930-fix-mips-noexecstack.patch b/toolchain/gcc/patches/11.3.0/930-fix-mips-noexecstack.patch deleted file mode 100644 index 591dfe5a50..0000000000 --- a/toolchain/gcc/patches/11.3.0/930-fix-mips-noexecstack.patch +++ /dev/null @@ -1,111 +0,0 @@ -From da45b3fde60095756f5f6030f6012c23a3d34429 Mon Sep 17 00:00:00 2001 -From: Andrew McDonnell -Date: Fri, 3 Oct 2014 19:09:00 +0930 -Subject: Add .note.GNU-stack section - -See http://lists.busybox.net/pipermail/uclibc/2014-October/048671.html -Below copied from https://gcc.gnu.org/ml/gcc-patches/2014-09/msg02430.html - -Re: [Patch, MIPS] Add .note.GNU-stack section - - From: Steve Ellcey - -On Wed, 2014-09-10 at 10:15 -0700, Eric Christopher wrote: -> -> -> On Wed, Sep 10, 2014 at 9:27 AM, wrote: - -> This works except you did not update the assembly files in -> libgcc or glibc. We (Cavium) have the same patch in our tree -> for a few released versions. - -> Mind just checking yours in then Andrew? - -> Thanks! -> -eric - -I talked to Andrew about what files he changed in GCC and created and -tested this new patch. Andrew also mentioned changing some assembly -files in glibc but I don't see any use of '.section .note.GNU-stack' in -any assembly files in glibc (for any platform) so I wasn't planning on -creating a glibc to add them to mips glibc assembly language files. - -OK to check in this patch? - -Steve Ellcey -sellcey@mips.com - - - -2014-09-26 Steve Ellcey ---- - gcc/config/mips/mips.c | 3 +++ - libgcc/config/mips/crti.S | 4 ++++ - libgcc/config/mips/crtn.S | 3 +++ - libgcc/config/mips/mips16.S | 4 ++++ - libgcc/config/mips/vr4120-div.S | 4 ++++ - 5 files changed, 18 insertions(+) - ---- a/gcc/config/mips/mips.c -+++ b/gcc/config/mips/mips.c -@@ -22890,6 +22890,9 @@ mips_asm_file_end (void) - #define TARGET_ASM_FILE_END mips_asm_file_end - - -+#undef TARGET_ASM_FILE_END -+#define TARGET_ASM_FILE_END file_end_indicate_exec_stack -+ - struct gcc_target targetm = TARGET_INITIALIZER; - - #include "gt-mips.h" ---- a/libgcc/config/mips/crti.S -+++ b/libgcc/config/mips/crti.S -@@ -24,6 +24,10 @@ see the files COPYING3 and COPYING.RUNTI - /* An executable stack is *not* required for these functions. */ - #include "gnustack.h" - -+ -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ - /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. - Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ - ---- a/libgcc/config/mips/crtn.S -+++ b/libgcc/config/mips/crtn.S -@@ -24,6 +24,9 @@ see the files COPYING3 and COPYING.RUNTI - /* An executable stack is *not* required for these functions. */ - #include "gnustack.h" - -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ - /* 4 slots for argument spill area. 1 for cpreturn, 1 for stack. - Return spill offset of 40 and 20. Aligned to 16 bytes for n32. */ - ---- a/libgcc/config/mips/mips16.S -+++ b/libgcc/config/mips/mips16.S -@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI - values using the soft-float calling convention, but do the actual - operation using the hard floating point instructions. */ - -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ .previous -+ - #if defined _MIPS_SIM && (_MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIO64) - - /* This file contains 32-bit assembly code. */ ---- a/libgcc/config/mips/vr4120-div.S -+++ b/libgcc/config/mips/vr4120-div.S -@@ -29,6 +29,10 @@ see the files COPYING3 and COPYING.RUNTI - -mfix-vr4120. div and ddiv do not give the correct result when one - of the operands is negative. */ - -+/* An executable stack is *not* required for these functions. */ -+ .section .note.GNU-stack,"",%progbits -+ .previous -+ - .set nomips16 - - #define DIV \