61 lines · plain
1# REQUIRES: x862## Test the GC behavior when the PROVIDE symbol is defined by a relocatable file.3 4# RUN: rm -rf %t && split-file %s %t && cd %t5# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o6# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o7# RUN: llvm-as c.ll -o c.bc8# RUN: ld.lld -T a.t --gc-sections a.o b.o -o a9# RUN: llvm-readelf -s a | FileCheck %s10 11# RUN: ld.lld -T a.t -shared a.o b.o c.bc -o a.so12# RUN: llvm-readelf -s -r a.so | FileCheck %s --check-prefix=DSO13 14# CHECK: 1: {{.*}} 0 NOTYPE GLOBAL DEFAULT 1 _start15# CHECK-NEXT:2: {{.*}} 0 NOTYPE WEAK DEFAULT 2 f316# CHECK-NOT: {{.}}17 18# DSO: .rela.plt19# DSO-NOT: f520# DSO: Symbol table '.dynsym'21# DSO-NOT: f522# DSO: Symbol table '.symtab'23# DSO: {{.*}} 0 NOTYPE LOCAL HIDDEN [[#]] f524 25#--- a.s26.global _start, f1, f2, bar27.weak f328_start:29 call f330 31.section .text.f1,"ax"; f1:32.section .text.f2,"ax"; f2: # referenced by another relocatable file33.section .text.f3,"ax"; f3: # live34.section .text.bar,"ax"; bar:35 36.comm comm,4,437 38#--- b.s39 call f240 41#--- c.ll42target triple = "x86_64-unknown-linux-gnu"43target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"44 45declare void @f5()46 47define void @f3() {48 call void @f5()49 ret void50}51 52#--- a.t53SECTIONS {54 . = . + SIZEOF_HEADERS;55 PROVIDE(f1 = bar+1);56 PROVIDE(f2 = bar+2);57 PROVIDE(f3 = bar+3);58 PROVIDE(f4 = comm+4);59 PROVIDE_HIDDEN(f5 = bar+5);60}61