1# REQUIRES: x86 2## Show how symbols in GCed mergeable pieces behave. 3 4# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 5# RUN: ld.lld --gc-sections %t.o -o %t.elf 6# RUN: llvm-readelf %t.elf --sections --syms | FileCheck %s 7 8.section .rodata.merge,"aM",@progbits,4 9a1: ## Unreferenced. In first fragment, kept by a2 reference. 10 .short 1 11a2: ## Referenced. 12 .short 1 13b1: ## Unreferenced. Discarded as second fragment is unreferenced. 14 .short 1 15b2: ## Unreferenced. Discarded as second fragment is unreferenced. 16 .short 1 17c1: ## Referenced. 18 .short 1 19c2: ## Unreferenced. In third fragment, kept by c1 reference. 20 .short 1 21 22.data 23.global _start 24_start: 25 .quad a2 26 .quad c1 27 28# CHECK: .rodata PROGBITS [[#%x, ADDR:]] 29 30# CHECK: Symbol table '.symtab' contains 6 entries: 31# CHECK-NEXT: Num: Value {{.*}} Ndx Name 32# CHECK-NEXT: 0: {{.*}} UND{{ *$}} 33# CHECK-NEXT: 1: {{0*}}[[#ADDR]] {{.*}} a1 34# CHECK-NEXT: 2: {{0*}}[[#ADDR+2]] {{.*}} a2 35# CHECK-NEXT: 3: {{0*}}[[#ADDR]] {{.*}} c1 36# CHECK-NEXT: 4: {{0*}}[[#ADDR+2]] {{.*}} c2 37# CHECK-NEXT: 5: {{.*}} _start 38