Skip to content

lld error "undefined symbol: _GLOBAL_OFFSET_TABLE_ " with LTO #61101

@medhefgo

Description

@medhefgo

The following test file fails with LTO when compiled for x86. Other arches or bfd don't seem to exhibit this.

$ cat clang-bug.c 
void a(void) {}
void _start(void) { a(); }

$ clang -target i386-pc-linux-gnu -fuse-ld=lld -nostdlib -o /dev/null clang-bug.c

$ clang -target i386-pc-linux-gnu -fuse-ld=lld -nostdlib -o /dev/null clang-bug.c -flto
ld.lld: error: undefined symbol: _GLOBAL_OFFSET_TABLE_
>>> referenced by ld-temp.o
>>>               lto.tmp:(_start)
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)

Metadata

Metadata

Assignees

Labels

LTOLink time optimization (regular/full LTO or ThinLTO)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions