summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2023-10-30 21:43:02 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2023-10-30 21:46:26 +0100
commitf3be067d46ff03586227412332ca9cafd00f5567 (patch)
tree8ff89f7288b33e941190cfe8cdda0b50d1798d53
parent213b0082c8d2c95433ccd8af29d22fa00d3660df (diff)
downloadopenwrt-f3be067d46ff03586227412332ca9cafd00f5567.tar.gz
openwrt-f3be067d46ff03586227412332ca9cafd00f5567.tar.bz2
openwrt-f3be067d46ff03586227412332ca9cafd00f5567.zip
urngd: Fix compilation with glibc
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE.patch b/package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE.patch
new file mode 100644
index 0000000000..3e8155eebc
--- /dev/null
+++ b/package/system/urngd/patches/0001-Deactivate-_FORTIFY_SOURCE.patch
@@ -0,0 +1,37 @@
+From 19ab9f7a2c23bf7692b7a987248f959319a8747a 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
+
+_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 | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a1ee0c1..78954c0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,8 +22,9 @@ ADD_EXECUTABLE(urngd
+ )
+ TARGET_LINK_LIBRARIES(urngd ${ubox})
+
+-# jitter RNG must not be compiled with optimizations
++# jitter RNG must not be compiled with optimizations, _FORTIFY_SOURCE needs optimizations
+ SET_SOURCE_FILES_PROPERTIES(${JTEN_DIR}/jitterentropy-base.c PROPERTIES COMPILE_FLAGS -O0)
++SET_SOURCE_FILES_PROPERTIES(${JTEN_DIR}/jitterentropy-base.c PROPERTIES COMPILE_FLAGS -U_FORTIFY_SOURCE)
+
+ INSTALL(TARGETS urngd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
+
+--
+2.39.2
+