brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 2ab6b31 Raw
67 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-as _start.ll -o _start.o6# RUN: llvm-as _start_ref__real_foo.ll -o _start_ref__real_foo.o7# RUN: llvm-as wrap.ll -o wrap.o8# RUN: llvm-as foo.ll -o foo.o9 10## Test when the reference to __real_foo is not in __wrap_foo.11# RUN: ld.lld _start_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 5 entries:15# REAL-NEXT:        Value              Size Type    Bind   Vis       Ndx Name16# REAL-NEXT:        {{.*}}           {{.*}} NOTYPE  LOCAL  DEFAULT   UND17# REAL-NEXT:        {{.*}}           {{.*}} FILE    LOCAL  DEFAULT   ABS ld-temp.o18# REAL-NEXT:        {{.*}}           {{.*}} FUNC    GLOBAL DEFAULT [[#]] _start19# REAL-NEXT:        {{.*}}           {{.*}} FUNC    WEAK   DEFAULT [[#]] foo20# REAL-NEXT:        {{.*}}           {{.*}} NOTYPE  GLOBAL DEFAULT   UND __wrap_foo21 22## Test when the reference to __real_foo is in __wrap_foo.23# RUN: ld.lld _start.o --start-lib wrap.o --end-lib --start-lib foo.o --end-lib --wrap foo -o %t_wrap_real.elf24# RUN: llvm-readelf --symbols %t_wrap_real.elf | FileCheck %s --check-prefix=WRAP_REAL25 26# WRAP_REAL:      Symbol table '.symtab' contains 5 entries:27# WRAP_REAL-NEXT:    Value              Size Type    Bind   Vis       Ndx Name28# WRAP_REAL-NEXT:    {{.*}}           {{.*}} NOTYPE  LOCAL  DEFAULT   UND29# WRAP_REAL-NEXT:    {{.*}}           {{.*}} FILE    LOCAL  DEFAULT   ABS ld-temp.o30# WRAP_REAL-NEXT:    {{.*}}           {{.*}} FUNC    GLOBAL DEFAULT [[#]] _start31# WRAP_REAL-NEXT:    {{.*}}           {{.*}} FUNC    GLOBAL DEFAULT [[#]] __wrap_foo32# WRAP_REAL-NEXT:    {{.*}}           {{.*}} FUNC    WEAK   DEFAULT [[#]] foo33 34#--- _start.ll35target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"36target triple = "x86_64-elf"37define void @_start() {38  ret void39}40 41#--- _start_ref__real_foo.ll42target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"43target triple = "x86_64-elf"44define void @_start() {45  call void @__real_foo()46  ret void47}48 49declare void @__real_foo()50 51#--- wrap.ll52target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"53target triple = "x86_64-elf"54define void @__wrap_foo() {55  call void @__real_foo()56  ret void57}58 59declare void @__real_foo()60 61#--- foo.ll62target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"63target triple = "x86_64-elf"64define void @foo() {65  ret void66}67