diff mbox series

[ustream-ssl,2/2] cmake: Fail if undefined symbols are used

Message ID 20231111213243.3338889-2-hauke@hauke-m.de
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [ustream-ssl,1/2] ustream-mbedtls: Add compatibility with Mbed TLS 3.0.0 | expand

Commit Message

Hauke Mehrtens Nov. 11, 2023, 9:32 p.m. UTC
Make the linking of the shared library fail when undefined symbols are
used. Linking undefined symbols in a shared library normally works and
the linking of the binary using the shared library fails. We also
compile some example applications and they failed already.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 CMakeLists.txt | 1 +
 1 file changed, 1 insertion(+)

Comments

Rosen Penev Nov. 11, 2023, 11:48 p.m. UTC | #1
On Sat, Nov 11, 2023 at 1:35 PM Hauke Mehrtens <hauke@hauke-m.de> wrote:
>
> Make the linking of the shared library fail when undefined symbols are
> used. Linking undefined symbols in a shared library normally works and
> the linking of the binary using the shared library fails. We also
> compile some example applications and they failed already.
>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  CMakeLists.txt | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 2de6590..f4dca0d 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -10,6 +10,7 @@ ENDIF()
>  ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
>
>  SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
> +SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
probably better to convert to meson, which passes this by default.
>
>  IF(MBEDTLS)
>    ADD_DEFINITIONS(-DHAVE_MBEDTLS)
> --
> 2.39.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2de6590..f4dca0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,7 @@  ENDIF()
 ADD_DEFINITIONS(-Wno-unused-parameter -Wmissing-declarations)
 
 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
+SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
 
 IF(MBEDTLS)
   ADD_DEFINITIONS(-DHAVE_MBEDTLS)