Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions clang/lib/Interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/Cloning.h" // for CloneModule

#define DEBUG_TYPE "clang-repl"
Expand Down Expand Up @@ -228,8 +229,13 @@ IncrementalCompilerBuilder::create(std::string TT,
// host symbol may be out of range when the JIT memory is mapped more than
// 2GB away (as on FreeBSD), breaking tests such as
// Interpreter/simple-exception.cpp. Insert before user arguments so it can
// still be overridden.
ClangArgv.insert(ClangArgv.begin() + 1, "-fPIC");
// still be overridden. On Windows (excluding Cygwin/MinGW) an explicit
// -fPIC is an unsupported driver option that would drop non-x86_64 targets
// to PIC level 0; PIC is already the forced default there where relevant,
// so don't inject it.
llvm::Triple TargetTriple(TT);
if (!TargetTriple.isOSWindows() || TargetTriple.isOSCygMing())
ClangArgv.insert(ClangArgv.begin() + 1, "-fPIC");

// Prepending -c to force the driver to do something if no action was
// specified. By prepending we allow users to override the default
Expand Down
Loading