xref: /llvm-project/lld/test/ELF/invalid/undefined-local-symbol-in-dso.test (revision 3ac94280245415be66cb1b603367c5f4f6d498e7)
1# REQUIRES: x86
2
3# LLD used to crash when linking against a DSO with an undefined STB_LOCAL
4# symbol in the global part of the dynamic symbol table (i.e. an STB_LOCAL
5# symbol with an index >= the sh_info of the dynamic symbol table section). Such
6# a DSO is very broken, because local symbols should precede all global symbols
7# in the symbol table, and because having a symbol that's both undefined and
8# STB_LOCAL is a nonsensical combination. Nevertheless, we should error on such
9# input files instead of crashing.
10
11# RUN: yaml2obj %s -o %t.so
12# RUN: not ld.lld %t.so -o /dev/null 2>&1 | FileCheck %s
13# CHECK: error: {{.*}}.so: invalid local symbol 'foo' in global part of symbol table
14
15--- !ELF
16FileHeader:
17  Class:           ELFCLASS64
18  Data:            ELFDATA2LSB
19  Type:            ET_DYN
20  Machine:         EM_X86_64
21Sections:
22  - Name:          .dynsym
23    Info:          1
24    Type:          SHT_DYNSYM
25DynamicSymbols:
26  - Name: foo
27