[PATCH] D105223: [lld-macho] Add support for LTO optimization level

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 30 13:07:23 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/Config.h:129
   llvm::StringRef thinLTOJobs;
+  uint32_t ltoo = 2;
   bool deadStripDylibs = false;
----------------
lgrey wrote:
> thakis wrote:
> > Is this the same default ld64 seems to use?
> AFAICT, it doesn't optimize.
> 
> ```
> $ cat opt_check.c
> void foo() {
>     return;
> }
> 
> int main(int argc, char** argv) {
>     foo();
>     return 0;
> }
> $ clang -flto=thin opt_check.c && nm -pa a.out
> 0000000100003f80 t _foo
> 0000000100000000 T __mh_execute_header
> 0000000100003f90 T _main
>                  U dyld_stub_binder
> ```
> 
> Should we change it to 0 for compat?
ld64 has an undocumented `-flto-codegen-only` flag. I haven't looked into what exactly it does, but it seems relevant...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105223



More information about the llvm-commits mailing list