Skip to content

[LLD] Undefined symbol __gxx_personality_v0 when linking with lld #54701

Closed
@Kmeakin

Description

@Kmeakin

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

main.c:

int main() {}

foo.cpp:

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.

clang --version:

Ubuntu clang version 15.0.0-++20220321012320+9aa52ba574ad-1~exp1~20220321012418.363
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

ld.lld --version:

Ubuntu LLD 15.0.0 (compatible with GNU linkers)

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidResolved as invalid, i.e. not a buglld:ELF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions