[all-commits] [llvm/llvm-project] 59f879: Initial changes for llvm shared library build usin...

Thomas Fransham via All-commits all-commits at lists.llvm.org
Fri Sep 6 10:52:06 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59f8796aaabc1ce400a8698431d3c6bfab4ad1a4
      https://github.com/llvm/llvm-project/commit/59f8796aaabc1ce400a8698431d3c6bfab4ad1a4
  Author: Thomas Fransham <tfransham at gmail.com>
  Date:   2024-09-06 (Fri, 06 Sep 2024)

  Changed paths:
    M llvm/CMakeLists.txt
    M llvm/cmake/modules/AddLLVM.cmake
    M llvm/cmake/modules/HandleLLVMOptions.cmake
    M llvm/include/llvm/ADT/Any.h
    M llvm/include/llvm/Analysis/LazyCallGraph.h
    M llvm/include/llvm/Analysis/LoopInfo.h
    M llvm/include/llvm/Analysis/LoopNestAnalysis.h
    M llvm/include/llvm/CodeGen/MachineFunction.h
    M llvm/include/llvm/IR/Function.h
    M llvm/include/llvm/IR/Module.h
    M llvm/include/llvm/Support/Compiler.h
    M llvm/tools/llvm-shlib/CMakeLists.txt
    M llvm/utils/TableGen/Basic/CMakeLists.txt
    M llvm/utils/TableGen/Common/CMakeLists.txt

  Log Message:
  -----------
  Initial changes for llvm shared library build using explicit visibility annotations

These are my initial build and code changes to supporting building llvm
as shared library/DLL on windows(without force exporting all symbols)
and making symbol visibility hidden by default on Linux which adding
explicit symbol visibility macros to the whole llvm codebase.

Updated cmake code to allow building llvm-shlib on windows by appending
/WHOLEARCHIVE:lib to the linker options.
Remove the hardcoded CMake error from using LLVM_BUILD_LLVM_DYLIB on
windows.
Updated CMake to define new macros to control conditional export macros
in llvm/Support/Compiler.h
Use /Zc:dllexportInlines- when compiling with clang-cl on windows with a
opt out CMake option to disable using it.
Replace some use of LLVM_EXTERNAL_VISIBILITY with new export macros.

Some of the cmake and code changes are based on @tstellar's earlier PR
https://github.com/llvm/llvm-project/pull/67502.

I have Windows building using clang-cl, while for MSVC its at-least able
to build libllvm, but some tests can't build because llvm iterator
template metaprogramming that doesn't work well with dllexport. Linux
should build without issue. My full branch is here
https://github.com/fsfod/llvm-project/tree/llvm-export-api-20.0 and
including all the auto generated export macros from clang tooling based
system.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list