SHA256
1
0
forked from pool/llvm15
llvm15/CMake-Look-up-target-subcomponents-in-LLVM_AVAILABLE_LIBS.patch
Richard Biener 43f9d469ce Accepting request 1002539 from home:aaronpuchert:llvm-next
- Update to version 15.0.0.
  * For details, see the release notes:
    - https://releases.llvm.org/15.0.0/docs/ReleaseNotes.html
    - https://releases.llvm.org/15.0.0/tools/clang/docs/ReleaseNotes.html
    - https://releases.llvm.org/15.0.0/tools/clang/tools/extra/docs/ReleaseNotes.html
    - https://releases.llvm.org/15.0.0/projects/libcxx/docs/ReleaseNotes.html
    - https://releases.llvm.org/15.0.0/tools/lld/docs/ReleaseNotes.html
  * New LLVM tools:
    - llvm-debuginfod: Provides debug info to remote hosts.
    - llvm-dwarfutil: Can copy and manipulate debug info.
    - llvm-remark-size-diff: Compute diff between remark files.
  * New Clang tools:
    - clang-offload-packager: Bundle multiple objects into single
      fat binaries including offload code.
    - clang-pseudo: Approximate heuristic parser for C++.
- Rebase patches:
  * check-no-llvm-exegesis.patch
  * link-clang-tools-extra-shared.patch
  * lld-default-sha1.patch
  * llvm-do-not-install-static-libraries.patch
  * lto-disable-cache.patch
- Drop patches that have landed upstream:
  * clang-repl-private-deps.patch
  * llvm-glibc-2-36.patch
  * llvm-scev-fix-isImpliedViaMerge.patch
- Drop llvm-lifetime-for-rust.patch: this is now solved via
  attributes and LLVM doesn't need a hardcoded list of allocation
  functions anymore.
- Add llvm-link-atomic.patch to fix build on ppc.
- Add libcxx-test-library-path.patch to fix libc++ tests failing
  without RUNPATH on libc++.so.
- Add libcxxabi-fix-armv7-test.patch to fix tests on armv7l.
- Thanks to Andreas Schwab for most of the rebasing!

OBS-URL: https://build.opensuse.org/request/show/1002539
OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm15?expand=0&rev=1
2022-09-12 07:14:57 +00:00

133 lines
5.5 KiB
Diff

