[PATCH] D101568: [cmake] Use -ffunction-sections and -Wl,--gc-sections on MinGW targets

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 29 14:25:44 PDT 2021


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: llvm/cmake/modules/HandleLLVMOptions.cmake:898-900
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
 # flags instead if LLVM_NO_DEAD_STRIP is set.
----------------
To the best of my knowledge, MSVC users typically get these features by default in release builds. Consider that `cl /O2` enables `/Gy` or function sections. From there it's just a matter of passing `/OPT:REF` to the linker, and I think cmake does, although I don't have a minute to check right now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101568/new/

https://reviews.llvm.org/D101568



More information about the llvm-commits mailing list