feat: Select platform based on -flavor, arg0 then host#1873
Conversation
|
|
||
| fn from_flavor(flavor: &str) -> Result<Self> { | ||
| match flavor { | ||
| "gnu" => Ok(PlatformKind::Elf), |
There was a problem hiding this comment.
I didn't know/remember you can use gnu. I always used -flavor ld which is missing in this PR.
There was a problem hiding this comment.
Btw. is it somewhere documented (the -flavor option) on the lld side?
There was a problem hiding this comment.
This is what I found: https://releases.llvm.org/12.0.0/tools/lld/docs/Driver.html
There was a problem hiding this comment.
Pretty old version, but matches the source code:
https://github.com/llvm/llvm-project/blob/6ea383f58ee7ec8e64247ea5106c117ecf5c8527/lld/Common/DriverDispatcher.cpp#L31-L38
| } | ||
|
|
||
| fn from_executable_name(name: &str) -> Option<Self> { | ||
| let base_name = Path::new(name).file_name().and_then(|n| n.to_str())?; |
There was a problem hiding this comment.
Perhaps you want to use file_stem() here to futureproof.
There was a problem hiding this comment.
I assume you mean so we can call the symlink "ld.anything" rather than just "ld.wild". II can probably see cases where that might be useful, so I've done it.
There was a problem hiding this comment.
Oh sorry, I thought of Windows .exe extension for binaries. Now that you mention the symlinks, I'm less certain about the file_stem.
There was a problem hiding this comment.
It does mean that we can be invoked as "ld.lld" and work, which I did just yesterday since at the time I didn't know a better way to override the linker used by the chromium build process (I do now). The .exe extension is perhaps a good reason to accept it too
There was a problem hiding this comment.
Sure, glad that I could accidentally help.
af23005 to
cc442b1
Compare
No description provided.