From b49307ef82196729e1ab2508b73fc7fc80192668 Mon Sep 17 00:00:00 2001
From: Aaron Puchert <aaronpuchert@alice-dsl.net>
Date: Sun, 14 Feb 2021 22:54:07 +0100
Subject: [PATCH] [CMake] Look up target subcomponents in LLVM_AVAILABLE_LIBS
In an installation using the all-contained libLLVM.so, individual
components are not available as targets, so we have to look them up in
LLVM_AVAILABLE_LIBS just like llvm_map_components_to_libnames does it.
Here I don't think we need the capitalized names though because we know
the right capitalization. But I might be wrong.
This is required by dragonffi, who call llvm_map_components_to_libnames
on a list containing ${LLVM_NATIVE_ARCH}. Downstream bug report:
https://bugzilla.opensuse.org/show_bug.cgi?id=1180748.
Differential Revision: https://reviews.llvm.org/D96670
---
llvm/cmake/modules/LLVM-Config.cmake | 61 +++++++++++++---------------
1 file changed, 28 insertions(+), 33 deletions(-)
diff --git a/llvm/cmake/modules/LLVM-Config.cmake b/llvm/cmake/modules/LLVM-Config.cmake
index 5d9ec79c7c56..1cd10993b903 100644
--- a/llvm/cmake/modules/LLVM-Config.cmake
+++ b/llvm/cmake/modules/LLVM-Config.cmake
@@ -125,47 +125,38 @@ endfunction(llvm_map_components_to_libraries)
# available and not a list of the components.
function(llvm_expand_pseudo_components out_components)
set( link_components ${ARGN} )
+ if(NOT LLVM_AVAILABLE_LIBS)
+ # Inside LLVM itself available libs are in a global property.
+ get_property(LLVM_AVAILABLE_LIBS GLOBAL PROPERTY LLVM_LIBS)
+ endif()
foreach(c ${link_components})
# add codegen, asmprinter, asmparser, disassembler
list(FIND LLVM_TARGETS_TO_BUILD ${c} idx)
if( NOT idx LESS 0 )
- if( TARGET LLVM${c}CodeGen )
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${c}CodeGen lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
list(APPEND expanded_components "${c}CodeGen")
else()
- if( TARGET LLVM${c} )
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${c} lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
list(APPEND expanded_components "${c}")
else()
message(FATAL_ERROR "Target ${c} is not in the set of libraries.")
endif()
endif()
- if( TARGET LLVM${c}AsmPrinter )
- list(APPEND expanded_components "${c}AsmPrinter")
- endif()
- if( TARGET LLVM${c}AsmParser )
- list(APPEND expanded_components "${c}AsmParser")
- endif()
- if( TARGET LLVM${c}Desc )
- list(APPEND expanded_components "${c}Desc")
- endif()
- if( TARGET LLVM${c}Disassembler )
- list(APPEND expanded_components "${c}Disassembler")
- endif()
- if( TARGET LLVM${c}Info )
- list(APPEND expanded_components "${c}Info")
- endif()
- if( TARGET LLVM${c}Utils )
- list(APPEND expanded_components "${c}Utils")
- endif()
+ foreach(subcomponent IN ITEMS AsmPrinter AsmParser Desc Disassembler Info Utils)
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${c}${subcomponent} lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
+ list(APPEND expanded_components "${c}${subcomponent}")
+ endif()
+ endforeach()
elseif( c STREQUAL "nativecodegen" )
- if( TARGET LLVM${LLVM_NATIVE_ARCH}CodeGen )
- list(APPEND expanded_components "${LLVM_NATIVE_ARCH}CodeGen")
- endif()
- if( TARGET LLVM${LLVM_NATIVE_ARCH}Desc )
- list(APPEND expanded_components "${LLVM_NATIVE_ARCH}Desc")
- endif()
- if( TARGET LLVM${LLVM_NATIVE_ARCH}Info )
- list(APPEND expanded_components "${LLVM_NATIVE_ARCH}Info")
- endif()
+ foreach(subcomponent IN ITEMS CodeGen Desc Info)
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${LLVM_NATIVE_ARCH}${subcomponent} lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
+ list(APPEND expanded_components "${LLVM_NATIVE_ARCH}${subcomponent}")
+ endif()
+ endforeach()
elseif( c STREQUAL "AllTargetsCodeGens" )
# Link all the codegens from all the targets
foreach(t ${LLVM_TARGETS_TO_BUILD})
@@ -176,28 +167,32 @@ function(llvm_expand_pseudo_components out_components)
elseif( c STREQUAL "AllTargetsAsmParsers" )
# Link all the asm parsers from all the targets
foreach(t ${LLVM_TARGETS_TO_BUILD})
- if( TARGET LLVM${t}AsmParser )
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${t}AsmParser lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
list(APPEND expanded_components "${t}AsmParser")
endif()
endforeach(t)
elseif( c STREQUAL "AllTargetsDescs" )
# Link all the descs from all the targets
foreach(t ${LLVM_TARGETS_TO_BUILD})
- if( TARGET LLVM${t}Desc )
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${t}Desc lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
list(APPEND expanded_components "${t}Desc")
endif()
endforeach(t)
elseif( c STREQUAL "AllTargetsDisassemblers" )
# Link all the disassemblers from all the targets
foreach(t ${LLVM_TARGETS_TO_BUILD})
- if( TARGET LLVM${t}Disassembler )
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${t}Disassembler lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
list(APPEND expanded_components "${t}Disassembler")
endif()
endforeach(t)
elseif( c STREQUAL "AllTargetsInfos" )
# Link all the infos from all the targets
foreach(t ${LLVM_TARGETS_TO_BUILD})
- if( TARGET LLVM${t}Info )
+ list(FIND LLVM_AVAILABLE_LIBS LLVM${t}Info lib_idx)
+ if( lib_idx GREATER_EQUAL 0 )
list(APPEND expanded_components "${t}Info")
endif()
endforeach(t)
--
2.30.0