summaryrefslogtreecommitdiffstats
path: root/package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE-in-jitterentropy-base.c.patch
diff options
context:
space:
mode:
Diffstat (limited to 'package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE-in-jitterentropy-base.c.patch')
-rw-r--r--package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE-in-jitterentropy-base.c.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE-in-jitterentropy-base.c.patch b/package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE-in-jitterentropy-base.c.patch
new file mode 100644
index 0000000000..cbe3c6792e
--- /dev/null
+++ b/package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE-in-jitterentropy-base.c.patch
@@ -0,0 +1,42 @@
+From f79d2f4099ec60b315d59e5624e6644c09337666 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Mon, 30 Oct 2023 21:39:26 +0100
+Subject: [PATCH] Deactivate _FORTIFY_SOURCE in jitterentropy-base.c
+
+This fixes compilation with glibc.
+
+_FORTIFY_SOURCE only works with compiler optimizations activated.
+We have to deactivate it when we set -O0.
+
+This fixes the following error message with glibc:
+ error: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Werror=cpp]
+
+musl libc does not show an error message in this case, but has the same
+internal problems.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ CMakeLists.txt | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a1ee0c1..e3f9359 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,8 +22,11 @@ ADD_EXECUTABLE(urngd
+ )
+ TARGET_LINK_LIBRARIES(urngd ${ubox})
+
+-# jitter RNG must not be compiled with optimizations
+-SET_SOURCE_FILES_PROPERTIES(${JTEN_DIR}/jitterentropy-base.c PROPERTIES COMPILE_FLAGS -O0)
++# jitter RNG must not be compiled with optimizations, _FORTIFY_SOURCE needs optimizations
++SET_PROPERTY(
++ SOURCE ${JTEN_DIR}/jitterentropy-base.c
++ APPEND PROPERTY COMPILE_FLAGS -O0 -U_FORTIFY_SOURCE
++)
+
+ INSTALL(TARGETS urngd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
+
+--
+2.39.2
+