r259862 - [CMake] Improve the clang order-file generation workflow
Chris Bieneman via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 4 19:07:39 PST 2016
Actually r259871 includes the code to cleanup the “bad” order file…
-Chris
> On Feb 4, 2016, at 7:02 PM, Chris Bieneman <beanz at apple.com> wrote:
>
> I pushed a speculative fix for this in r259870. I’m unable to reproduce locally. There are a few bots that hit the same issue, so I’m watching them.
>
> -Chris
>
>> On Feb 4, 2016, at 6:44 PM, Chris Bieneman via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
>>
>> What linker are you using and on what OS? I’m looking at this now, and will revert if I can’t find a solution.
>>
>> -Chris
>>
>>> On Feb 4, 2016, at 6:38 PM, Richard Smith <richard at metafoo.co.uk <mailto:richard at metafoo.co.uk>> wrote:
>>>
>>> This is causing my links to fail with:
>>>
>>> FAILED: : && /usr/local/google/home/richardsmith/bin/clang++ -fcolor-diagnostics -std=c++11 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -std=c++11 -fcolor-diagnostics -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g -Wl,-allow-shlib-undefined -Wl,--export-dynamic tools/clang/tools/driver/CMakeFiles/clang.dir/driver.cpp.o tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o tools/clang/tools/driver/CMakeFiles/clang.dir/cc1as_main.cpp.o -o bin/clang-3.8 lib/libLLVMAArch64CodeGen.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64AsmParser.a lib/libLLVMAArch64Desc.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Disassembler.a lib/libLLVMAMDGPUCodeGen.a lib/libLLVMAMDGPUAsmPrinter.a lib/libLLVMAMDGPUAsmParser.a lib/libLLVMAMDGPUDesc.a lib/libLLVMAMDGPUInfo.a lib/libLLVMARMCodeGen.a lib/libLLVMARMAsmPrinter.a lib/libLLVMARMAsmParser.a lib/libLLVMARMDesc.a lib/libLLVMARMInfo.a lib/libLLVMARMDisassembler.a lib/libLLVMBPFCodeGen.a lib/libLLVMBPFAsmPrinter.a lib/libLLVMBPFDesc.a lib/libLLVMBPFInfo.a lib/libLLVMCppBackendCodeGen.a lib/libLLVMCppBackendInfo.a lib/libLLVMHexagonCodeGen.a lib/libLLVMHexagonAsmParser.a lib/libLLVMHexagonDesc.a lib/libLLVMHexagonInfo.a lib/libLLVMHexagonDisassembler.a lib/libLLVMMipsCodeGen.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMipsAsmParser.a lib/libLLVMMipsDesc.a lib/libLLVMMipsInfo.a lib/libLLVMMipsDisassembler.a lib/libLLVMMSP430CodeGen.a lib/libLLVMMSP430AsmPrinter.a lib/libLLVMMSP430Desc.a lib/libLLVMMSP430Info.a lib/libLLVMNVPTXCodeGen.a lib/libLLVMNVPTXAsmPrinter.a lib/libLLVMNVPTXDesc.a lib/libLLVMNVPTXInfo.a lib/libLLVMPowerPCCodeGen.a lib/libLLVMPowerPCAsmPrinter.a lib/libLLVMPowerPCAsmParser.a lib/libLLVMPowerPCDesc.a lib/libLLVMPowerPCInfo.a lib/libLLVMPowerPCDisassembler.a lib/libLLVMSparcCodeGen.a lib/libLLVMSparcAsmPrinter.a lib/libLLVMSparcAsmParser.a lib/libLLVMSparcDesc.a lib/libLLVMSparcInfo.a lib/libLLVMSparcDisassembler.a lib/libLLVMSystemZCodeGen.a lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZAsmParser.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZInfo.a lib/libLLVMSystemZDisassembler.a lib/libLLVMX86CodeGen.a lib/libLLVMX86AsmPrinter.a lib/libLLVMX86AsmParser.a lib/libLLVMX86Desc.a lib/libLLVMX86Info.a lib/libLLVMX86Disassembler.a lib/libLLVMXCoreCodeGen.a lib/libLLVMXCoreAsmPrinter.a lib/libLLVMXCoreDesc.a lib/libLLVMXCoreInfo.a lib/libLLVMXCoreDisassembler.a lib/libLLVMAnalysis.a lib/libLLVMCodeGen.a lib/libLLVMCore.a lib/libLLVMipo.a lib/libLLVMInstCombine.a lib/libLLVMInstrumentation.a lib/libLLVMMC.a lib/libLLVMMCParser.a lib/libLLVMObjCARCOpts.a lib/libLLVMOption.a lib/libLLVMScalarOpts.a lib/libLLVMSupport.a lib/libLLVMTransformUtils.a lib/libLLVMVectorize.a lib/libclangBasic.a lib/libclangCodeGen.a lib/libclangDriver.a lib/libclangFrontend.a lib/libclangFrontendTool.a -Wl,-order_file,/usr/local/google/home/richardsmith/clang-8/build/tools/clang/clang.order lib/libLLVMAArch64Desc.a lib/libLLVMAArch64AsmPrinter.a lib/libLLVMAArch64Info.a lib/libLLVMAArch64Utils.a lib/libLLVMAMDGPUAsmPrinter.a lib/libLLVMAMDGPUUtils.a lib/libLLVMARMDesc.a lib/libLLVMARMAsmPrinter.a lib/libLLVMARMInfo.a lib/libLLVMBPFAsmPrinter.a lib/libLLVMHexagonDesc.a lib/libLLVMHexagonInfo.a lib/libLLVMMipsAsmPrinter.a lib/libLLVMMipsInfo.a lib/libLLVMMSP430AsmPrinter.a lib/libLLVMNVPTXAsmPrinter.a lib/libLLVMPowerPCAsmPrinter.a lib/libLLVMPowerPCInfo.a lib/libLLVMSparcAsmPrinter.a lib/libLLVMSparcInfo.a lib/libLLVMSystemZDesc.a lib/libLLVMSystemZAsmPrinter.a lib/libLLVMSystemZInfo.a lib/libLLVMX86AsmPrinter.a lib/libLLVMX86Utils.a lib/libLLVMX86Info.a lib/libLLVMXCoreAsmPrinter.a lib/libLLVMAsmPrinter.a lib/libLLVMDebugInfoCodeView.a lib/libLLVMSelectionDAG.a lib/libLLVMCodeGen.a lib/libLLVMXCoreInfo.a lib/libLLVMMCDisassembler.a lib/libclangCodeGen.a lib/libLLVMipo.a lib/libLLVMVectorize.a lib/libLLVMInstrumentation.a lib/libLLVMObjCARCOpts.a lib/libLLVMScalarOpts.a lib/libLLVMInstCombine.a lib/libLLVMTarget.a lib/libLLVMBitWriter.a lib/libLLVMIRReader.a lib/libLLVMAsmParser.a lib/libLLVMLinker.a lib/libLLVMTransformUtils.a lib/libLLVMAnalysis.a lib/libLLVMProfileData.a lib/libLLVMObject.a lib/libclangRewriteFrontend.a lib/libclangARCMigrate.a lib/libclangStaticAnalyzerFrontend.a lib/libclangFrontend.a lib/libclangDriver.a lib/libLLVMOption.a lib/libclangParse.a lib/libLLVMMCParser.a lib/libclangSerialization.a lib/libLLVMBitReader.a lib/libclangSema.a lib/libclangEdit.a lib/libclangStaticAnalyzerCheckers.a lib/libclangStaticAnalyzerCore.a lib/libclangAnalysis.a lib/libclangAST.a lib/libclangRewrite.a lib/libclangLex.a lib/libclangBasic.a lib/libLLVMCore.a lib/libLLVMMC.a lib/libLLVMSupport.a -lrt -ldl -ltinfo -lpthread -lz -lm -Wl,-rpath,"\$ORIGIN/../lib" && :
>>> /usr/local/google/home/richardsmith/clang-8/build/tools/clang/clang.order: file not recognized: File truncated
>>> clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
>>>
>>> The generated clang.order file is empty. Please fix or revert!
>>>
>>> On Thu, Feb 4, 2016 at 5:22 PM, Chris Bieneman via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
>>> Author: cbieneman
>>> Date: Thu Feb 4 19:22:03 2016
>>> New Revision: 259862
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=259862&view=rev <http://llvm.org/viewvc/llvm-project?rev=259862&view=rev>
>>> Log:
>>> [CMake] Improve the clang order-file generation workflow
>>>
>>> Summary:
>>> With this change generating clang order files using dtrace uses the following workflow:
>>>
>>> cmake <whatever options you want>
>>>
>>> ninja generate-order-file
>>>
>>> ninja clang
>>>
>>> This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.
>>>
>>> CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.
>>>
>>> Reviewers: bogner
>>>
>>> Subscribers: cfe-commits
>>>
>>> Differential Revision: http://reviews.llvm.org/D16896 <http://reviews.llvm.org/D16896>
>>>
>>> Modified:
>>> cfe/trunk/CMakeLists.txt
>>> cfe/trunk/tools/driver/CMakeLists.txt
>>> cfe/trunk/utils/perf-training/CMakeLists.txt
>>>
>>> Modified: cfe/trunk/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=259862&r1=259861&r2=259862&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=259862&r1=259861&r2=259862&view=diff>
>>> ==============================================================================
>>> --- cfe/trunk/CMakeLists.txt (original)
>>> +++ cfe/trunk/CMakeLists.txt Thu Feb 4 19:22:03 2016
>>> @@ -586,9 +586,19 @@ if( CLANG_INCLUDE_DOCS )
>>> add_subdirectory(docs)
>>> endif()
>>>
>>> -set(CLANG_ORDER_FILE "" CACHE FILEPATH
>>> +# this line is needed as a cleanup to ensure that any CMakeCaches with the old
>>> +# default value get updated to the new default.
>>> +if(CLANG_ORDER_FILE STREQUAL "")
>>> + unset(CLANG_ORDER_FILE CACHE)
>>> +endif()
>>> +
>>> +set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
>>> "Order file to use when compiling clang in order to improve startup time.")
>>>
>>> +if(NOT EXISTS ${CLANG_ORDER_FILE})
>>> + execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${CLANG_ORDER_FILE})
>>> +endif()
>>> +
>>> if (CLANG_BUILT_STANDALONE OR CMAKE_VERSION VERSION_EQUAL 3 OR
>>> CMAKE_VERSION VERSION_GREATER 3)
>>> # Generate a list of CMake library targets so that other CMake projects can
>>>
>>> Modified: cfe/trunk/tools/driver/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=259862&r1=259861&r2=259862&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/CMakeLists.txt?rev=259862&r1=259861&r2=259862&view=diff>
>>> ==============================================================================
>>> --- cfe/trunk/tools/driver/CMakeLists.txt (original)
>>> +++ cfe/trunk/tools/driver/CMakeLists.txt Thu Feb 4 19:22:03 2016
>>> @@ -87,8 +87,12 @@ if (APPLE)
>>> set(TOOL_INFO_BUILD_VERSION)
>>> endif()
>>>
>>> -if(CLANG_ORDER_FILE)
>>> +check_cxx_compiler_flag("-Wl,-order_file,${CLANG_ORDER_FILE}"
>>> + LINKER_HAS_ORDER_FILE_FLAG)
>>> +
>>> +if(LINKER_HAS_ORDER_FILE_FLAG)
>>> target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
>>> + set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
>>> endif()
>>>
>>> if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)
>>>
>>> Modified: cfe/trunk/utils/perf-training/CMakeLists.txt
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/CMakeLists.txt?rev=259862&r1=259861&r2=259862&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/perf-training/CMakeLists.txt?rev=259862&r1=259861&r2=259862&view=diff>
>>> ==============================================================================
>>> --- cfe/trunk/utils/perf-training/CMakeLists.txt (original)
>>> +++ cfe/trunk/utils/perf-training/CMakeLists.txt Thu Feb 4 19:22:03 2016
>>> @@ -55,9 +55,8 @@ if(DTRACE)
>>> COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py clean ${CMAKE_CURRENT_BINARY_DIR} dtrace
>>> COMMENT "Clearing old dtrace data")
>>>
>>> -
>>> add_custom_target(generate-order-file
>>> - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py gen-order-file --binary $<TARGET_FILE:clang> --output ${CMAKE_CURRENT_BINARY_DIR}/clang.order ${CMAKE_CURRENT_BINARY_DIR}
>>> + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py gen-order-file --binary $<TARGET_FILE:clang> --output ${CLANG_ORDER_FILE} ${CMAKE_CURRENT_BINARY_DIR}
>>> COMMENT "Generating order file"
>>> DEPENDS generate-dtrace-logs)
>>> endif()
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
>>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160204/aa4cba79/attachment-0001.html>
More information about the cfe-commits
mailing list