<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/89132>89132</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            building 18.1.4 with libc issue
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          torehl
      </td>
    </tr>
</table>

<pre>
    I'm trying to build Clang 18.1.4 with offloading with nvptx and amdgpu. The pretty much same cmake args worked on 17.0.6.

Modules loaded:

'torel@srl-login1:~$ module list
Currently Loaded Modulefiles:
 1) slurm/21.08.8               6) cuda12.3/toolkit/12.3.2   11) gmp/gcc/6.3.0(default)        
 2) docker/20.10.26             7) cuda12.3/blas/12.3.2      12) mpfr/gcc/4.2.1(default)       
 3) google/gdrive/2.1.0         8) cuda12.3/fft/12.3.2       13) mpc/gcc/u2204/1.3.1(default)  
 4) numactl/gcc/2.0.18          9) cuda12.3/profiler/12.3.2  14) cmake/gcc/3.28.4              
 5) hwloc/gcc/2.10.0(default)  10) amd/rocm/5.7.3     
'

Cmake config:

`cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-mavx2 -mno-avx512f -mno-avx512pf -mno-avx512bw" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;bolt;libc;libclc;lld;lldb;openmp;flang;polly;pstl;mlir" -DCMAKE_INSTALL_PREFIX=/cm/shared/apps/clang/gcc/18.1.4 -G "Unix Makefiles"  ../llvm -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_80 -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=70,75,80,90 -DLIBOMPTARGET_DEP_CUDA_DRIVER=/cm/shared/apps/cuda12.3/toolkit/12.3.2/targets/x86_64-linux/lib/stubs/libcuda.so`

Build fails at 

```
[ 22%] Building CXX object projects/libc/src/string/CMakeFiles/libc.src.string.strcpy.dir/strcpy.cpp.o
In file included from /home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/__support/endian.h:12,
                 from /home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/memory_utils/utils.h:1 ,
                 from /home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/memory_utils/inline_memcpy.h:14,
                 from /home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/strcpy.cpp:10:
/home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/strcpy.cpp:17:28: error: ‘char* __llvm_libc_18_1_4_::strcpy(char*, const char*)’ aliased to external symbol ‘strcpy’
   17 | LLVM_LIBC_FUNCTION(char *, strcpy,
      |                            ^~~~~~
/home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/__support/common.h:28:34: note: in definition of macro ‘LLVM_LIBC_FUNCTION_IMPL’
   28 |   decltype(LIBC_NAMESPACE::name) name [[gnu::alias(#name)]];                   \
      |                                  ^~~~
/home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/strcpy.cpp:17:1: note: in expansion of macro ‘LLVM_LIBC_FUNCTION’
   17 | LLVM_LIBC_FUNCTION(char *, strcpy,
      | ^~~~~~~~~~~~~~~~~~
/home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/strcpy.cpp:17:28: error: ‘char* __llvm_libc_18_1_4_::strcpy(char*, const char*)’ specifies less restrictive attributes than its target ‘char* strcpy(char*, const char*)’: ‘leaf’, ‘nonnull’, ‘nothrow’ [-Werror=missing-attributes]
   17 | LLVM_LIBC_FUNCTION(char *, strcpy,
      |                            ^~~~~~
/home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/__support/common.h:28:34: note: in definition of macro ‘LLVM_LIBC_FUNCTION_IMPL’
   28 |   decltype(LIBC_NAMESPACE::name) name [[gnu::alias(#name)]];                   \
      |                                  ^~~~
/home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/strcpy.cpp:17:1: note: in expansion of macro ‘LLVM_LIBC_FUNCTION’
   17 | LLVM_LIBC_FUNCTION(char *, strcpy,
      | ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/features.h:486,
                 from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
                 from /usr/include/string.h:26,
                 from /home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/strcpy.h:12,
                 from /home/torel/workspace/Clang/llvm-project-llvmorg-18.1.4/libc/src/string/strcpy.cpp:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:77:1: note: ‘char* __llvm_libc_18_1_4_::strcpy(char*, const char*)’ target declared here
   77 | __NTH (strcpy (char *__restrict __dest, const char *__restrict __src))
      | ^~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [projects/libc/src/string/CMakeFiles/libc.src.string.strcpy.dir/build.make:76: projects/libc/src/string/CMakeFiles/libc.src.string.strcpy.dir/strcpy.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:81671: projects/libc/src/string/CMakeFiles/libc.src.string.strcpy.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
torel@srl-login1:~/workspace/Clang/llvm-project-llvmorg-18.1.4/Build-clang-x86_64$ 
```

Any suggestions?  
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWMuSozjWfhrlRmEChDF44QXGptr_78x0ZDlrclaEABlrSiBCEnnZ9LNPHIGvWdVTNdHZPTHThMNCt_N956IjIao1rxrGZiiYo2BxQzuzl2pmpGJ7cZPL8m22QiSssVFvvKmwkTjvuChxImhTYS9yPGeMX7jZY7nbCUlLGGXrzXNrXjFtSkzrsmo7B2_3DLeKGfOG667YY01rhouafmWYqkrjF6m-shLLBnuh4zoTB7kL5Mb9_60sO8E0BgxWIj8-70QkBMoCjV2txEjIijce8uNfERnj2s7EgmvTj046pVhjxBteW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