[libc-commits] [libc] 6641f8d - [libc] Fix amdgpu startup code flags

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Feb 22 09:38:39 PST 2023


Author: Joseph Huber
Date: 2023-02-22T11:38:26-06:00
New Revision: 6641f8da73aee7afebeaab572871dcb737d9f340

URL: https://github.com/llvm/llvm-project/commit/6641f8da73aee7afebeaab572871dcb737d9f340
DIFF: https://github.com/llvm/llvm-project/commit/6641f8da73aee7afebeaab572871dcb737d9f340.diff

LOG: [libc] Fix amdgpu startup code flags

Summary:
Currently AMDGPU only barely supports cross-TU ELF linking. Full linking
is usually done via LTO. This requires passing the architecture to the
link job. This is done automatically via `-flto` since D144505. Add this
to the link options.

Added: 
    

Modified: 
    libc/startup/gpu/amdgpu/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/startup/gpu/amdgpu/CMakeLists.txt b/libc/startup/gpu/amdgpu/CMakeLists.txt
index c2ae950eaafcb..be202371fa3a1 100644
--- a/libc/startup/gpu/amdgpu/CMakeLists.txt
+++ b/libc/startup/gpu/amdgpu/CMakeLists.txt
@@ -15,4 +15,5 @@ add_startup_object(
 get_fq_target_name(crt1 fq_name)
 
 # Ensure that clang uses the correct linker for this object type.
-target_link_libraries(${fq_name} PUBLIC "--target=${LIBC_GPU_TARGET_TRIPLE}")
+target_link_libraries(${fq_name} PUBLIC 
+                      "--target=${LIBC_GPU_TARGET_TRIPLE}" "-flto")


        


More information about the libc-commits mailing list