-
-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Attempt to fix #2497 #2503
base: master
Are you sure you want to change the base?
Conversation
driver/linker-gcc.cpp
Outdated
| @@ -343,6 +343,14 @@ void ArgsBuilder::build(llvm::StringRef outputPath, | |||
| if (opts::enableDynamicCompile) { | |||
| args.push_back("-lldc-jit-rt"); | |||
| args.push_back("-lldc-jit"); | |||
| if (global.params.targetTriple->isOSDarwin()) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this a little more descriptive, with a bool linkShared or something. Is Darwin the only place where shared JIT RT can be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(also it's nicer to put all linker flags related to enableDynamicCompile in a separate function, like addASanLinkFlags)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is Darwin the only place where shared JIT RT can be used?
rpath works differently on OSX and on linux and @executable_path is only supported on OSX.
driver/linker-gcc.cpp
Outdated
|
|
||
| std::string jitLib = exe_path::prependLibDir("libldc_jit.dylib"); | ||
| args.push_back("-rpath"); | ||
| args.push_back(llvm::sys::path::parent_path(jitLib)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use exe_path::getLibDir ?
For now, I think it's OK. I tested it and it doesn't give problems on my machine (OSX 10.13.2). |
|
Updated:
|
driver/linker-gcc.cpp
Outdated
| @@ -70,6 +74,10 @@ class ArgsBuilder { | |||
| virtual void addLdFlag(const llvm::Twine &flag1, const llvm::Twine &flag2) { | |||
| args.push_back(("-Wl," + flag1 + "," + flag2).str()); | |||
| } | |||
|
|
|||
| void addUniqueArgs(const std::vector<std::string>& arg); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: clang-format for the position of the &
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
driver/linker-gcc.cpp
Outdated
| @@ -495,6 +514,14 @@ void ArgsBuilder::addTargetFlags() { | |||
| appendTargetArgsForGcc(args); | |||
| } | |||
|
|
|||
| void ArgsBuilder::addUniqueArgs(const std::vector<std::string> &arg) { | |||
| assert(!arg.empty()); | |||
| if (uniqueArgs.end() == uniqueArgs.find(arg)) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: again the inverted comparison order ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
driver/linker-gcc.cpp
Outdated
|
|
||
| void addUniqueArgs(const std::vector<std::string>& arg); | ||
|
|
||
| std::set<std::vector<std::string>> uniqueArgs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uniqueArgs are not read anywhere yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used in addUniqueArgs. If arg isn't in uniqueArgs we add them to args and to uniqueArgs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, indeed. I missed that it adds the args to both args and uniqueArgs.
70af4fa
to
1f3d293
Compare
1f3d293
to
94d1264
Compare
|
Updated |
|
is this still work-in-progress? LGTM. |
|
Unfortunately it's not fixing it. "codegen/attr_assumeused.d" additionally fails now but that might be another problem with the base branch.
|
|
@ThomasMader can you, please, add instructions how to reproduce Nix setup and how to test specific branch. |
|
On a Mac you should be able to reproduce.
Hope this helps. The changes you made are mainly in linker-gcc.cpp as far as I remember. Because of the file name I guess it has something to do with gcc. Maybe that is the problem? In the package description for ldc in Nix there is no dependency to gcc at all. It's just clang with llvm. You can see all dependencies on top of the package description file which can be found in the repository at: pkgs/development/compilers/ldc/default.nix |
|
fyi, |
@Hardcode84 Just realized that I forgot to push the change to use your ldc branch in the package description. |
|
Update: current master already makes sure the install_name of shared lib ldc-jit contains |
I have no idea how OSX infrastructure works, just some copypaste and stackowerflow-driven development.
Also, if we have both dynamic compilation and asan enabled, duplicating entries will be added to -rpath, is this ok?