dnovillo wrote:

> @dnovillo it seems that this patch breaks the build with `BUILD_SHARED_LIBS`. 
> I had to revert it in #202558 .
> 
> It fails with:
> 
> ```
> : && /opt/rh/gcc-toolset-13/root/usr/bin/c++ -fPIC -fPIC 
> -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time 
> -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual 
> -Wno-missing-field-initializers -pedantic -Wno-long-long 
> -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess 
> -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move 
> -Wno-array-bounds -Wno-stringop-overread -Wno-dangling-pointer 
> -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment 
> -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
> -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete 
>   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-build-only/build/./lib  
> -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendHLSL.so.23.0git -o 
> lib/libLLVMFrontendHLSL.so.23.0git 
> lib/Frontend/HLSL/CMakeFiles/LLVMFrontendHLSL.dir/CBuffer.cpp.o 
> lib/Frontend/HLSL/CMakeFiles/LLVMFrontendHLSL.dir/HLSLBinding.cpp.o 
> lib/Frontend/HLSL/CMakeFiles/LLVMFrontendHLSL.dir/HLSLResource.cpp.o 
> lib/Frontend/HLSL/CMakeFiles/LLVMFrontendHLSL.dir/HLSLRootSignature.cpp.o 
> lib/Frontend/HLSL/CMakeFiles/LLVMFrontendHLSL.dir/RootSignatureMetadata.cpp.o 
> lib/Frontend/HLSL/CMakeFiles/LLVMFrontendHLSL.dir/RootSignatureValidations.cpp.o
>   
> -Wl,-rpath,"\$ORIGIN/../lib:\$ORIGIN/../lib/x86_64-unknown-linux-gnu:/home/botworker/bbot/amdgpu-offload-build-only/build/lib:"
>   lib/libLLVMCore.so.23.0git  lib/libLLVMBinaryFormat.so.23.0git  
> lib/libLLVMSupport.so.23.0git  
> -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-build-only/build/lib && :
> /opt/rh/gcc-toolset-13/root/usr/libexec/gcc/x86_64-redhat-linux/13/ld: 
> lib/Frontend/HLSL/CMakeFiles/LLVMFrontendHLSL.dir/CBuffer.cpp.o: in function 
> `llvm::hlsl::CBufferMetadata::removeCBufferGlobalsFromUseList(llvm::Module&)':
> CBuffer.cpp:(.text._ZN4llvm4hlsl15CBufferMetadata31removeCBufferGlobalsFromUseListERNS_6ModuleE+0xce):
>  undefined reference to `llvm::removeFromUsedLists(llvm::Module&, 
> llvm::function_ref<bool (llvm::Constant*)>)'
> ```
> 
> I've tried to add `TransformUtils` in the dependencies of `LLVMFrontendHLSL`, 
> but we get a circular dependency:
> 
> ```
> CMake Error: The inter-target dependency graph contains the following 
> strongly connected component (cycle):
>   "LLVMFrontendHLSL" of type SHARED_LIBRARY
>     depends on "LLVMTransformUtils" (weak)
>   "LLVMTransformUtils" of type SHARED_LIBRARY
>     depends on "LLVMAnalysis" (weak)
>   "LLVMAnalysis" of type SHARED_LIBRARY
>     depends on "LLVMFrontendHLSL" (weak)
> At least one of these targets is not a STATIC_LIBRARY.  Cyclic dependencies 
> are allowed only among static libraries.
> CMake Generate step failed.  Build files cannot be regenerated correctly.
> ```

Actually, I do not think this was due to this PR. The linker failure is in 
`CBuffer.cpp`, which #196404 does not touch. I think this may have been broken 
by [`d439fac25c03`](https://github.com/llvm/llvm-project/commit/d439fac25c03), 
which added `removeFromUsedLists` to `LLVMFrontendHLSL/CBuffer.cpp` without 
updating `LLVMFrontendHLSL`'s `LINK_COMPONENTS`.

Adding `LLVMTransformUtils` to `LLVMFrontendHLSL` creates a cycle through 
`LLVMAnalysis`.  Once that is fixed, this one  can be re-submitted without 
changes.

https://github.com/llvm/llvm-project/pull/196404
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to