[PATCH] D26944: Suppress -Wliblto warning when -flto is not present

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 21 21:51:34 PST 2016


Lgtm, works for me. Seems like a good compromise.

On Nov 21, 2016 6:29 PM, "Reid Kleckner" <rnk at google.com> wrote:

> rnk created this revision.
> rnk added reviewers: mehdi_amini, thakis.
> rnk added a subscriber: cfe-commits.
>
> Without -flto, it's unlikely that users will experience LLVM version
> skew. The system installation of libLTO should be able to handle any
> pre-compiled LLVM bitcode from static archives.
>
>
> https://reviews.llvm.org/D26944
>
> Files:
>   lib/Driver/Tools.cpp
>   test/Driver/darwin-ld-lto.c
>
>
> Index: test/Driver/darwin-ld-lto.c
> ===================================================================
> --- test/Driver/darwin-ld-lto.c
> +++ test/Driver/darwin-ld-lto.c
> @@ -1,5 +1,3 @@
> -// REQUIRES: system-darwin
> -
>  // Check that ld gets "-lto_library" and warnings about libLTO.dylib path.
>
>  // RUN: mkdir -p %T/bin
> @@ -12,12 +10,20 @@
>  // LINK_LTOLIB_PATH: {{ld(.exe)?"}}
>  // LINK_LTOLIB_PATH: "-lto_library"
>
> -// RUN: %clang -target x86_64-apple-darwin10 -### %s \
> +// Only warn if -flto is on the command line.
> +//
> +// RUN: %clang -target x86_64-apple-darwin10 -### %s -flto \
>  // RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
>  // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_WRN %s -input-file
> %t.log
>  //
>  // LINK_LTOLIB_PATH_WRN: warning: libLTO.dylib relative to clang
> installed dir not found; using 'ld' default search path instead
>
> +// Don't warn if -flto isn't present of -Wno-liblto is present.
> +//
> +// RUN: %clang -target x86_64-apple-darwin10 -### %s \
> +// RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log
> +// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_NOWRN %s -input-file
> %t.log
> +//
>  // RUN: %clang -target x86_64-apple-darwin10 -### %s \
>  // RUN:   -ccc-install-dir %S/dummytestdir -mlinker-version=133
> -Wno-liblto 2> %t.log
>  // RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_NOWRN %s -input-file
> %t.log
> Index: lib/Driver/Tools.cpp
> ===================================================================
> --- lib/Driver/Tools.cpp
> +++ lib/Driver/Tools.cpp
> @@ -8232,7 +8232,9 @@
>      if (llvm::sys::fs::exists(LibLTOPath)) {
>        CmdArgs.push_back("-lto_library");
>        CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath));
> -    } else {
> +    } else if (D.isUsingLTO()) {
> +      // Warn if we're using LTO with the system version of libLTO. It
> might not
> +      // understand LLVM bitcode generated by our version of LLVM.
>        D.Diag(diag::warn_drv_lto_libpath);
>      }
>    }
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161122/a25501b2/attachment.html>


More information about the cfe-commits mailing list