Skip to content

Commit 842fb02

Browse files
committed
Get rid of our profile-rt libs
Enabled by switching to the official compiler-rt lib on Windows too. Move the profile.di module to druntime.
1 parent b7d12fe commit 842fb02

File tree

138 files changed

+10
-24403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+10
-24403
lines changed

driver/linker-msvc.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath, bool useInternalLinker,
127127
if (global.params.deffile)
128128
args.push_back(std::string("/DEF:") + global.params.deffile);
129129

130-
// Link with profile-rt library when generating an instrumented binary
131-
if (opts::isInstrumentingForPGO()) {
132-
args.push_back("ldc-profile-rt.lib");
133-
// profile-rt depends on ws2_32 for symbol `gethostname`
134-
args.push_back("ws2_32.lib");
135-
}
136-
137130
if (opts::enableDynamicCompile) {
138131
args.push_back("ldc-jit-rt.lib");
139132
args.push_back("ldc-jit.lib");
@@ -147,6 +140,11 @@ int linkObjToBinaryMSVC(llvm::StringRef outputPath, bool useInternalLinker,
147140
// LLVM compiler-rt libs
148141
addLibIfFound(args, "ldc_rt.builtins.lib");
149142
addSanitizerLibs(args);
143+
if (opts::isInstrumentingForPGO()) {
144+
args.push_back("ldc_rt.profile.lib");
145+
// it depends on ws2_32 for symbol `gethostname`
146+
args.push_back("ws2_32.lib");
147+
}
150148

151149
// additional linker switches
152150
auto addSwitch = [&](std::string str) {

ldc2_phobos.conf.in

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ default:
77
// default switches injected before all explicit command-line switches
88
switches = [
99
"-I@RUNTIME_DIR@/src",
10-
"-I@PROFILERT_DIR@/d",
1110
"-I@JITRT_DIR@/d",
1211
"-I@PHOBOS2_DIR@",@SHARED_LIBS_RPATH@
1312
"-defaultlib=phobos2-ldc,druntime-ldc"@ADDITIONAL_DEFAULT_LDC_SWITCHES@

runtime/CMakeLists.txt

+4-19
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ endif()
130130
get_directory_property(PROJECT_PARENT_DIR DIRECTORY ${PROJECT_SOURCE_DIR} PARENT_DIRECTORY)
131131
set(RUNTIME_DIR ${PROJECT_SOURCE_DIR}/druntime CACHE PATH "druntime root directory")
132132
set(PHOBOS2_DIR ${PROJECT_SOURCE_DIR}/phobos CACHE PATH "Phobos root directory")
133-
set(PROFILERT_DIR ${PROJECT_SOURCE_DIR}/profile-rt CACHE PATH "profile-rt root directory")
134133
set(JITRT_DIR ${PROJECT_SOURCE_DIR}/jit-rt CACHE PATH "jit runtime root directory")
135134

136135
#
@@ -625,20 +624,6 @@ macro(build_runtime_variants d_flags c_flags ld_flags path_suffix outlist_target
625624
)
626625
endmacro()
627626

628-
# Builds static and/or shared debug+release druntime/Phobos + static profile-rt.
629-
macro(build_all_runtime_variants d_flags c_flags ld_flags path_suffix outlist_targets)
630-
build_runtime_variants("${d_flags}" "${c_flags}" "${ld_flags}" "${path_suffix}" ${outlist_targets})
631-
632-
# static profile-rt (currently only needed on Windows)
633-
if("${TARGET_SYSTEM}" MATCHES "Windows")
634-
build_profile_runtime("${c_flags}" "${ld_flags}" "" "${path_suffix}" ${outlist_targets})
635-
endif()
636-
endmacro()
637-
638-
639-
# Setup the build of profile-rt
640-
include(profile-rt/DefineBuildProfileRT.cmake)
641-
642627
# Setup the build of jit runtime
643628
include(jit-rt/DefineBuildJitRT.cmake)
644629

@@ -654,8 +639,8 @@ if(MULTILIB AND "${TARGET_SYSTEM}" MATCHES "APPLE")
654639
set(hostsuffix "${LIB_SUFFIX}${HOST_BITNESS}")
655640

656641
set(libtargets)
657-
build_all_runtime_variants("" "${RT_CFLAGS}" "${LD_FLAGS}" "${hostsuffix}" libtargets)
658-
build_all_runtime_variants("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${RT_CFLAGS}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "${MULTILIB_SUFFIX}" libtargets)
642+
build_runtime_variants("" "${RT_CFLAGS}" "${LD_FLAGS}" "${hostsuffix}" libtargets)
643+
build_runtime_variants("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${RT_CFLAGS}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "${MULTILIB_SUFFIX}" libtargets)
659644

660645
# Only build the host version of the jit runtime due to LLVM dependency.
661646
set(libtargets_jit)
@@ -702,7 +687,7 @@ if(MULTILIB AND "${TARGET_SYSTEM}" MATCHES "APPLE")
702687
endforeach()
703688
else()
704689
set(libs_to_install)
705-
build_all_runtime_variants("" "${RT_CFLAGS}" "${LD_FLAGS}" "${LIB_SUFFIX}" libs_to_install)
690+
build_runtime_variants("" "${RT_CFLAGS}" "${LD_FLAGS}" "${LIB_SUFFIX}" libs_to_install)
706691

707692
# Only build the host version of the jit runtime due to LLVM dependency.
708693
set(libtargets_jit)
@@ -712,7 +697,7 @@ else()
712697

713698
# don't add multilib targets to libs_to_install
714699
if(MULTILIB)
715-
build_all_runtime_variants("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${RT_CFLAGS}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "${MULTILIB_SUFFIX}" dummy)
700+
build_runtime_variants("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${RT_CFLAGS}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "${MULTILIB_SUFFIX}" dummy)
716701
endif()
717702

718703
foreach(libname ${libs_to_install})

runtime/druntime

runtime/profile-rt/DefineBuildProfileRT.cmake

-95
This file was deleted.

runtime/profile-rt/README.md

-25
This file was deleted.

0 commit comments

Comments
 (0)