mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 01:20:51 +03:00
Only set rpath when linking against shared default libs
This commit is contained in:
parent
611d32458d
commit
891234bbe4
13 changed files with 93 additions and 39 deletions
|
@ -11,8 +11,10 @@
|
|||
#include "driver/cl_options.h"
|
||||
#include "driver/cl_options_instrumentation.h"
|
||||
#include "driver/cl_options_sanitizers.h"
|
||||
#include "driver/configfile.h"
|
||||
#include "driver/exe_path.h"
|
||||
#include "driver/ldc-version.h"
|
||||
#include "driver/linker.h"
|
||||
#include "driver/tool.h"
|
||||
#include "gen/irstate.h"
|
||||
#include "gen/logger.h"
|
||||
|
@ -476,11 +478,18 @@ void ArgsBuilder::build(llvm::StringRef outputPath,
|
|||
addLinker();
|
||||
addUserSwitches();
|
||||
|
||||
// libs added via pragma(lib, libname)
|
||||
// default libs and libs added via pragma(lib, libname)
|
||||
for (auto ls : global.params.linkswitches) {
|
||||
args.push_back(ls);
|
||||
}
|
||||
|
||||
// -rpath if linking against shared default libs
|
||||
if (willLinkAgainstSharedDefaultLibs()) {
|
||||
const std::string rpath = ConfigFile::instance.rpath();
|
||||
if (!rpath.empty())
|
||||
addLdFlag("-rpath", rpath);
|
||||
}
|
||||
|
||||
if (global.params.targetTriple->getOS() == llvm::Triple::Linux) {
|
||||
// Make sure we don't do --gc-sections when generating a profile-
|
||||
// instrumented binary. The runtime relies on magic sections, which
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue