OSDN Git Service

Add -Wl,--no-as-needed to ld flags
authorRaymond Chiu <chiur@google.com>
Thu, 31 Jan 2019 00:00:08 +0000 (16:00 -0800)
committerChris Forbes <chrisforbes@google.com>
Thu, 31 Jan 2019 00:24:17 +0000 (00:24 +0000)
Older version of gcc mistakenly missed out on linking libdl without it.

Change-Id: I5c12972c140348fa504e4ff4acb81655b445b4a5
Reviewed-on: https://swiftshader-review.googlesource.com/c/24268
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Tested-by: Chris Forbes <chrisforbes@google.com>
CMakeLists.txt
kokoro/gcp_ubuntu/continuous.sh

index cb417fd..ee373b0 100644 (file)
@@ -156,6 +156,11 @@ macro(set_shared_library_export_map TARGET DIR)
         if(NOT MSAN AND NOT ASAN AND NOT TSAN AND NOT UBSAN)
             set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--no-undefined")
         endif()
+
+        # Older version of GCC have problem linking libdl when --as-needed is set.
+        if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
+            set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--no-as-needed")
+        endif()
     endif()
 endmacro()
 
index 4caf6ce..e1c5bc7 100755 (executable)
@@ -12,4 +12,4 @@ git submodule update --init
 mkdir -p build && cd build
 
 cmake ..
-make --jobs=$(nproc)
+make --jobs=$(nproc) VERBOSE=1