42 lines · plain
1# REQUIRES: x862## The ELF spec says all symbols with STB_LOCAL binding precede the weak and3## global symbols. If a local symbol is found in the non-local part of the4## symbol table, make sure we have filled in all entries of InputFile::symbols.5## Otherwise a null entry can lead to a null pointer dereference when iterating6## over InputFile::symbols.7 8# RUN: yaml2obj %s -o %t.o9# RUN: not ld.lld %t.o %t.o -o /dev/null 2>&1 | FileCheck %s10 11# CHECK: error: {{.*}}.o: symbol (2) has invalid binding: 012# CHECK-NEXT: error: {{.*}}.o: symbol (2) has invalid binding: 013# CHECK-NEXT: error: duplicate symbol: _start14# CHECK-NEXT: >>> defined at {{.*}}.o:(.text+0x0)15# CHECK-NEXT: >>> defined at {{.*}}.o:(.text+0x0)16# CHECK-EMPTY:17# CHECK-NEXT: error: duplicate symbol: local18# CHECK-NEXT: >>> defined at {{.*}}.o:(.text+0x0)19# CHECK-NEXT: >>> defined at {{.*}}.o:(.text+0x0)20# CHECK-EMPTY:21 22# RUN: ld.lld --noinhibit-exec %t.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=WARN23# WARN: warning: {{.*}}.o: symbol (2) has invalid binding: 024 25!ELF26FileHeader:27 Class: ELFCLASS6428 Data: ELFDATA2LSB29 Type: ET_REL30 Machine: EM_X86_6431Sections:32 - Type: SHT_PROGBITS33 Name: .text34 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]35Symbols:36 - Name: _start37 Section: .text38 Binding: STB_GLOBAL39 - Name: local40 Section: .text41 Binding: STB_LOCAL42