<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/102777>102777</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Behavior of -rpath under llvm-mingw does not match gcc-mingw
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          tomager
      </td>
    </tr>
</table>

<pre>
    The behavior of -rpath under llvm-mingw is different than in gcc-mingw. Please see mstorsjo/llvm-mingw#300 for more information. Briefly summarized here:

Here is the output of gcc-mingw (toolchain generated from crosstool-ng) compiling the simple program [1] with -rpath option:

```
# /xgcc-x86_64-w64-mingw32/bin/x86_64-w64-mingw32-g++ test.cc -Wl,-rpath,anything
<no error>
```

And here is the llvm-mingw toolchain failing on the same inputs:

```
# /xllvm-x86_64-w64-mingw32/bin/x86_64-w64-mingw32-g++ test.cc -Wl,-rpath,anything
lld: error: unknown argument: -rpath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

It would be nice if lld behaved the same as gcc-mingw, to lower friction when porting mingw packages to clang/llvm.

Would there be objections to a patch that causes -rpath to be silently ignored?

[1]
```
#include <iostream>

int main(int argc, const char** argv) {
  std::cout<<"hello world!"<<std::endl;
  *(volatile int*)0 = 0;
  return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VEuP4zYM_jXKhUhgS3kefEgyDdpbDwX2WMgSbWtHFg2JTmb66wvZyWR2-8BeFgiEWHx95PdROiXXBsRKbE5i87LQI3cUK6ZetxgXNdn36o8OocZOXx1FoAaWcdDcwRgsRvD-2i97F9obuATWNQ1GDAzc6QAuQGvMbF7B7x51QkiI0CemmL6SkJdnAiGVKgpoKEJPEcGFhmKv2VFYwSk6bPw7pLHvdXR_oYUOIwp1FMWLKO7nr5jjEnCHQCMPI2fAHxhAyD0TedPpDA0DRs1ooY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