forked from OSchip/llvm-project
Re-enable Windows build and fix issues
Summary: Fix missing string header file inclusion and link_fdata find problem in lit tests. Change root-level tests to require linux. Re-enable Windows in our root CMakeLists.txt. (cherry picked from FBD33296290)
This commit is contained in:
parent
3652483c8e
commit
b392ec696b
|
@ -4,81 +4,77 @@ set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|||
set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
if (NOT CMAKE_HOST_SYSTEM_NAME MATCHES Linux)
|
||||
message(WARNING "Not building BOLT on unsupported platform")
|
||||
else()
|
||||
set(BOLT_ENABLE_RUNTIME OFF)
|
||||
if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
set(BOLT_ENABLE_RUNTIME ON)
|
||||
endif()
|
||||
set(BOLT_ENABLE_RUNTIME OFF)
|
||||
if (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
|
||||
set(BOLT_ENABLE_RUNTIME ON)
|
||||
endif()
|
||||
|
||||
set(BOLT_INCLUDE_TESTS OFF)
|
||||
if (LLVM_INCLUDE_TESTS)
|
||||
string(FIND "${LLVM_ENABLE_PROJECTS}" "clang" POSITION)
|
||||
set(BOLT_INCLUDE_TESTS OFF)
|
||||
if (LLVM_INCLUDE_TESTS)
|
||||
string(FIND "${LLVM_ENABLE_PROJECTS}" "clang" POSITION)
|
||||
if (NOT ${POSITION} EQUAL -1)
|
||||
string(FIND "${LLVM_ENABLE_PROJECTS}" "lld" POSITION)
|
||||
if (NOT ${POSITION} EQUAL -1)
|
||||
string(FIND "${LLVM_ENABLE_PROJECTS}" "lld" POSITION)
|
||||
if (NOT ${POSITION} EQUAL -1)
|
||||
set(BOLT_INCLUDE_TESTS ON)
|
||||
else()
|
||||
message(WARNING "Not including BOLT tests since lld is disabled")
|
||||
endif()
|
||||
set(BOLT_INCLUDE_TESTS ON)
|
||||
else()
|
||||
message(WARNING "Not including BOLT tests since clang is disabled")
|
||||
message(WARNING "Not including BOLT tests since lld is disabled")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BOLT_ENABLE_RUNTIME)
|
||||
message(STATUS "Building BOLT runtime libraries for X86")
|
||||
ExternalProject_Add(bolt_rt
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime"
|
||||
STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-stamps
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins
|
||||
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
-DCMAKE_INSTALL_PREFIX=${LLVM_BINARY_DIR}
|
||||
BUILD_ALWAYS True
|
||||
)
|
||||
install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/cmake_install.cmake \)"
|
||||
COMPONENT bolt)
|
||||
add_llvm_install_targets(install-bolt_rt
|
||||
DEPENDS bolt_rt bolt
|
||||
COMPONENT bolt)
|
||||
endif()
|
||||
|
||||
# Get the current git revision for BOLT.
|
||||
find_program(git_executable NAMES git git.exe git.cmd)
|
||||
if (git_executable)
|
||||
execute_process(COMMAND ${git_executable} rev-parse HEAD
|
||||
WORKING_DIRECTORY ${LLVM_MAIN_SRC_DIR}
|
||||
TIMEOUT 5
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output)
|
||||
if( git_result EQUAL 0 )
|
||||
string(STRIP "${git_output}" git_ref_id)
|
||||
set(BOLT_REVISION "${git_ref_id}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we can't find a revision, set it to "<unknown>".
|
||||
if (NOT BOLT_REVISION)
|
||||
set(BOLT_REVISION "<unknown>")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/bolt/Utils/BoltRevision.inc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/bolt/Utils/BoltRevision.inc)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(tools)
|
||||
|
||||
if (BOLT_INCLUDE_TESTS)
|
||||
add_subdirectory(test)
|
||||
else()
|
||||
message(WARNING "Not including BOLT tests since clang is disabled")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (BOLT_ENABLE_RUNTIME)
|
||||
message(STATUS "Building BOLT runtime libraries for X86")
|
||||
ExternalProject_Add(bolt_rt
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime"
|
||||
STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-stamps
|
||||
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins
|
||||
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
||||
-DCMAKE_INSTALL_PREFIX=${LLVM_BINARY_DIR}
|
||||
BUILD_ALWAYS True
|
||||
)
|
||||
install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/cmake_install.cmake \)"
|
||||
COMPONENT bolt)
|
||||
add_llvm_install_targets(install-bolt_rt
|
||||
DEPENDS bolt_rt bolt
|
||||
COMPONENT bolt)
|
||||
endif()
|
||||
|
||||
# Get the current git revision for BOLT.
|
||||
find_program(git_executable NAMES git git.exe git.cmd)
|
||||
if (git_executable)
|
||||
execute_process(COMMAND ${git_executable} rev-parse HEAD
|
||||
WORKING_DIRECTORY ${LLVM_MAIN_SRC_DIR}
|
||||
TIMEOUT 5
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output)
|
||||
if( git_result EQUAL 0 )
|
||||
string(STRIP "${git_output}" git_ref_id)
|
||||
set(BOLT_REVISION "${git_ref_id}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# If we can't find a revision, set it to "<unknown>".
|
||||
if (NOT BOLT_REVISION)
|
||||
set(BOLT_REVISION "<unknown>")
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/bolt/Utils/BoltRevision.inc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include/bolt/Utils/BoltRevision.inc)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_BINARY_DIR}/include
|
||||
)
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(tools)
|
||||
|
||||
if (BOLT_INCLUDE_TESTS)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#define BOLT_PASSES_INSTRUMENTATION_SUMMARY_H
|
||||
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
|
|
@ -45,7 +45,7 @@ std::string RuntimeLibrary::getLibPath(StringRef ToolPath,
|
|||
|
||||
void RuntimeLibrary::loadLibrary(StringRef LibPath, RuntimeDyld &RTDyld) {
|
||||
ErrorOr<std::unique_ptr<MemoryBuffer>> MaybeBuf =
|
||||
MemoryBuffer::getFile(LibPath, -1, false);
|
||||
MemoryBuffer::getFile(LibPath, false, false);
|
||||
check_error(MaybeBuf.getError(), LibPath);
|
||||
std::unique_ptr<MemoryBuffer> B = std::move(MaybeBuf.get());
|
||||
file_magic Magic = identify_magic(B->getBuffer());
|
||||
|
|
|
@ -14,28 +14,30 @@ set(BOLT_TEST_PARAMS
|
|||
)
|
||||
|
||||
list(APPEND BOLT_TEST_DEPS
|
||||
clang
|
||||
count
|
||||
FileCheck
|
||||
llc
|
||||
lld
|
||||
llvm-config
|
||||
FileCheck count not
|
||||
llvm-bolt
|
||||
llvm-boltdiff
|
||||
perf2bolt
|
||||
merge-fdata
|
||||
llvm-dwarfdump
|
||||
llvm-mc
|
||||
llvm-nm
|
||||
llvm-objdump
|
||||
llvm-readelf
|
||||
llvm-readobj
|
||||
yaml2obj
|
||||
llvm-strip
|
||||
llvm-dwarfdump
|
||||
llvm-mc
|
||||
llvm-objcopy
|
||||
clang
|
||||
lld
|
||||
merge-fdata
|
||||
not
|
||||
perf2bolt
|
||||
yaml2obj
|
||||
)
|
||||
|
||||
add_custom_target(bolt-test-depends DEPENDS ${BOLT_TEST_DEPS})
|
||||
set_target_properties(bolt-test-depends PROPERTIES FOLDER "BOLT tests")
|
||||
set_target_properties(bolt-test-depends PROPERTIES FOLDER "BOLT")
|
||||
|
||||
add_lit_testsuite(check-bolt "Running the BOLT regression tests"
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
|
@ -43,7 +45,7 @@ add_lit_testsuite(check-bolt "Running the BOLT regression tests"
|
|||
DEPENDS ${BOLT_TEST_DEPS}
|
||||
ARGS ${BOLT_TEST_EXTRA_ARGS}
|
||||
)
|
||||
set_target_properties(check-bolt PROPERTIES FOLDER "BOLT tests")
|
||||
set_target_properties(check-bolt PROPERTIES FOLDER "BOLT")
|
||||
|
||||
add_lit_testsuites(BOLT ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PARAMS ${BOLT_TEST_PARAMS}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Check for the replacement of calls to identical functions.
|
||||
|
||||
REQUIRES: system-linux
|
||||
|
||||
RUN: %clangxx %p/Inputs/bolt_icf.cpp -g -Wl,-q -o %t.exe
|
||||
RUN: llvm-bolt %t.exe -relocs -o %t -icf 2>&1 | FileCheck %s
|
||||
RUN: llvm-nm -n %t | FileCheck %s -check-prefix=CHECK-SYM
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# Check that BOLT generates .debug_aranges section for an input
|
||||
# where it was removed when .gdb_index was generated.
|
||||
|
||||
REQUIRES: system-linux
|
||||
|
||||
RUN: %clang %S/Inputs/icf_baz.c %S/Inputs/icf_main.c -Wl,--icf=all,--gdb-index \
|
||||
RUN: -g -o %t.exe -fuse-ld=lld
|
||||
RUN: llvm-bolt %t.exe -o %t -update-debug-sections -keep-aranges
|
||||
|
|
|
@ -61,6 +61,8 @@ llvm_config.use_lld()
|
|||
config.substitutions.append(('%cflags', '-no-pie'))
|
||||
config.substitutions.append(('%cxxflags', '-no-pie'))
|
||||
|
||||
link_fdata_cmd = os.path.join(config.test_source_root, 'link_fdata.py')
|
||||
|
||||
tool_dirs = [config.llvm_tools_dir,
|
||||
config.test_source_root]
|
||||
|
||||
|
@ -77,7 +79,7 @@ tools = [
|
|||
ToolSubst('llvm-objcopy', unresolved='fatal'),
|
||||
ToolSubst('llvm-strip', unresolved='fatal'),
|
||||
ToolSubst('llvm-readelf', unresolved='fatal'),
|
||||
ToolSubst('link_fdata', command=FindTool('link_fdata.py'), unresolved='fatal'),
|
||||
ToolSubst('link_fdata', command=link_fdata_cmd, unresolved='fatal'),
|
||||
ToolSubst('merge-fdata', unresolved='fatal'),
|
||||
]
|
||||
llvm_config.add_tool_substitutions(tools, tool_dirs)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Verifies that BOLT emits DWARF line table with the same size if
|
||||
# no functions with debug info were modified.
|
||||
|
||||
REQUIRES: system-linux
|
||||
|
||||
RUN: %clang %S/Inputs/hello.c -g -o %t
|
||||
RUN: llvm-bolt %t -o %t1 -update-debug-sections -funcs=_start
|
||||
RUN: llvm-readobj -S %t > %t2
|
||||
|
|
|
@ -42,5 +42,7 @@ install(PROGRAMS
|
|||
COMPONENT bolt
|
||||
)
|
||||
add_llvm_install_targets(install-bolt DEPENDS bolt COMPONENT bolt)
|
||||
set_target_properties(bolt PROPERTIES FOLDER "BOLT")
|
||||
set_target_properties(install-bolt PROPERTIES FOLDER "BOLT")
|
||||
|
||||
include_directories( ${BOLT_SOURCE_DIR}/lib )
|
||||
|
|
|
@ -6,6 +6,7 @@ add_llvm_tool(merge-fdata
|
|||
DEPENDS
|
||||
intrinsics_gen
|
||||
)
|
||||
set_target_properties(merge-fdata PROPERTIES FOLDER "BOLT")
|
||||
|
||||
# Emit relocations for BOLT meta test (bolt/test/runtime/meta-merge-fdata.test)
|
||||
if (UNIX AND NOT APPLE)
|
||||
|
|
Loading…
Reference in New Issue