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

    <tr>
        <th>Summary</th>
        <td>
            [LLD] Undefined symbol `__gxx_personality_v0` when linking with lld
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lld:ELF
      </td>
    </tr>

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

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

<pre>
    `lld` reports an undefined symbol, while `ld` is able to link this without issue:

main.c:
```c
int main() {}
```

foo.cpp:
```c
inline void f() {}

class Class1 {
public:
  virtual ~Class1() {}
};

class Class2 : Class1 {
public:
  Class2();
};

Class2::Class2() { f(); }
```

```
clang++ -O0 -c foo.cpp -o foo.o
clang -O0 -c main.c -o main.o
clang main.o foo.o -Wl,--gc-sections -fuse-ld=lld
```
produces
```
ld.lld: error: undefined symbol: __gxx_personality_v0
>>> referenced by foo.cpp
>>>               foo.o:(DW.ref.__gxx_personality_v0)
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

but removing `-fuse-ld=lld` produces no issues.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFVMFymzAQ_Rq47MDIwmA4cIjj9NLM9NTJ0YOQwGpliZEEif--K4hrx3FTj0aWdp-edp92YYaf6qggSnGcwYrBWO-g0TBqLjqpBQd3OjKjIvoIrwepBAT4jJYIZGjwBpTUv8Ef0PIq_cGMHp1uFFH2EJFdRN7nYyN12l6MBVlGu-yl9hAgES0jWkG02Uab3Q30mq4zJm2H4Qs-DEvAZCSH7h7pPLeqcQ4ew7ya3bN1GJmSl1ABJmn92ChEPC3Ye4S4yLb_IKeAbP-_Z8Eu5BeyT8TvMDyXPVwfCcznZPEIfK3gjRGj1X1Etzgg-UEgaeFdY0jMvDRXwDNkedWAmFcfIItlOQrJS6iiJOnbxInWS6MdJN3oRIL1lO1CDd6LarCGj61wd52Kp-EcKiusNTYsPlUu2vb7_u1tPwjrjG6U9Kf9dBYie1oGFn8nrNAtHmSnc-K3oI-_RRJ8BFruXlIkSO9ehE9xpe91rKFvhIXWHI-NxiptsMH43EMg3qRHBxeA5UJLlAmSKfSaEwKknkzbBAn_kn_xzAz70YqjmSQ-CfpuRMdWPmsM2iyd69KY1xmvsqqJvfRK1FG-fX7eRfkOft4IHCjv5o3Erweh5yzD1XNeeGM8WlUfvB_crN03HD26RpaiELhRajr_JRjZLywW3C5x4SJfb8gqPtQrkRcla1q-7oqCkK7K8806J4yxqtxUBYtVw4RyIfKI0qVMnp7xNopZxLKmhFKyJqtVnpVZmRKek2zNi5wJUlFOozURWL8qDXGkxvaxreeQ2Ng7dCrpvLs4sQdlr8UsVOBvRvwQ2vr7UTSYfDxHX8-h_wF8cZWs">