Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[CMake] llvm_map_components_to_libraries() may cause infinite loop #21015

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR21016
Status CONFIRMED
Importance P normal
Reported by Kai Nacke (kai@redstar.de)
Reported on 2014-09-21 03:45:57 -0700
Last modified on 2015-06-26 13:54:22 -0700
Version trunk
Hardware All All
CC dan@su-root.co.uk, geek4civic@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
The dependency to library LLVMX86Utils is missing if
llvm_map_components_to_libnames is used. See output of:

project(bug)
cmake_minimum_required(VERSION 2.8)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/opt/llvm-trunk/share/llvm/cmake")
include(LLVMConfig)

llvm_map_components_to_libnames(tmplibs X86)

message("Libraries: ${tmplibs}")

Output is:
Libraries:
LLVMX86CodeGen;LLVMX86AsmPrinter;LLVMX86AsmParser;LLVMX86Desc;LLVMX86Info;LLVMX86Disassembler

If llvm_map_components_to_libnames(tmplibs X86) is replaced with
llvm_map_components_to_libraries(tmplibs X86), then the output is:

Libraries:
LLVMX86CodeGen;LLVMX86AsmParser;LLVMX86Disassembler;LLVMAsmPrinter;LLVMSelectionDAG;LLVMX86Desc;LLVMMCParser;LLVMCodeGen;LLVMX86AsmPrinter;LLVMX86Info;LLVMScalarOpts;LLVMX86Utils;LLVMInstCombine;LLVMTransformUtils;LLVMipa;LLVMAnalysis;LLVMTarget;LLVMCore;LLVMMC;LLVMObject;LLVMSupport;dl;pthread

1) Please note the missing LLVMX86Utils
2) Using llvm_map_components_to_libraries this way with LLVM trunk results in
an infinte loop
Quuxplusone commented 9 years ago

_Bug 21017 has been marked as a duplicate of this bug._

Quuxplusone commented 9 years ago

AArch64 is also affected.

Quuxplusone commented 9 years ago

@Takumi: I CC you because I think you did most of the work on the cmake scripts.

Quuxplusone commented 9 years ago
1) Please note the missing LLVMX86Utils

It's expected. The name "X86" is expanded to essential components.
Consider the target FOO that doesn't have LLVMFOOUtils.

CMake's target_link_libraries() will work transitively. LLVMX86CodeGen will
bring in LLVMX86Utils.

2) Using llvm_map_components_to_libraries this way with LLVM trunk results in
an infinte loop

Although it is deprecated, it's a bug. I reproduced infinite loop.
Removing llvm_map_components_to_libraries() would be an option. :)