Skip to content

Commit 7453b4f

Browse files
jchauziRomaric JODIN
jchauzi
authored and
Romaric JODIN
committed
dpu: clang: changing rtlib paths & names wrt changed to the rtlib build system
1 parent e457270 commit 7453b4f

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

clang/lib/Driver/ToolChains/DPURTE.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ char *DPURTE::GetUpmemSdkPath(const char *Path) {
5252

5353
Tool *DPURTE::buildLinker() const {
5454
return new tools::dpu::Linker(*this, PathToLinkScript, PathToRtLibDirectory,
55-
PathToRtLibBc);
55+
RtLibName, PathToRtLibBc);
5656
}
5757

5858
void DPURTE::addClangTargetOptions(
@@ -104,15 +104,15 @@ void Linker::ConstructJob(Compilation &C, const JobAction &JA,
104104
// the very beginning of memory with no allocation.
105105
CmdArgs.push_back("--define-common");
106106
if (!TCArgs.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
107-
CmdArgs.push_back("-L");
108-
CmdArgs.push_back(RtLibraryPath);
109107
if (TCArgs.hasArg(options::OPT_flto) ||
110108
TCArgs.hasArg(options::OPT_flto_EQ)) {
111-
CmdArgs.push_back("-lrtmin");
112109
// Need to inject the RTE BC library into the whole chain.
113110
CmdArgs.push_back(RtBcLibrary);
114111
} else {
115-
CmdArgs.push_back("-lrt");
112+
CmdArgs.push_back("-L");
113+
CmdArgs.push_back(RtLibraryPath);
114+
CmdArgs.push_back("-l");
115+
CmdArgs.push_back(RtLibraryName);
116116
}
117117
}
118118

clang/lib/Driver/ToolChains/DPURTE.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@ class LLVM_LIBRARY_VISIBILITY DPURTE : public Generic_ELF {
2828
PathToStdlibIncludes = GetUpmemSdkPath("/usr/share/upmem/include/stdlib");
2929
PathToSyslibIncludes = GetUpmemSdkPath("/usr/share/upmem/include/syslib");
3030
PathToLinkScript = GetUpmemSdkPath("/usr/share/upmem/include/link/dpu.lds");
31-
PathToRtLibDirectory =
32-
Args.hasArg(options::OPT_pg)
33-
? GetUpmemSdkPath("/usr/share/upmem/include/built-in-profiling")
34-
: GetUpmemSdkPath("/usr/share/upmem/include/built-in");
31+
PathToRtLibDirectory = GetUpmemSdkPath("/usr/share/upmem/include/built-in");
32+
RtLibName = Args.hasArg(options::OPT_pg) ? "rt" : "rt_p";
3533
PathToRtLibBc =
3634
Args.hasArg(options::OPT_pg)
37-
? GetUpmemSdkPath(
38-
"/usr/share/upmem/include/built-in-profiling/rtlib.bc")
39-
: GetUpmemSdkPath("/usr/share/upmem/include/built-in/rtlib.bc");
35+
? GetUpmemSdkPath("/usr/share/upmem/include/built-in/librtlto_p.a")
36+
: GetUpmemSdkPath("/usr/share/upmem/include/built-in/librtlto.a");
4037
}
4138

4239
~DPURTE() override {
@@ -77,6 +74,7 @@ class LLVM_LIBRARY_VISIBILITY DPURTE : public Generic_ELF {
7774
char *PathToStdlibIncludes;
7875
char *PathToLinkScript;
7976
char *PathToRtLibDirectory;
77+
const char *RtLibName;
8078
char *PathToRtLibBc;
8179
};
8280
} // end namespace toolchains
@@ -85,10 +83,11 @@ namespace dpu {
8583
class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
8684
public:
8785
Linker(const ToolChain &TC, const char *Script, const char *RtLibDir,
88-
const char *PathToRtLibBc)
86+
const char *RtLibName, const char *PathToRtLibBc)
8987
: GnuTool("dpu::Linker", "ld.lld", TC) {
9088
LinkScript = Script;
9189
RtLibraryPath = RtLibDir;
90+
RtLibraryName = RtLibName;
9291
RtBcLibrary = PathToRtLibBc;
9392
}
9493

@@ -104,6 +103,7 @@ class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
104103
private:
105104
const char *LinkScript;
106105
const char *RtLibraryPath;
106+
const char *RtLibraryName;
107107
const char *RtBcLibrary;
108108
};
109109
} // end namespace dpu

0 commit comments

Comments
 (0)