third_party: boringssl: Set _POSIX_C_SOURCE

BoringSSL sources require strdup() function which is defined only
when _POSIX_VISIBLE is at least 200809

BUG=b:321092852
TEST=zmake build -a
TEST=Run Gitlab CI locally

Change-Id: Idedc6ec0b26b9565c1c25f389fed184598c8ed07
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/5424639
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Tested-by: Patryk Duda <patrykd@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Commit-Queue: Tom Hughes <tomhughes@chromium.org>
(cherry picked from commit cfcca85636)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/5434153
Reviewed-by: Dawid Niedźwiecki <dawidn@google.com>
Commit-Queue: Patryk Duda <patrykd@google.com>
This commit is contained in:
Patryk Duda 2024-04-05 13:24:05 +02:00 committed by Chromeos LUCI
parent 9962c4e48a
commit 3e935b8b6c
1 changed files with 5 additions and 1 deletions

View File

@ -70,6 +70,9 @@ zephyr_library_sources_ifdef(CONFIG_BORINGSSL_HARDWARE_ENTROPY
zephyr_library_compile_options(-std=c11)
# Add compile options required by BoringSSL.
# -D_POSIX_C_SOURCE=200809L is needed because BoringSSL uses strdup() function
# is guarded by __POSIX_VISIBLE >=200809 in Newlib's string.h file.
#
# -Wno-implicit-function-declaration is needed because BoringSSL sources use
# functions not defined in Zephyr: fflush(), getenv(), sscanf(). We won't get
# any linker issues because code that uses these functions is unused and will
@ -81,7 +84,8 @@ zephyr_library_compile_options(-std=c11)
#
# -std=c11 is necessary because BoringSSL sources use features available in
# C11, e.g. static_assert().
set(BORINGSSL_COMPILE_OPTIONS -Wno-implicit-function-declaration -fno-common -std=c11)
set(BORINGSSL_COMPILE_OPTIONS -D_POSIX_C_SOURCE=200809L
-Wno-implicit-function-declaration -fno-common -std=c11)
# Target 'fipsmodule' is a object library. It compiles source files, but
# doesn't archive or link object files into library. Other targets should