1# REQUIRES: x86 2# RUN: rm -rf %t && split-file %s %t 3# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/g.s -o %t/g.o 4# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/w.s -o %t/w.o 5# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/u.s -o %t/u.o 6# RUN: ld.lld -e 0 %t/w.o %t/u.o -o %t/w 7# RUN: llvm-readelf -s %t/w | FileCheck %s --check-prefix=WEAK 8# RUN: ld.lld -e 0 %t/u.o %t/w.o -o %t/u 9# RUN: llvm-readelf -s %t/u | FileCheck %s --check-prefix=UNIQUE 10 11## We prefer STB_GLOBAL definition, then changing it to undefined since it is in 12## in a non-prevailing COMDAT. Ideally this should be defined, but our behavior 13## is fine because valid input cannot form this case. 14# RUN: ld.lld -e 0 %t/w.o %t/g.o -o %t/und --noinhibit-exec 2>&1 | FileCheck %s --check-prefix=WARN 15# RUN: llvm-readelf -s %t/und | FileCheck %s --check-prefix=UND 16 17# WEAK: NOTYPE WEAK DEFAULT [[#]] _ZZ1fvE1x 18# UNIQUE: OBJECT UNIQUE DEFAULT [[#]] _ZZ1fvE1x 19# UND: NOTYPE GLOBAL DEFAULT UND _ZZ1fvE1x 20 21# WARN: warning: relocation refers to a symbol in a discarded section: f()::x 22# WARN-NEXT: >>> defined in {{.*}}g.o 23# WARN-NEXT: >>> section group signature: _ZZ1fvE1x 24# WARN-NEXT: >>> prevailing definition is in {{.*}}w.o 25# WARN-NEXT: >>> or the symbol in the prevailing group had STB_WEAK binding and the symbol in a non-prevailing group had STB_GLOBAL binding. Mixing groups with STB_WEAK and STB_GLOBAL binding signature is not supported 26# WARN-NEXT: >>> referenced by {{.*}}g.o:(.text+0x3) 27 28#--- g.s 29movq _ZZ1fvE1x@gotpcrel(%rip), %rax 30 31.section .bss._ZZ1fvE1x,"awG",@nobits,_ZZ1fvE1x,comdat 32.globl _ZZ1fvE1x 33_ZZ1fvE1x: 34 35#--- w.s 36.section .bss._ZZ1fvE1x,"awG",@nobits,_ZZ1fvE1x,comdat 37.weak _ZZ1fvE1x 38_ZZ1fvE1x: 39 40#--- u.s 41.section .bss._ZZ1fvE1x,"awG",@nobits,_ZZ1fvE1x,comdat 42.type _ZZ1fvE1x, @gnu_unique_object 43_ZZ1fvE1x: 44