[compiler-rt] r352341 - [CMake] Use __libc_start_main rather than fopen when checking for C library

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 28 11:15:01 PST 2019


Sorry about that, I forgot to test my change on macOS and I naively assumed
that their libc provides the same symbol. I'll revert the change and see
what other symbols would be appropriate.

On Mon, Jan 28, 2019 at 11:04 AM Hans Wennborg <hans at chromium.org> wrote:

> We're seeing breakages of Chromium's compiler-rt build on Mac after
> this change: https://bugs.chromium.org/p/chromium/issues/detail?id=925895
>
> I'm not entirely sure how your change would cause the error we're
> seeing, but it seems clear that COMPILER_RT_HAS_LIBC was getting set
> before, and is set no longer, and I'm guessing that wasn't
> intentional. Do you know what might be going on here? Maybe there's
> some other symbol that could be used and exists across both glibc and
> Mac's libc?
>
> On Sun, Jan 27, 2019 at 11:12 PM Petr Hosek via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> >
> > Author: phosek
> > Date: Sun Jan 27 20:12:54 2019
> > New Revision: 352341
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=352341&view=rev
> > Log:
> > [CMake] Use __libc_start_main rather than fopen when checking for C
> library
> >
> > The check_library_exists CMake uses a custom symbol definition. This
> > is a problem when checking for C library symbols because Clang
> > recognizes many of them as builtins, and returns the
> > -Wbuiltin-requires-header (or -Wincompatible-library-redeclaration)
> > error. When building with -Werror which is the default, this causes
> > the check_library_exists check fail making the build think that C
> > library isn't available.
> >
> > To avoid this issue, we should use a symbol that isn't recognized by
> > Clang and wouldn't cause the same issue. __libc_start_main seems like
> > reasonable choice that fits the bill.
> >
> > Differential Revision: https://reviews.llvm.org/D57142
> >
> > Modified:
> >     compiler-rt/trunk/cmake/config-ix.cmake
> >
> > Modified: compiler-rt/trunk/cmake/config-ix.cmake
> > URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/config-ix.cmake?rev=352341&r1=352340&r2=352341&view=diff
> >
> ==============================================================================
> > --- compiler-rt/trunk/cmake/config-ix.cmake (original)
> > +++ compiler-rt/trunk/cmake/config-ix.cmake Sun Jan 27 20:12:54 2019
> > @@ -12,7 +12,7 @@ function(check_linker_flag flag out_var)
> >    cmake_pop_check_state()
> >  endfunction()
> >
> > -check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
> > +check_library_exists(c __libc_start_main "" COMPILER_RT_HAS_LIBC)
> >  if (COMPILER_RT_USE_BUILTINS_LIBRARY)
> >    include(HandleCompilerRT)
> >    find_compiler_rt_library(builtins COMPILER_RT_BUILTINS_LIBRARY)
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190128/22aadb12/attachment.html>


More information about the llvm-commits mailing list