[PATCH] Adding llvm-shlib to CMake build system with a few new bells and whistles

Chris Bieneman beanz at apple.com
Tue Oct 21 15:40:09 PDT 2014


================
Comment at: tools/llvm-shlib/CMakeLists.txt:59
@@ +58,3 @@
+    add_custom_command(OUTPUT ${LIB_PATH}.exports
+      COMMAND nm ${LIB_PATH} | awk "/T _LLVM/ { print $3 }" | sort -u | sed -e "s/^_//g" > ${LIB_PATH}.exports
+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lib
----------------
beanz wrote:
> rnk wrote:
> > rnk wrote:
> > > Linux (and other OSs) won't add this leading underscore to functions with extern "C" linkage, so nm's output will look like 'T LLVM*'.
> > It looks like you can skip the removal of leading underscores, add_llvm_symbol_exports appears to do this for you on Mac.
> Good catch. on both of these. I'll update the patches.
Looking at this further. I do actually need to strip the _. The sed line in add_llvm_symbol_exports actually adds a leading _ so that darwin can be compatible with Linux & Windows export lists that don't have leading underscores.

http://reviews.llvm.org/D5890






More information about the llvm-commits mailing list