1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-26 13:21:07 +03:00

Allow glibc to be built with _FORTIFY_SOURCE

Add --enable-fortify-source option.

It is now possible to enable fortification through a configure option.
The level may be given as parameter, if none is provided, the configure
script will determine what is the highest level possible that can be set
considering GCC built-ins availability and set it.
If level is explicitly set to 3, configure checks if the compiler
supports the built-in function necessary for it or raise an error if it
isn't.

If the configure option isn't explicitly enabled, it _FORTIFY_SOURCE is
forcibly undefined (and therefore disabled).

The result of the configure checks are new variables, ${fortify_source}
and ${no_fortify_source} that can be used to appropriately populate
CFLAGS.

A dedicated patch will follow to make use of this variable in Makefiles
when necessary.

Updated NEWS and INSTALL.

Adding dedicated x86_64 variant that enables the configuration.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
Frédéric Bérat
2023-03-17 10:14:50 +01:00
parent e18c293af0
commit 64d9580cdf
9 changed files with 167 additions and 42 deletions

View File

@ -464,7 +464,9 @@ class Context(object):
{'arch': 'i486',
'ccopts': '-m32 -march=i486'},
{'arch': 'i586',
'ccopts': '-m32 -march=i586'}])
'ccopts': '-m32 -march=i586'},
{'variant': 'enable-fortify-source',
'cfg': ['--enable-fortify-source']}])
self.add_config(arch='x86_64',
os_name='gnu',
gcc_cfg=['--disable-multilib'])