# Tests that the linker is able to read .gnu.linkonce sections and link them # appropriately. The testcase has been created by using the following source # code. This test checks that the linker produces an undefined error. # linkoncea.s # .section .gnu.linkonce.d.dummy,"aw" #bar: # .long 0 # linkonceb.s # .section .gnu.linkonce.d.dummy,"aw" # .global foo #foo: # .long 0 # .section .blah, "aw" # .long foo #RUN: yaml2obj -format=elf -docnum 1 %s -o %t.linkonce1a.o #RUN: yaml2obj -format=elf -docnum 2 %s -o %t.linkonce1b.o #RUN: not lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ #RUN: --output-filetype=yaml -o %t2.out.yaml 2>&1 | FileCheck \ #RUN: -check-prefix=UNDEFS %s #RUN: not lld -flavor old-gnu -target x86_64 %t.linkonce1a.o %t.linkonce1b.o \ #RUN: -o %t2.out 2>&1 | FileCheck -check-prefix=UNDEFS %s #UNDEFS: Undefined symbol: {{.*}} foo --- FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB Type: ET_REL Machine: EM_X86_64 Sections: - Name: .text Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] AddressAlign: 0x0000000000000004 Content: '' - Name: .data Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x0000000000000004 Content: '' - Name: .bss Type: SHT_NOBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x0000000000000004 - Name: .gnu.linkonce.d.dummy Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x0000000000000001 Content: '00000000' Symbols: Local: - Name: .text Type: STT_SECTION Section: .text - Name: .data Type: STT_SECTION Section: .data - Name: .bss Type: STT_SECTION Section: .bss - Name: .gnu.linkonce.d.dummy Type: STT_SECTION Section: .gnu.linkonce.d.dummy - Name: bar Section: .gnu.linkonce.d.dummy ... --- FileHeader: Class: ELFCLASS64 Data: ELFDATA2LSB OSABI: ELFOSABI_GNU Type: ET_REL Machine: EM_X86_64 Sections: - Name: .text Type: SHT_PROGBITS Flags: [ SHF_ALLOC, SHF_EXECINSTR ] AddressAlign: 0x0000000000000004 Content: '' - Name: .data Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x0000000000000004 Content: '' - Name: .bss Type: SHT_NOBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x0000000000000004 - Name: .gnu.linkonce.d.dummy Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x0000000000000001 Content: '00000000' - Name: .blah Type: SHT_PROGBITS Flags: [ SHF_WRITE, SHF_ALLOC ] AddressAlign: 0x0000000000000001 Content: '00000000' - Name: .rela.blah Type: SHT_RELA Link: .symtab AddressAlign: 0x0000000000000008 Info: .blah Relocations: - Offset: 0x0000000000000000 Symbol: foo Type: R_X86_64_32 Symbols: Local: - Name: .text Type: STT_SECTION Section: .text - Name: .data Type: STT_SECTION Section: .data - Name: .bss Type: STT_SECTION Section: .bss - Name: .gnu.linkonce.d.dummy Type: STT_SECTION Section: .gnu.linkonce.d.dummy - Name: .blah Type: STT_SECTION Section: .blah Global: - Name: foo Section: .gnu.linkonce.d.dummy ...