If foo is referenced in any object file, bitcode file or shared object, `__wrap_foo` should be retained as the redirection target of sym (f96ff3c0f8ebd941b3f6b345164c3d858b781484). If the object file defining foo has foo references, we cannot easily distinguish the case from cases where foo is not referenced (we haven't scanned relocations). Retain `__wrap_foo` because we choose to wrap sym references regardless of whether sym is defined to keep non-LTO/LTO/relocatable links' behaviors similar https://sourceware.org/bugzilla/show_bug.cgi?id=26358 . If foo is defined in a shared object, `__wrap_foo` can still be omitted (`wrap-dynamic-undef.s`). Reviewed By: andrewng Differential Revision: https://reviews.llvm.org/D95152
22 lines
476 B
LLVM
22 lines
476 B
LLVM
; REQUIRES: x86
|
|
;; Similar to ../wrap-defined.s but for LTO.
|
|
|
|
; RUN: llvm-as %s -o %t.o
|
|
; RUN: ld.lld -shared %t.o -wrap=bar -o %t.so
|
|
; RUN: llvm-objdump -d %t.so | FileCheck %s
|
|
|
|
; CHECK: <_start>:
|
|
; CHECK-NEXT: jmp {{.*}} <__wrap_bar@plt>
|
|
|
|
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
define void @bar() {
|
|
ret void
|
|
}
|
|
|
|
define void @_start() {
|
|
call void @bar()
|
|
ret void
|
|
}
|