[PATCH] D16599: ELF: Define another entry point.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 26 16:12:53 PST 2016
ruiu added a comment.
It is better to keep Unix version being separated from Windows, because on Unix, there is no reliable way to find the executable on the filesystem. On Linux, you can always use /proc/self/exe, but that's highly platform-dependent. So the most reliable way is to not exec anything.
================
Comment at: ELF/Driver.h:28
@@ +27,3 @@
+// The other entry point of the ELF linker which is guaranteed to return.
+bool main(llvm::ArrayRef<const char *> Args, raw_ostream &Diag);
+
----------------
rafael wrote:
> Maybe call this one link and the old link becomes linkOrFali?
Done.
================
Comment at: ELF/DriverUtils.cpp:146
@@ +145,3 @@
+ // We are in the child. Plumb stdout and stderr to the pipe.
+ close(Fd[0]);
+ close(0);
----------------
rafael wrote:
> both close and dup can fail, not sure if you care in here.
We should be able to ignore errors safely here. I close stdin here just to make the child process behave nicely if it ever tries to read input from stdin (that should never succeed). This is just a safety measure.
http://reviews.llvm.org/D16599
More information about the llvm-commits
mailing list