mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
gcc : upgrade to v13.3
gcc stable version upgraded from v13.2 to v13.3 Dropped CVE-2023-4039.patch, CVE-2024-0151.patch and 0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch because its been taken to gcc-13.3 with below commits 71a2aa2127283f450c623d3604dbcabe0e14a8d4, 5550214b58e95320b54e42ef0e37c6479e04b27b and 4bb1ae3c13ce4fb72129229de66f5ffbcd45fe4c respectively. For changes in v13.3 see: https://gcc.gnu.org/onlinedocs/gcc-13.3.0/gcc/ Below is the bug fix list for v13.3 https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&list_id=429106&resolution=FIXED&target_milestone=13.3 There are a total 173 bugs are fixed in this release, below is the list of bugs fixed excluding the regression fixes. ID Product Comp Assignee▲ Summary 114408 gcc analyzer dmalcolm ICE when invoking strcmp multiple times with -fsanitize=undefined -O1 -fanalyzer -flto 109251 gcc analyzer dmalcolm -Wanalyzer-deref-before-check false positives seen in Linux kernel due to check in macros 114473 gcc analyzer dmalcolm ICE: in deref_rvalue, at analyzer/region-model.cc:2780 with -fanalyzer -fanalyzer-call-summaries 100988 gcc fortran anlauf Missed optimization: RESTRICT missing for optional arguments 112764 gcc fortran anlauf Associating entity does not have target attribute if selector has pointer attribute in associate block 114001 gcc fortran anlauf is_contiguous considers unlimited polymorphic dummy always as contiguous 112787 gcc target avieira Codegen regression of large GCC vector extensions when enabling SVE 114160 gcc target cmuellner ICE on RISCV (-mcpu=thead-c906) when building glibc in dwarf2out_frame_debug_cfa_offset 110882 gcc analyzer dmalcolm ICE with -fanalyzer on zero-sized array 111289 gcc analyzer dmalcolm Unwarranted -Wanalyzer-va-arg-type-mismatch warning 112790 gcc analyzer dmalcolm Wanalyzer-deref-before-check false positives seen in Linux kernel due to inlining 112792 gcc analyzer dmalcolm Wanalyzer-out-of-bounds false positives seen on Linux kernel with certain unions 114316 gcc libstdc+ fdumont assert failure with _GLIBCXX_DEBUG and empty range of singular iterators passed to std:: algorithm 108121 gcc modula2 gaius Failing tests on x86_64-linux-gnu 110754 gcc middle-e jakub assume create spurious load for volatile variable 105456 gcc libfortr jvdelisle Child I/O does not propage iostat 114747 gcc target kito Wrong SEW set for mixed-size intrinsics 104831 gcc target patrick RISCV libatomic LR.aq/SC.rl pair insufficient for SEQ_CST 108174 gcc target pinskia ICE: tree check: expected function_type or method_type, have ggc_freed in aarch64_resolve_overloaded_memtag, at config/aarch64/aarch64-builtins.cc:3349 114314 gcc driver pinskia ICE: in common_handle_option, at opts.cc:3356 with -fno-multiflags 99493 gcc c++ ppalka Address of template parameter object is not a valid template argument 99631 gcc c++ ppalka decltype of non-type template-parameter shouldn't be const 104634 gcc c++ ppalka Explicit template instantiation does not work when there are multiple partial template specialization using concepts 110809 gcc c++ ppalka ICE: in unify, at cp/pt.cc:25226 with floating-point NTTPs 110927 gcc c++ ppalka GCC fails to parse dependent type in concept through partial specialization 111493 gcc c++ ppalka multidimensional subscript operator inside requires is broken 113242 gcc c++ ppalka g++ rejects-valid template argument of class type containing an lvalue reference 113529 gcc c++ ppalka Incorrect result of requires-expression in case of function call ambiguity and `operator<=>` 108046 gcc libstdc+ redi The dot in the floating-point alternative form has wrong position 110708 gcc libstdc+ redi std::format("{:%EEC %OOd}", std::chrono::system_clock::now()) should be rejected 2023-07-28 110719 gcc libstdc+ redi Should chrono formatters always use std::time_put for locale's representation? 110860 gcc libstdc+ redi std::format("{:f}",2e304) invokes undefined behaviour 110862 gcc libstdc+ redi format out of bounds read on format string "{0:{0}" 110917 gcc libstdc+ redi std::format_to(int*, ...) fails to compile because of _S_make_span 110944 gcc libstdc+ redi std::variant & optional GDB representation is too verbose 110968 gcc libstdc+ redi format out of bounds read on format("{:05L}",-1.f) 110970 gcc libstdc+ redi clang / c++23 missing 'typename' prior to dependent type name 110990 gcc libstdc+ redi `format_to_n` returns wrong value 111511 gcc libstdc+ redi Incorrect ADL in std::to_array in GCC 11/12/13 111826 gcc libstdc+ redi __cpp_lib_format should be 202110, not 202106 111948 gcc libstdc+ redi subrange modifies a const size object 112607 gcc libstdc+ redi _Normalize does not consider char_type for the basic_string_view case 112832 gcc libstdc+ redi Broken non-SFINAE-friendly `set_debug_format()` for `const char *` formatter 113500 gcc libstdc+ redi Using std::format with float or double based std::chrono::time_point causes error: no match for 'operator<<' 13512 gcc libstdc+ redi Incorrect results for std::format("{:#.3g}", flt) 114103 gcc libstdc+ redi FAIL: 29_atomics/atomic/lock_free_aliases.cc -std=gnu++20 (test for excess errors) 114152 gcc libstdc+ redi Wrong exception specifiers for LFTSv3 scope guard destructors 114863 gcc libstdc+ redi std::format applying grouping to nan's and inf's 115063 gcc libstdc+ redi compilation error: std::basic_stracktrace::max_size() 105523 gcc target saaadhu Wrong warning array subscript [0] is outside array bounds 93370 gcc target unassigned Aarch64 accepts but ignores target("+sm4") unless ARMv8.2-A is enabled 93762 gcc fortran unassigned Truncation of deferred-length string when passing as optional 100285 gcc libstdc+ unassigned experimental/net/socket/socket_base.cc fails on arm-eabi (r12-137) 106037 gcc ada unassigned internal error with Aggregate aspect on array type 110127 gcc c++ unassigned -fimplicit-constexpr leads to extremely slow and memory intensive compilation 110133 gcc libstdc+ unassigned System error message should ideally use strerror_r over strerror 110974 gcc libstdc+ unassigned format out of bounds read on invalid format string "{:{}." 111102 gcc libstdc+ unassigned illegal pointer arithmetic invoked by std::format("L{:65536}",1) 112480 gcc libstdc+ unassigned optional<T>::reset emits inefficient code when T is trivially-destructible 113294 gcc libstdc+ unassigned constexpr error from accessing inactive union member in basic_string after move assignment 113815 gcc ada unassigned error: there is no applicable operator "*" for a string type 113824 gcc target unassigned AVR: ATA5795 in wrong multilib set 2024-02-08 113850 gcc libgcc unassigned condition variables timed wait does a lot of spurious wakeups on Win32 threading implementation 113927 gcc target unassigned Sets up a stack-frame even for trivial code 114136 gcc middle-e unassigned wrong code for c23 fully anonymous arg lists on arm 97245 gcc fortran anlauf ASSOCIATED intrinsic does not recognize a pointer variable the second time it is used 101135 gcc fortran anlauf Load of null pointer when passing absent assumed-shape array argument for an optional dummy argument 110825 gcc fortran anlauf TYPE(*) dummy argument to generate an unused hidden argument 110826 gcc fortran anlauf Fortran array of derived type with a pointer to function with dimensional arguments fails 113799 gcc fortran anlauf gfc_replace_expr: double free detected ? 114012 gcc fortran anlauf overloaded unary operator called twice 113601 gcc target gjl avr: Wrong SRAM start for ATmega3208 and ATmega3209 107201 gcc target unassigned -nodevicelib not working for devices -mmcu=avr... 114024 gcc fortran unassigned ICE allocate statement with source=cmp%re and z an array 53372 gcc target unassigned Section attribute ignored with address space 112952 gcc target unassigned avr: attribute address not working with -fdata-sections -fno-common 114752 gcc target unassigned AVR: internal compiler error. Unknown mode: const_double:DF 114794 gcc target unassigned Speed up udivmodqi4 (From OE-Core rev: 20b94a6f3681afc9d5f7c07d571fcc47efcc9827) Signed-off-by: Deepthi Hemraj <Deepthi.Hemraj@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
fdfdd7b319
commit
fa18cd0932
@@ -190,7 +190,7 @@ RECIPE_MAINTAINER:pn-gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Khem Raj <r
|
||||
RECIPE_MAINTAINER:pn-gcc-crosssdk-${SDK_SYS} = "Khem Raj <raj.khem@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-gcc-runtime = "Khem Raj <raj.khem@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-gcc-sanitizers = "Khem Raj <raj.khem@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-gcc-source-13.2.0 = "Khem Raj <raj.khem@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-gcc-source-13.3.0 = "Khem Raj <raj.khem@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-gconf = "Ross Burton <ross.burton@arm.com>"
|
||||
RECIPE_MAINTAINER:pn-gcr = "Alexander Kanavin <alex.kanavin@gmail.com>"
|
||||
RECIPE_MAINTAINER:pn-gdb = "Khem Raj <raj.khem@gmail.com>"
|
||||
|
||||
@@ -2,11 +2,11 @@ require gcc-common.inc
|
||||
|
||||
# Third digit in PV should be incremented after a minor release
|
||||
|
||||
PV = "13.2.0"
|
||||
PV = "13.3.0"
|
||||
|
||||
# BINV should be incremented to a revision after a minor gcc release
|
||||
|
||||
BINV = "13.2.0"
|
||||
BINV = "13.3.0"
|
||||
|
||||
FILESEXTRAPATHS =. "${FILE_DIRNAME}/gcc:${FILE_DIRNAME}/gcc/backport:"
|
||||
|
||||
@@ -65,12 +65,9 @@ SRC_URI = "${BASEURI} \
|
||||
file://0023-Fix-install-path-of-linux64.h.patch \
|
||||
file://0024-Avoid-hardcoded-build-paths-into-ppc-libgcc.patch \
|
||||
file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \
|
||||
file://CVE-2023-4039.patch \
|
||||
file://0026-aarch64-Fix-loose-ldpstp-check-PR111411.patch \
|
||||
file://0027-Fix-gcc-vect-module-testcases.patch \
|
||||
file://CVE-2024-0151.patch \
|
||||
"
|
||||
SRC_URI[sha256sum] = "e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da"
|
||||
SRC_URI[sha256sum] = "0845e9621c9543a13f484e94584a49ffc0129970e9914624235fc1d061a0c083"
|
||||
|
||||
S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}"
|
||||
B = "${WORKDIR}/gcc-${PV}/build.${HOST_SYS}.${TARGET_SYS}"
|
||||
@@ -165,16 +165,21 @@ diff --git a/gcc/config/loongarch/gnu-user.h b/gcc/config/loongarch/gnu-user.h
|
||||
index aecaa02a199..62f88f7f9a2 100644
|
||||
--- a/gcc/config/loongarch/gnu-user.h
|
||||
+++ b/gcc/config/loongarch/gnu-user.h
|
||||
@@ -31,11 +31,11 @@ along with GCC; see the file COPYING3. If not see
|
||||
@@ -31,16 +31,16 @@ along with GCC; see the file COPYING3. If not see
|
||||
|
||||
#undef GLIBC_DYNAMIC_LINKER
|
||||
#define GLIBC_DYNAMIC_LINKER \
|
||||
- "/lib" ABI_GRLEN_SPEC "/ld-linux-loongarch-" ABI_SPEC ".so.1"
|
||||
+ SYSTEMLIBS_DIR "ld-linux-loongarch-" ABI_SPEC ".so.1"
|
||||
|
||||
#define MUSL_ABI_SPEC \
|
||||
"%{mabi=lp64d:}" \
|
||||
"%{mabi=lp64f:-sp}" \
|
||||
"%{mabi=lp64s:-sf}"
|
||||
|
||||
#undef MUSL_DYNAMIC_LINKER
|
||||
#define MUSL_DYNAMIC_LINKER \
|
||||
- "/lib" ABI_GRLEN_SPEC "/ld-musl-loongarch-" ABI_SPEC ".so.1"
|
||||
- "/lib/ld-musl-loongarch" ABI_GRLEN_SPEC MUSL_ABI_SPEC ".so.1"
|
||||
+ SYSTEMLIBS_DIR "ld-musl-loongarch-" ABI_SPEC ".so.1"
|
||||
|
||||
#undef GNU_USER_TARGET_LINK_SPEC
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
From adb60dc78e0da4877747f32347cee339364775be Mon Sep 17 00:00:00 2001
|
||||
From: Richard Sandiford <richard.sandiford@arm.com>
|
||||
Date: Fri, 15 Sep 2023 09:19:14 +0100
|
||||
Subject: [PATCH] aarch64: Fix loose ldpstp check [PR111411]
|
||||
|
||||
aarch64_operands_ok_for_ldpstp contained the code:
|
||||
|
||||
/* One of the memory accesses must be a mempair operand.
|
||||
If it is not the first one, they need to be swapped by the
|
||||
peephole. */
|
||||
if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1))
|
||||
&& !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2)))
|
||||
return false;
|
||||
|
||||
But the requirement isn't just that one of the accesses must be a
|
||||
valid mempair operand. It's that the lower access must be, since
|
||||
that's the access that will be used for the instruction operand.
|
||||
|
||||
gcc/
|
||||
PR target/111411
|
||||
* config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp): Require
|
||||
the lower memory access to a mem-pair operand.
|
||||
|
||||
gcc/testsuite/
|
||||
PR target/111411
|
||||
* gcc.dg/rtl/aarch64/pr111411.c: New test.
|
||||
|
||||
Upstream-Status: Backport [https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=2d38f45bcca62ca0c7afef4b579f82c5c2a01610]
|
||||
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
|
||||
---
|
||||
gcc/config/aarch64/aarch64.cc | 8 ++-
|
||||
gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c | 57 +++++++++++++++++++++
|
||||
2 files changed, 60 insertions(+), 5 deletions(-)
|
||||
create mode 100644 gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c
|
||||
|
||||
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
|
||||
index 6118a3354ac..9b1f791ca8b 100644
|
||||
--- a/gcc/config/aarch64/aarch64.cc
|
||||
+++ b/gcc/config/aarch64/aarch64.cc
|
||||
@@ -26154,11 +26154,9 @@ aarch64_operands_ok_for_ldpstp (rtx *operands, bool load,
|
||||
gcc_assert (known_eq (GET_MODE_SIZE (GET_MODE (mem_1)),
|
||||
GET_MODE_SIZE (GET_MODE (mem_2))));
|
||||
|
||||
- /* One of the memory accesses must be a mempair operand.
|
||||
- If it is not the first one, they need to be swapped by the
|
||||
- peephole. */
|
||||
- if (!aarch64_mem_pair_operand (mem_1, GET_MODE (mem_1))
|
||||
- && !aarch64_mem_pair_operand (mem_2, GET_MODE (mem_2)))
|
||||
+ /* The lower memory access must be a mem-pair operand. */
|
||||
+ rtx lower_mem = reversed ? mem_2 : mem_1;
|
||||
+ if (!aarch64_mem_pair_operand (lower_mem, GET_MODE (lower_mem)))
|
||||
return false;
|
||||
|
||||
if (REG_P (reg_1) && FP_REGNUM_P (REGNO (reg_1)))
|
||||
diff --git a/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c
|
||||
new file mode 100644
|
||||
index 00000000000..ad07e9c6c89
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/gcc.dg/rtl/aarch64/pr111411.c
|
||||
@@ -0,0 +1,57 @@
|
||||
+/* { dg-do compile { target aarch64*-*-* } } */
|
||||
+/* { dg-require-effective-target lp64 } */
|
||||
+/* { dg-options "-O -fdisable-rtl-postreload -fpeephole2 -fno-schedule-fusion" } */
|
||||
+
|
||||
+extern int data[];
|
||||
+
|
||||
+void __RTL (startwith ("ira")) foo (void *ptr)
|
||||
+{
|
||||
+ (function "foo"
|
||||
+ (param "ptr"
|
||||
+ (DECL_RTL (reg/v:DI <0> [ ptr ]))
|
||||
+ (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ]))
|
||||
+ ) ;; param "ptr"
|
||||
+ (insn-chain
|
||||
+ (block 2
|
||||
+ (edge-from entry (flags "FALLTHRU"))
|
||||
+ (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK)
|
||||
+ (insn 4 (set (reg:DI <0>) (reg:DI x0)))
|
||||
+ (insn 5 (set (reg:DI <1>)
|
||||
+ (plus:DI (reg:DI <0>) (const_int 768))))
|
||||
+ (insn 6 (set (mem:SI (plus:DI (reg:DI <0>)
|
||||
+ (const_int 508)) [1 &data+508 S4 A4])
|
||||
+ (const_int 0)))
|
||||
+ (insn 7 (set (mem:SI (plus:DI (reg:DI <1>)
|
||||
+ (const_int -256)) [1 &data+512 S4 A4])
|
||||
+ (const_int 0)))
|
||||
+ (edge-to exit (flags "FALLTHRU"))
|
||||
+ ) ;; block 2
|
||||
+ ) ;; insn-chain
|
||||
+ ) ;; function
|
||||
+}
|
||||
+
|
||||
+void __RTL (startwith ("ira")) bar (void *ptr)
|
||||
+{
|
||||
+ (function "bar"
|
||||
+ (param "ptr"
|
||||
+ (DECL_RTL (reg/v:DI <0> [ ptr ]))
|
||||
+ (DECL_RTL_INCOMING (reg/v:DI x0 [ ptr ]))
|
||||
+ ) ;; param "ptr"
|
||||
+ (insn-chain
|
||||
+ (block 2
|
||||
+ (edge-from entry (flags "FALLTHRU"))
|
||||
+ (cnote 3 [bb 2] NOTE_INSN_BASIC_BLOCK)
|
||||
+ (insn 4 (set (reg:DI <0>) (reg:DI x0)))
|
||||
+ (insn 5 (set (reg:DI <1>)
|
||||
+ (plus:DI (reg:DI <0>) (const_int 768))))
|
||||
+ (insn 6 (set (mem:SI (plus:DI (reg:DI <1>)
|
||||
+ (const_int -256)) [1 &data+512 S4 A4])
|
||||
+ (const_int 0)))
|
||||
+ (insn 7 (set (mem:SI (plus:DI (reg:DI <0>)
|
||||
+ (const_int 508)) [1 &data+508 S4 A4])
|
||||
+ (const_int 0)))
|
||||
+ (edge-to exit (flags "FALLTHRU"))
|
||||
+ ) ;; block 2
|
||||
+ ) ;; insn-chain
|
||||
+ ) ;; function
|
||||
+}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,315 +0,0 @@
|
||||
arm: Zero/Sign extends for CMSE security
|
||||
|
||||
This patch makes the following changes:
|
||||
|
||||
1) When calling a secure function from non-secure code then any arguments
|
||||
smaller than 32-bits that are passed in registers are zero- or sign-extended.
|
||||
2) After a non-secure function returns into secure code then any return value
|
||||
smaller than 32-bits that is passed in a register is zero- or sign-extended.
|
||||
|
||||
This patch addresses the following CVE-2024-0151.
|
||||
|
||||
gcc/ChangeLog:
|
||||
PR target/114837
|
||||
* config/arm/arm.cc (cmse_nonsecure_call_inline_register_clear):
|
||||
Add zero/sign extend.
|
||||
(arm_expand_prologue): Add zero/sign extend.
|
||||
|
||||
gcc/testsuite/ChangeLog:
|
||||
|
||||
* gcc.target/arm/cmse/extend-param.c: New test.
|
||||
* gcc.target/arm/cmse/extend-return.c: New test.
|
||||
|
||||
CVE: CVE-2024-0151
|
||||
Upstream-Status: Backport [https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649973.html]
|
||||
Signed-off-by: Mark Hatle <mark.hatle@amd.com>
|
||||
|
||||
diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
|
||||
index 0217abc218d60956ce727e6d008d46b9176dddc5..ea0c963a4d67ecd70e1571624e84dfe46d757df9 100644
|
||||
--- a/gcc/config/arm/arm.cc
|
||||
+++ b/gcc/config/arm/arm.cc
|
||||
@@ -19210,6 +19210,30 @@ cmse_nonsecure_call_inline_register_clear (void)
|
||||
end_sequence ();
|
||||
emit_insn_before (seq, insn);
|
||||
|
||||
+ /* The AAPCS requires the callee to widen integral types narrower
|
||||
+ than 32 bits to the full width of the register; but when handling
|
||||
+ calls to non-secure space, we cannot trust the callee to have
|
||||
+ correctly done so. So forcibly re-widen the result here. */
|
||||
+ tree ret_type = TREE_TYPE (fntype);
|
||||
+ if ((TREE_CODE (ret_type) == INTEGER_TYPE
|
||||
+ || TREE_CODE (ret_type) == ENUMERAL_TYPE
|
||||
+ || TREE_CODE (ret_type) == BOOLEAN_TYPE)
|
||||
+ && known_lt (GET_MODE_SIZE (TYPE_MODE (ret_type)), 4))
|
||||
+ {
|
||||
+ machine_mode ret_mode = TYPE_MODE (ret_type);
|
||||
+ rtx extend;
|
||||
+ if (TYPE_UNSIGNED (ret_type))
|
||||
+ extend = gen_rtx_ZERO_EXTEND (SImode,
|
||||
+ gen_rtx_REG (ret_mode, R0_REGNUM));
|
||||
+ else
|
||||
+ extend = gen_rtx_SIGN_EXTEND (SImode,
|
||||
+ gen_rtx_REG (ret_mode, R0_REGNUM));
|
||||
+ emit_insn_after (gen_rtx_SET (gen_rtx_REG (SImode, R0_REGNUM),
|
||||
+ extend), insn);
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+
|
||||
if (TARGET_HAVE_FPCXT_CMSE)
|
||||
{
|
||||
rtx_insn *last, *pop_insn, *after = insn;
|
||||
@@ -23652,6 +23676,51 @@ arm_expand_prologue (void)
|
||||
|
||||
ip_rtx = gen_rtx_REG (SImode, IP_REGNUM);
|
||||
|
||||
+ /* The AAPCS requires the callee to widen integral types narrower
|
||||
+ than 32 bits to the full width of the register; but when handling
|
||||
+ calls to non-secure space, we cannot trust the callee to have
|
||||
+ correctly done so. So forcibly re-widen the result here. */
|
||||
+ if (IS_CMSE_ENTRY (func_type))
|
||||
+ {
|
||||
+ function_args_iterator args_iter;
|
||||
+ CUMULATIVE_ARGS args_so_far_v;
|
||||
+ cumulative_args_t args_so_far;
|
||||
+ bool first_param = true;
|
||||
+ tree arg_type;
|
||||
+ tree fndecl = current_function_decl;
|
||||
+ tree fntype = TREE_TYPE (fndecl);
|
||||
+ arm_init_cumulative_args (&args_so_far_v, fntype, NULL_RTX, fndecl);
|
||||
+ args_so_far = pack_cumulative_args (&args_so_far_v);
|
||||
+ FOREACH_FUNCTION_ARGS (fntype, arg_type, args_iter)
|
||||
+ {
|
||||
+ rtx arg_rtx;
|
||||
+
|
||||
+ if (VOID_TYPE_P (arg_type))
|
||||
+ break;
|
||||
+
|
||||
+ function_arg_info arg (arg_type, /*named=*/true);
|
||||
+ if (!first_param)
|
||||
+ /* We should advance after processing the argument and pass
|
||||
+ the argument we're advancing past. */
|
||||
+ arm_function_arg_advance (args_so_far, arg);
|
||||
+ first_param = false;
|
||||
+ arg_rtx = arm_function_arg (args_so_far, arg);
|
||||
+ gcc_assert (REG_P (arg_rtx));
|
||||
+ if ((TREE_CODE (arg_type) == INTEGER_TYPE
|
||||
+ || TREE_CODE (arg_type) == ENUMERAL_TYPE
|
||||
+ || TREE_CODE (arg_type) == BOOLEAN_TYPE)
|
||||
+ && known_lt (GET_MODE_SIZE (GET_MODE (arg_rtx)), 4))
|
||||
+ {
|
||||
+ if (TYPE_UNSIGNED (arg_type))
|
||||
+ emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
|
||||
+ gen_rtx_ZERO_EXTEND (SImode, arg_rtx));
|
||||
+ else
|
||||
+ emit_set_insn (gen_rtx_REG (SImode, REGNO (arg_rtx)),
|
||||
+ gen_rtx_SIGN_EXTEND (SImode, arg_rtx));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (IS_STACKALIGN (func_type))
|
||||
{
|
||||
rtx r0, r1;
|
||||
diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-param.c b/gcc/testsuite/gcc.target/arm/cmse/extend-param.c
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..01fac7862385f871f3ecc246ede95eea180be025
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/gcc.target/arm/cmse/extend-param.c
|
||||
@@ -0,0 +1,96 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-mcmse" } */
|
||||
+/* { dg-final { check-function-bodies "**" "" "" } } */
|
||||
+
|
||||
+#include <arm_cmse.h>
|
||||
+#include <stdbool.h>
|
||||
+
|
||||
+#define ARRAY_SIZE (256)
|
||||
+char array[ARRAY_SIZE];
|
||||
+
|
||||
+enum offset
|
||||
+{
|
||||
+ zero = 0,
|
||||
+ one = 1,
|
||||
+ two = 2
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+**__acle_se_unsignSecureFunc:
|
||||
+** ...
|
||||
+** uxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+__attribute__((cmse_nonsecure_entry)) char unsignSecureFunc (unsigned char index) {
|
||||
+ if (index >= ARRAY_SIZE)
|
||||
+ return 0;
|
||||
+ return array[index];
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**__acle_se_signSecureFunc:
|
||||
+** ...
|
||||
+** sxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+__attribute__((cmse_nonsecure_entry)) char signSecureFunc (signed char index) {
|
||||
+ if (index >= ARRAY_SIZE)
|
||||
+ return 0;
|
||||
+ return array[index];
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**__acle_se_shortUnsignSecureFunc:
|
||||
+** ...
|
||||
+** uxth r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+__attribute__((cmse_nonsecure_entry)) char shortUnsignSecureFunc (unsigned short index) {
|
||||
+ if (index >= ARRAY_SIZE)
|
||||
+ return 0;
|
||||
+ return array[index];
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**__acle_se_shortSignSecureFunc:
|
||||
+** ...
|
||||
+** sxth r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+__attribute__((cmse_nonsecure_entry)) char shortSignSecureFunc (signed short index) {
|
||||
+ if (index >= ARRAY_SIZE)
|
||||
+ return 0;
|
||||
+ return array[index];
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**__acle_se_enumSecureFunc:
|
||||
+** ...
|
||||
+** uxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+__attribute__((cmse_nonsecure_entry)) char enumSecureFunc (enum offset index) {
|
||||
+
|
||||
+ // Compiler may optimize away bounds check as value is an unsigned char.
|
||||
+
|
||||
+ // According to AAPCS caller will zero extend to ensure value is < 256.
|
||||
+
|
||||
+ if (index >= ARRAY_SIZE)
|
||||
+ return 0;
|
||||
+ return array[index];
|
||||
+
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**__acle_se_boolSecureFunc:
|
||||
+** ...
|
||||
+** uxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+__attribute__((cmse_nonsecure_entry)) char boolSecureFunc (bool index) {
|
||||
+
|
||||
+ if (index >= ARRAY_SIZE)
|
||||
+ return 0;
|
||||
+ return array[index];
|
||||
+
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/gcc/testsuite/gcc.target/arm/cmse/extend-return.c b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..cf731ed33df7e6dc101320c1970016f01b14c59a
|
||||
--- /dev/null
|
||||
+++ b/gcc/testsuite/gcc.target/arm/cmse/extend-return.c
|
||||
@@ -0,0 +1,92 @@
|
||||
+/* { dg-do compile } */
|
||||
+/* { dg-options "-mcmse" } */
|
||||
+/* { dg-final { check-function-bodies "**" "" "" } } */
|
||||
+
|
||||
+#include <arm_cmse.h>
|
||||
+#include <stdbool.h>
|
||||
+
|
||||
+enum offset
|
||||
+{
|
||||
+ zero = 0,
|
||||
+ one = 1,
|
||||
+ two = 2
|
||||
+};
|
||||
+
|
||||
+typedef unsigned char __attribute__ ((cmse_nonsecure_call)) ns_unsign_foo_t (void);
|
||||
+typedef signed char __attribute__ ((cmse_nonsecure_call)) ns_sign_foo_t (void);
|
||||
+typedef unsigned short __attribute__ ((cmse_nonsecure_call)) ns_short_unsign_foo_t (void);
|
||||
+typedef signed short __attribute__ ((cmse_nonsecure_call)) ns_short_sign_foo_t (void);
|
||||
+typedef enum offset __attribute__ ((cmse_nonsecure_call)) ns_enum_foo_t (void);
|
||||
+typedef bool __attribute__ ((cmse_nonsecure_call)) ns_bool_foo_t (void);
|
||||
+
|
||||
+/*
|
||||
+**unsignNonsecure0:
|
||||
+** ...
|
||||
+** bl __gnu_cmse_nonsecure_call
|
||||
+** uxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+unsigned char unsignNonsecure0 (ns_unsign_foo_t * ns_foo_p)
|
||||
+{
|
||||
+ return ns_foo_p ();
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**signNonsecure0:
|
||||
+** ...
|
||||
+** bl __gnu_cmse_nonsecure_call
|
||||
+** sxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+signed char signNonsecure0 (ns_sign_foo_t * ns_foo_p)
|
||||
+{
|
||||
+ return ns_foo_p ();
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**shortUnsignNonsecure0:
|
||||
+** ...
|
||||
+** bl __gnu_cmse_nonsecure_call
|
||||
+** uxth r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+unsigned short shortUnsignNonsecure0 (ns_short_unsign_foo_t * ns_foo_p)
|
||||
+{
|
||||
+ return ns_foo_p ();
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**shortSignNonsecure0:
|
||||
+** ...
|
||||
+** bl __gnu_cmse_nonsecure_call
|
||||
+** sxth r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+signed short shortSignNonsecure0 (ns_short_sign_foo_t * ns_foo_p)
|
||||
+{
|
||||
+ return ns_foo_p ();
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**enumNonsecure0:
|
||||
+** ...
|
||||
+** bl __gnu_cmse_nonsecure_call
|
||||
+** uxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+unsigned char __attribute__((noipa)) enumNonsecure0 (ns_enum_foo_t * ns_foo_p)
|
||||
+{
|
||||
+ return ns_foo_p ();
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+**boolNonsecure0:
|
||||
+** ...
|
||||
+** bl __gnu_cmse_nonsecure_call
|
||||
+** uxtb r0, r0
|
||||
+** ...
|
||||
+*/
|
||||
+unsigned char boolNonsecure0 (ns_bool_foo_t * ns_foo_p)
|
||||
+{
|
||||
+ return ns_foo_p ();
|
||||
+}
|
||||
\ No newline at end of file
|
||||
Reference in New Issue
Block a user