[all-commits] [llvm/llvm-project] b11a2f: [cmake] Use -ffunction-sections and -Wl, --gc-secti...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Fri Apr 30 00:54:10 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b11a2f2544e880602b539c85c4445468d14b63a1
      https://github.com/llvm/llvm-project/commit/b11a2f2544e880602b539c85c4445468d14b63a1
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-04-30 (Fri, 30 Apr 2021)

  Changed paths:
    M llvm/cmake/modules/AddLLVM.cmake
    M llvm/cmake/modules/HandleLLVMOptions.cmake

  Log Message:
  -----------
  [cmake] Use -ffunction-sections and -Wl,--gc-sections on MinGW targets

If compiling with GCC or linking with ld.bfd, these options have little
effect, but if built with Clang and linked with LLD, they provide a
quite notable size decrease - this shrinks an entire llvm-mingw
distribution package by 22%.

If building with BUILD_SHARED_LIBS or LLVM_BUILD_LLVM_DYLIB with LLD,
this requires a version of LLD that contains a fix for auto exporting
symbols from comdats, 2b01a417d7ccb001ccc1185ef5fdc967c9fac8d7.

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




More information about the All-commits mailing list