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

    <tr>
        <th>Summary</th>
        <td>
            [lld] --dynamic-linker=VALUE is not ignored when creating a statically linked executable
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    step1. create a C source file `test.c`:
```C
#include <stdio.h>

int main() {
    printf("%s\n", "Hello World");
    return 0;
}
```
step2. build a statically linked executable:
```bash
clang -fuse-ld=lld -static -Wl,--dynamic-linker=/lib64/ld-linux-x86-64.so.2 test.c
```
step3. show the Program Headers:
![Screenshot from 2022-06-18 17-37-03](https://user-images.githubusercontent.com/3040852/174432065-ec6044d3-2c97-4eba-bb10-61f565ae8b5f.png)

step4. run the executable:
![Screenshot from 2022-06-18 17-42-27](https://user-images.githubusercontent.com/3040852/174432174-662b4e06-d25b-452d-848c-d7ea617baad5.png)
run the executable failed and report `segmentation fault (core dumped)`

**I think the `-Wl,--dynamic-linker=/system/bin/linker64` shall be ignored when `-static` is given**

**I tried the GNU LD(bfd and gold) works fine as my expected.**

**Clang version:**
![Screenshot from 2022-06-18 17-49-48](https://user-images.githubusercontent.com/3040852/174432463-e6e18305-0dee-4427-bdf2-d096a5bfab88.png)

**related issue:**
https://github.com/android/ndk/issues/1722
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVU1v2zgQ_TXyhaBAUaQ-Dj6kTr0tUBQLLLo9k-JI5oamDJJK4n-_Q9lpkzYNeqgtSDI5HL735nGsZ3PexgSnqiRDAJWAKLIjcV7CAGS0DkjRsAQxlQO-FPVNwW4LdpPf12t3_c1r6we3GIyvdzEZO5eHon5_nV3v1idyVNYXvCt4T4r23WWc4OcUcHZcZ3jBZSzkzq-vO4KPD-D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