1# REQUIRES: x86 2## --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 %t 5# RUN: llvm-mc -filetype=obj -triple=x86_64 _start.s -o _start.o 6# RUN: llvm-mc -filetype=obj -triple=x86_64 ref__real_foo.s -o ref__real_foo.o 7# RUN: llvm-mc -filetype=obj -triple=x86_64 wrap.s -o wrap.o 8# RUN: llvm-mc -filetype=obj -triple=x86_64 foo.s -o foo.o 9 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.elf 12# RUN: llvm-readelf --symbols %t_real.elf | FileCheck %s --check-prefix=REAL 13 14# REAL: Symbol table '.symtab' contains 4 entries: 15# REAL-NEXT: Value Size Type Bind Vis Ndx Name 16# REAL-NEXT: {{.*}} 0 NOTYPE LOCAL DEFAULT UND 17# REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] _start 18# REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] foo 19# REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT UND __wrap_foo 20 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.elf 23# RUN: llvm-readelf --symbols %t_wrap_real.elf | FileCheck %s --check-prefix=WRAP_REAL 24 25# WRAP_REAL: Symbol table '.symtab' contains 4 entries: 26# WRAP_REAL-NEXT: Value Size Type Bind Vis Ndx Name 27# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE LOCAL DEFAULT UND 28# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] _start 29# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] __wrap_foo 30# WRAP_REAL-NEXT: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] foo 31 32#--- _start.s 33.global _start; _start:; ret 34 35#--- ref__real_foo.s 36call __real_foo 37 38#--- wrap.s 39.global __wrap_foo; __wrap_foo:; call __real_foo 40 41#--- foo.s 42.global foo; foo:; ret 43