brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 8c2f5e2 Raw
47 lines · plain
1;; Verify that the target of a wrap is kept by LTO's summary-based global dead2;; stripping if the original symbol is referenced by a linker script or --defsym3 4; REQUIRES: x865; RUN: rm -rf %t && split-file %s %t6 7;; We need a module summary to trigger summary-based global stripping8; RUN: opt -module-summary -o %t/foo.bc %t/foo.ll9; RUN: echo 'alias = __real_foo;' > %t/alias.script10; RUN: ld.lld -shared -o %t/libalias_foo.so %t/foo.bc %t/alias.script --wrap foo11; RUN: llvm-readelf --syms %t/libalias_foo.so | FileCheck --check-prefix=FOO %s12 13; FOO:     Symbol table '.symtab' contains14; FOO-DAG: [[#]]: [[#%.16x,FOO_VAL:]] 1 FUNC    LOCAL  HIDDEN      [[#]] foo15; FOO-DAG: [[#]]: [[#FOO_VAL]]        0 FUNC    GLOBAL DEFAULT     [[#]] alias16 17; RUN: opt -module-summary -o %t/wrap_foo.bc %t/wrap_foo.ll18; RUN: ld.lld -shared -o %t/libalias_wrap_foo.so %t/wrap_foo.bc --wrap foo --defsym=alias=foo19; RUN: llvm-readelf --syms %t/libalias_wrap_foo.so | FileCheck --check-prefix=WRAP-FOO %s20 21; WRAP-FOO:     Symbol table '.symtab' contains22; WRAP-FOO-DAG: [[#]]: [[#%.16x,WRAP_FOO_VAL:]] 1 FUNC    LOCAL  HIDDEN      [[#]] __wrap_foo23; WRAP-FOO-DAG: [[#]]: [[#WRAP_FOO_VAL]]        0 FUNC    GLOBAL DEFAULT     [[#]] alias24 25;--- foo.ll26target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"27target triple = "x86_64-unknown-linux-gnu"28define hidden void @foo() {29  ret void30}31 32;; We need a live root to trigger summary-based global stripping33define dso_local void @bar() {34  ret void35}36 37;--- wrap_foo.ll38target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"39target triple = "x86_64-unknown-linux-gnu"40define hidden void @__wrap_foo() {41  ret void42}43 44define dso_local void @bar() {45  ret void46}47