[compiler-rt] r276333 - Enable cross-compilation across architectures on android

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 13:25:06 PDT 2016


This change is broken and wrong.

As a result of this change I see CMAKE_C_FLAGS getting included multiple times in the compiler command lines. When I configure with -DCMAKE_C_FLAGS="-target amd64-unknown-freebsd10.0” I see:

build CMakeFiles/clang_rt.builtins-x86_64.dir/x86_64/floatdidf.c.o: C_COMPILER__clang_rt.2ebuiltins-x86_64 /Users/cbieneman/dev/open-source/compiler-rt/lib/builtins/x86_64/floatdidf.c
[…]
  FLAGS = -target amd64-unknown-freebsd10.0    -m64  -std=gnu99 -target amd64-unknown-freebsd10.0
[…]

You’ll not the double occurrence of the -target flag. This is because, as I said in my pre-commit review (https://reviews.llvm.org/D22415 <https://reviews.llvm.org/D22415>), CMAKE_C_FLAGS is *automatically* added to the compile line for C source files when CMake’s `add_library` function is called.

My guess as to what might be causing your problem is that CMAKE_C_FLAGS *isn’t* added to assembly files, because they are not C sources. So, you probably need to also set CMAKE_ASM_FLAGS to include whatever options you need there.

I’m going to revert this patch, please let me know if you need help diagnosing the actual problems you’re encountering.

Thanks,
-Chris

> On Jul 21, 2016, at 2:05 PM, Francis Ricci via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: fjricci
> Date: Thu Jul 21 16:05:14 2016
> New Revision: 276333
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=276333&view=rev
> Log:
> Enable cross-compilation across architectures on android
> 
> Summary:
> This patch fixes cross-architecture compilation,
> by allowing flags like -target and --sysroot to be set for
> architecture testing and compilation.
> 
> Reviewers: tberghammer, srhines, danalbert, beanz, compnerd
> 
> Subscribers: tberghammer, llvm-commits, danalbert
> 
> Differential Revision: https://reviews.llvm.org/D22415
> 
> Modified:
>    compiler-rt/trunk/lib/builtins/CMakeLists.txt
> 
> Modified: compiler-rt/trunk/lib/builtins/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/CMakeLists.txt?rev=276333&r1=276332&r2=276333&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/CMakeLists.txt (original)
> +++ compiler-rt/trunk/lib/builtins/CMakeLists.txt Thu Jul 21 16:05:14 2016
> @@ -413,7 +413,7 @@ else ()
>                               STATIC
>                               ARCHS ${arch}
>                               SOURCES ${${arch}_SOURCES}
> -                              CFLAGS ${maybe_stdc99}
> +                              CFLAGS ${maybe_stdc99} ${CMAKE_C_FLAGS}
>                               PARENT_TARGET builtins)
>     endif ()
>   endforeach ()
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://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/20160725/d50edab3/attachment.html>


More information about the llvm-commits mailing list