<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63793>63793</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Attempting to cross-compile libclang_rt.profile.a with -DCOMPILER_RT_BUILD_PROFILE=ON generates native object files
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ian-collins-ctct
</td>
</tr>
</table>
<pre>
Hello,
I have been building and using an ARM cross of the builtins for a while and I wanted to try profile guides optimisation on the target.
I changed my cmake rune to use `-DCOMPILER_RT_BUILD_PROFILE=ON` (previously OFF) and it appears to build but my test application built fails with
`ld.lld: error: /usr/lib/llvm-16/lib/clang/16/lib/armv7a-r2-linux-gnueabihf/libclang_rt.profile.a(InstrProfilingRuntime.cpp.o) is incompatible with elf32-littlearm`
Checking what was generated for ninja:
`$ ninja -t commands | grep InstrProfilingRuntime.cpp.o`
`/usr/bin/clang++-16 -I/build/compiler-rt/lib/profile/.. -I/build/compiler-rt/lib/profile/../../include -Wall -Wno-unused-parameter -O3 -DNDEBUG -fno-lto -fPIC -Wno-pedantic -DCOMPILER_RT_HAS_ATOMICS=1 -DCOMPILER_RT_HAS_FCNTL_LCK=1 -DCOMPILER_RT_HAS_UNAME=1 -nostdinc++ -std=c++17 -MD -MT lib/profile/CMakeFiles/clang_rt.profile-armhf.dir/InstrProfilingRuntime.cpp.o -MF lib/profile/CMakeFiles/clang_rt.profile-armhf.dir/InstrProfilingRuntime.cpp.o.d -o lib/profile/CMakeFiles/clang_rt.profile-armhf.dir/InstrProfilingRuntime.cpp.o -c /build/compiler-rt/lib/profile/InstrProfilingRuntime.cpp`
Note the lack of the expected --target option.
I am currently building on tag llvmorg-16.0.6.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lc9zmzoQx_8a-bIjBoOD7QMHxw6vnhfHmTSdHj2LWECNkBhJJM1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