43 lines · plain
1# REQUIRES: x862## --wrap=xxx should trigger archive extraction for symbol xxx for references to __real_xxx.3 4# RUN: rm -rf %t && split-file %s %t && cd %t5# RUN: llvm-mc -filetype=obj -triple=x86_64 _start.s -o _start.o6# RUN: llvm-mc -filetype=obj -triple=x86_64 ref__real_foo.s -o ref__real_foo.o7# RUN: llvm-mc -filetype=obj -triple=x86_64 wrap.s -o wrap.o8# RUN: llvm-mc -filetype=obj -triple=x86_64 foo.s -o foo.o9 10## Test when the reference to __real_foo is not in __wrap_foo.11# RUN: ld.lld _start.o ref__real_foo.o --start-lib foo.o --end-lib --wrap foo -o %t_real.elf12# RUN: llvm-readelf --symbols %t_real.elf | FileCheck %s --check-prefix=REAL13 14# REAL: Symbol table '.symtab' contains 4 entries:15# REAL-NEXT: Value Size Type Bind Vis Ndx Name16# REAL-NEXT: {{.*}} 0 NOTYPE LOCAL DEFAULT UND17# REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] _start18# REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] foo19# REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT UND __wrap_foo20 21## Test when the reference to __real_foo is in __wrap_foo.22# RUN: ld.lld _start.o --start-lib wrap.o --end-lib --start-lib foo.o --end-lib --wrap foo -o %t_wrap_real.elf23# RUN: llvm-readelf --symbols %t_wrap_real.elf | FileCheck %s --check-prefix=WRAP_REAL24 25# WRAP_REAL: Symbol table '.symtab' contains 4 entries:26# WRAP_REAL-NEXT: Value Size Type Bind Vis Ndx Name27# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE LOCAL DEFAULT UND28# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] _start29# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] __wrap_foo30# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] foo31 32#--- _start.s33.global _start; _start:; ret34 35#--- ref__real_foo.s36call __real_foo37 38#--- wrap.s39.global __wrap_foo; __wrap_foo:; call __real_foo40 41#--- foo.s42.global foo; foo:; ret43