[PATCH] D54587: Fix DynamicLibraryTests build on Windows when LLVM_EXPORT_SYMBOLS_FOR_PLUGINS is ON

Michael Platings via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 15 10:15:26 PST 2018


michaelplatings created this revision.
michaelplatings added reviewers: john.brawn, rnk.
Herald added subscribers: llvm-commits, mgorny.

extract_symbols.py (introduced in https://reviews.llvm.org/D18826) expects all of its library arguments to be in the same directory - typically <config>/lib. DynamicLibraryLib.lib is instead to be found in lib/<config>.
This patch passes locations of libraries directly to extract_symbols.py so it doesn't need to guess.


Repository:
  rL LLVM

https://reviews.llvm.org/D54587

Files:
  llvm/cmake/modules/AddLLVM.cmake
  llvm/utils/extract_symbols.py


Index: llvm/utils/extract_symbols.py
===================================================================
--- llvm/utils/extract_symbols.py
+++ llvm/utils/extract_symbols.py
@@ -393,19 +393,7 @@
     # Get the list of libraries to extract symbols from
     libs = list()
     for lib in args.libs:
-        # When invoked by cmake the arguments are the cmake target names of the
-        # libraries, so we need to add .lib/.a to the end and maybe lib to the
-        # start to get the filename. Also allow objects.
-        suffixes = ['.lib','.a','.obj','.o']
-        if not any([lib.endswith(s) for s in suffixes]):
-            for s in suffixes:
-                if os.path.exists(lib+s):
-                    lib = lib+s
-                    break
-                if os.path.exists('lib'+lib+s):
-                    lib = 'lib'+lib+s
-                    break
-        if not any([lib.endswith(s) for s in suffixes]):
+        if not os.path.exists(lib):
             print("Don't know what to do with argument "+lib, file=sys.stderr)
             exit(1)
         libs.append(lib)
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -811,6 +811,7 @@
           get_target_property(lib_type ${lib} TYPE)
           if("${lib_type}" STREQUAL "STATIC_LIBRARY")
             list(APPEND static_libs ${lib})
+            list(APPEND static_lib_files $<TARGET_LINKER_FILE:${lib}>)
           else()
             list(APPEND other_libs ${lib})
           endif()
@@ -833,7 +834,7 @@
       set(mangling itanium)
     endif()
     add_custom_command(OUTPUT ${exported_symbol_file}
-                       COMMAND ${PYTHON_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/extract_symbols.py --mangling=${mangling} ${static_libs} -o ${exported_symbol_file}
+                       COMMAND ${PYTHON_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/extract_symbols.py --mangling=${mangling} ${static_lib_files} -o ${exported_symbol_file}
                        WORKING_DIRECTORY ${LLVM_LIBRARY_OUTPUT_INTDIR}
                        DEPENDS ${LLVM_MAIN_SRC_DIR}/utils/extract_symbols.py ${static_libs}
                        VERBATIM


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54587.174233.patch
Type: text/x-patch
Size: 2248 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181115/bad89288/attachment.bin>


More information about the llvm-commits mailing list