1// REQUIRES: x86 2// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 3// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/comdat.s -o %t2.o 4// RUN: ld.lld -shared %t.o %t2.o -o %t 5// RUN: llvm-objdump -d %t | FileCheck %s 6// RUN: llvm-readelf -S -s %t | FileCheck --check-prefix=READ %s 7 8// Check that we don't crash with --gc-section and that we print a list of 9// reclaimed sections on stderr. 10// RUN: ld.lld --gc-sections --print-gc-sections -shared %t.o %t.o %t2.o -o %t \ 11// RUN: 2>&1 | FileCheck --check-prefix=GC %s 12// GC: removing unused section {{.*}}.o:(.text) 13// GC: removing unused section {{.*}}.o:(.text3) 14// GC: removing unused section {{.*}}.o:(.text) 15// GC: removing unused section {{.*}}.o:(.text) 16 17.globl foo 18 .section .text2,"axG",@progbits,foo,comdat,unique,0 19foo: 20 nop 21 22// CHECK: Disassembly of section .text2: 23// CHECK-EMPTY: 24// CHECK-NEXT: <foo>: 25// CHECK-NEXT: nop 26// CHECK-NOT: nop 27 28 .section bar, "ax" 29 call foo 30 31// CHECK: Disassembly of section bar: 32// CHECK-EMPTY: 33// CHECK-NEXT: <bar>: 34// CHECK-NEXT: callq {{.*}} <foo@plt> 35 36.weak zed 37zed: 38 .section .text3,"axG",@progbits,zed,comdat,unique,0 39 40# READ: .text2 PROGBITS {{.*}} AX 41# READ: .text3 PROGBITS {{.*}} AX 42 43# SYM: NOTYPE LOCAL DEFAULT UND 44# SYM: NOTYPE LOCAL HIDDEN [[#]] _DYNAMIC 45# SYM: NOTYPE GLOBAL DEFAULT [[#]] foo 46# SYM: NOTYPE GLOBAL DEFAULT [[#]] zed 47# SYM: NOTYPE GLOBAL DEFAULT UND abc 48