about summary refs log tree commit diff
path: root/wcsmbs
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-03-17 10:17:28 +0100
committerFrédéric Bérat <fberat@redhat.com>2023-07-05 16:59:48 +0200
commit20c894d21eb64153abf7c7f96e6a151897cf1488 (patch)
tree41038a7e2daf61f19d10f4804313e8e33430046b /wcsmbs
parent64d9580cdf7e417170abbef0327e04b29712e949 (diff)
downloadglibc-20c894d21eb64153abf7c7f96e6a151897cf1488.tar.gz
glibc-20c894d21eb64153abf7c7f96e6a151897cf1488.tar.xz
glibc-20c894d21eb64153abf7c7f96e6a151897cf1488.zip
Exclude routines from fortification
Since the _FORTIFY_SOURCE feature uses some routines of Glibc, they need to
be excluded from the fortification.

On top of that:
 - some tests explicitly verify that some level of fortification works
   appropriately, we therefore shouldn't modify the level set for them.
 - some objects need to be build with optimization disabled, which
   prevents _FORTIFY_SOURCE to be used for them.

Assembler files that implement architecture specific versions of the
fortified routines were not excluded from _FORTIFY_SOURCE as there is no
C header included that would impact their behavior.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/Makefile23
1 files changed, 22 insertions, 1 deletions
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 22192985e1..d25a2214f8 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -121,6 +121,27 @@ routines := \
   wmemset \
   # routines
 
+# Exclude fortified routines from being built with _FORTIFY_SOURCE
+routines_no_fortify += \
+  mbsnrtowcs \
+  mbsrtowcs \
+  wcpcpy \
+  wcpncpy \
+  wcrtomb \
+  wcscat \
+  wcscpy \
+  wcslcat \
+  wcslcpy \
+  wcsncat \
+  wcsncpy \
+  wcsnrtombs \
+  wcsrtombs \
+  wmemcpy \
+  wmemmove \
+  wmempcpy \
+  wmemset \
+  # routines_no_fortify
+
 tests := \
   test-c8rtomb \
   test-char-types \
@@ -231,7 +252,7 @@ CFLAGS-wcstod_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
 CFLAGS-wcstold_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
 CFLAGS-wcstof128_l.c += $(strtox-CFLAGS)
 CFLAGS-wcstof_l.c += $(strtox-CFLAGS) $(config-cflags-wno-ignored-attributes)
-CPPFLAGS-tst-wchar-h.c += -D_FORTIFY_SOURCE=2
+CPPFLAGS-tst-wchar-h.c += $(no-fortify-source),-D_FORTIFY_SOURCE=2
 
 CFLAGS-wcschr.c += $(config-cflags-wno-ignored-attributes)
 CFLAGS-wmemchr.c += $(config-cflags-wno-ignored-attributes)