H.J. Lu c05b5e5d8c 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 <hjl.tools@gmail.com>
2026-05-05 06:01:23 +08:00
2026-04-29 00:16:40 +00:00
2026-04-30 00:16:31 +00:00
2026-05-03 00:16:23 +00:00
2026-05-02 00:16:28 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%