https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121911

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <[email protected]>:

https://gcc.gnu.org/g:c05b5e5d8cb660ed43159d66fd669c20746d6bea

commit r17-321-gc05b5e5d8cb660ed43159d66fd669c20746d6bea
Author: H.J. Lu <[email protected]>
Date:   Fri Sep 12 18:52:39 2025 -0700

    c/c++: Declare stack protection guard as a global symbol

    Add a new target hook, stack_protect_guard_symbol_p, to support the user
    provided stack protection guard as a global symbol.  If the hook returns
    true,

    1. Declare __stack_chk_guard as a global uintptr_t variable so that it
    can be initialized as an integer.
    2. If the user declared variable matches __stack_chk_guard, merge it with
    __stack_chk_guard, including its visibility attribute.

    gcc/

            PR c/121911
            * target.def (stack_protect_guard_symbol_p): New target hook.
            * targhooks.cc (default_stack_protect_guard): Use the type of
            uintptr_t, instead of ptr_type_node, if the
            stack_protect_guard_symbol_p hook returns true.
            * config/i386/i386.cc (ix86_stack_protect_guard_symbol_p): New.
            (TARGET_STACK_PROTECT_GUARD_SYMBOL_P): Likewise.
            * doc/tm.texi: Regenerated.
            * doc/tm.texi.in (TARGET_STACK_PROTECT_GUARD_SYMBOL_P): New.

    gcc/c-family/

            PR c/121911
            * c-common.cc (c_common_nodes_and_builtins): If the
            stack_protect_guard_symbol_p hook returns true, declare a global
            symbol for stack protection guard.

    gcc/testsuite/

            PR c/121911
            * g++.target/i386/ssp-global-1.C: New test.
            * g++.target/i386/ssp-global-2.C: Likewise.
            * g++.target/i386/ssp-global-3.C: Likewise.
            * g++.target/i386/ssp-global-hidden-1.C: Likewise.
            * g++.target/i386/ssp-global-hidden-2.C: Likewise.
            * g++.target/i386/ssp-global-hidden-3.C: Likewise.
            * gcc.target/i386/ssp-global-2.c: Likewise.
            * gcc.target/i386/ssp-global-3.c: Likewise.
            * gcc.target/i386/ssp-global-4.c: Likewise.
            * gcc.target/i386/ssp-global-hidden-1.c: Likewise.
            * gcc.target/i386/ssp-global-hidden-2.c: Likewise.
            * gcc.target/i386/ssp-global-hidden-3.c: Likewise.
            * gcc.target/i386/ssp-global.c: Include <stdint.h>.
            (__stack_chk_guard): Change its type to uintptr_t.

    Signed-off-by: H.J. Lu <[email protected]>

Reply via email to