]> granicus.if.org Git - llvm/commitdiff
[tools] Add option to install binutils symlinks
authorShoaib Meenai <smeenai@fb.com>
Thu, 2 Nov 2017 21:43:32 +0000 (21:43 +0000)
committerShoaib Meenai <smeenai@fb.com>
Thu, 2 Nov 2017 21:43:32 +0000 (21:43 +0000)
The LLVM tools can be used as a replacement for binutils, in which case
it's convenient to create symlinks with the binutils names. Add support
for these symlinks in the build system. As with any other llvm tool
symlinks, the user can limit the installed symlinks by only adding the
desired ones to `LLVM_TOOLCHAIN_TOOLS`.

Differential Revision: https://reviews.llvm.org/D39530

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317272 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
CMakeLists.txt
docs/CMake.rst
tools/llvm-ar/CMakeLists.txt
tools/llvm-cxxfilt/CMakeLists.txt
tools/llvm-dwp/CMakeLists.txt
tools/llvm-nm/CMakeLists.txt
tools/llvm-objcopy/CMakeLists.txt
tools/llvm-objdump/CMakeLists.txt
tools/llvm-readobj/CMakeLists.txt
tools/llvm-size/CMakeLists.txt
tools/llvm-strings/CMakeLists.txt
tools/llvm-symbolizer/CMakeLists.txt

index e27562dc8b5d55f0d392fbf677020346c4f173fd..6328f1e18c0b9e5564c182ccb964fc371e652689 100644 (file)
@@ -179,6 +179,9 @@ set(CMAKE_MODULE_PATH
 # for use by clang_complete, YouCompleteMe, etc.
 set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
 
+option(LLVM_INSTALL_BINUTILS_SYMLINKS
+  "Install symlinks from the binutils tool names to the corresponding LLVM tools." OFF)
+
 option(LLVM_INSTALL_UTILS "Include utility binaries in the 'install' target." OFF)
 
 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
index 473672b5f736f7131915b37e6ab980de5f2ee515..05edec64da3329d88f9038432203eb294fb8c405 100644 (file)
@@ -224,6 +224,10 @@ LLVM-specific variables
   Generate build targets for the LLVM tools. Defaults to ON. You can use this
   option to disable the generation of build targets for the LLVM tools.
 
+**LLVM_INSTALL_BINUTILS_SYMLINKS**:BOOL
+  Install symlinks from the binutils tool names to the corresponding LLVM tools.
+  For example, ar will be symlinked to llvm-ar.
+
 **LLVM_BUILD_EXAMPLES**:BOOL
   Build LLVM examples. Defaults to OFF. Targets for building each example are
   generated in any case. See documentation for *LLVM_BUILD_TOOLS* above for more
index 731bcbd8ac9d74e99842d1ddbcee8c9ac1c31fc1..2970a59beee22ad88bd23616806003b5f3be7d9c 100644 (file)
@@ -17,3 +17,9 @@ add_llvm_tool(llvm-ar
 add_llvm_tool_symlink(llvm-ranlib llvm-ar)
 add_llvm_tool_symlink(llvm-lib llvm-ar)
 add_llvm_tool_symlink(llvm-dlltool llvm-ar)
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(ar llvm-ar)
+  add_llvm_tool_symlink(dlltool llvm-ar)
+  add_llvm_tool_symlink(ranlib llvm-ar)
+endif()
index 488064d08dab2ded6bf81de483c82f5c40ee1a08..2a78acad80a8169736a428d1d5e58c023fc864f7 100644 (file)
@@ -6,3 +6,7 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_tool(llvm-cxxfilt
   llvm-cxxfilt.cpp
   )
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(c++filt llvm-cxxfilt)
+endif()
index 98d67e04fe6a0b46dd31f2217fda07b1f2306f2a..1b5fbddc1f75090349579cf537bd43e5d77247d7 100644 (file)
@@ -15,3 +15,7 @@ add_llvm_tool(llvm-dwp
   DEPENDS
   intrinsics_gen
   )
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(dwp llvm-dwp)
+endif()
index 08bcd5f3089803301f1c0c60c079d9da7c1fe0e4..f093cc4328ae830aedc7a6e13441f5a31677a155 100644 (file)
@@ -14,3 +14,7 @@ add_llvm_tool(llvm-nm
   DEPENDS
   intrinsics_gen
   )
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(nm llvm-nm)
+endif()
index 18cc2075345d7f061740efb6efbe52e48cc19e75..05aa727ab9d832572f2f08b9b46e55a62effce00 100644 (file)
@@ -7,3 +7,7 @@ add_llvm_tool(llvm-objcopy
   llvm-objcopy.cpp
   Object.cpp
   )
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(objcopy llvm-objcopy)
+endif()
index 27e6145dfc1391721d6eee3b88faf53fcdc78374..043a181d6392e333ddffefd67dcae516ab7bbbf4 100644 (file)
@@ -25,3 +25,7 @@ add_llvm_tool(llvm-objdump
 if(HAVE_LIBXAR)
   target_link_libraries(llvm-objdump ${XAR_LIB})
 endif()
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(objdump llvm-objdump)
+endif()
index 544716741734552616e8daef53bed27445864f7f..dafc9e10cfa12c8d6533d79cd6a1e60c376a25e1 100644 (file)
@@ -23,3 +23,7 @@ add_llvm_tool(llvm-readobj
   )
 
 add_llvm_tool_symlink(llvm-readelf llvm-readobj)
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(readelf llvm-readobj)
+endif()
index 60345739c35a8a7c89d47a3d277637e9f55e3e5a..7ef4f1769b840ab65394628e7e9fa6eeb50862b5 100644 (file)
@@ -6,3 +6,7 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_tool(llvm-size
   llvm-size.cpp
   )
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(size llvm-size)
+endif()
index 9339892a4997270981fb56a405a06f3c0816a89e..390f117513978289c77013acf7b24fff54f17457 100644 (file)
@@ -8,3 +8,6 @@ add_llvm_tool(llvm-strings
   llvm-strings.cpp
   )
 
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(strings llvm-strings)
+endif()
index b04c45ff74421656de1eecdcbbb78210c5afc21e..d9b05208afd8d9ed634c9d5c2956585da9c3d045 100644 (file)
@@ -14,3 +14,7 @@ set(LLVM_LINK_COMPONENTS
 add_llvm_tool(llvm-symbolizer
   llvm-symbolizer.cpp
   )
+
+if(LLVM_INSTALL_BINUTILS_SYMLINKS)
+  add_llvm_tool_symlink(addr2line llvm-symbolizer)
+endif()