Files
clang-p2996/lld/test/ELF/wrap.s
Rui Ueyama 54d2896852 [ELF] --wrap: Drop __real_ symbol from the symbol table
In D34993, we discussed and concluded that we should drop `__real_
symbol from the symbol table, but I did the opposite in D50569.
This patch is to drop `__real_` symbol.

MaskRay's note: omitting `__real_` is important if it is undefined:
otherwise a subsequent link may error due to the undefined `__real_` in .dynsym

Differential Revision: https://reviews.llvm.org/D51283
2020-05-27 16:58:00 -07:00

43 lines
1.3 KiB
ArmAsm

// REQUIRES: x86
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/wrap.s -o %t2
// RUN: ld.lld -o %t3 %t %t2 -wrap foo -wrap nosuchsym
// RUN: llvm-objdump -d --print-imm-hex %t3 | FileCheck %s
// RUN: ld.lld -o %t3 %t %t2 --wrap foo -wrap=nosuchsym
// RUN: llvm-objdump -d --print-imm-hex %t3 | FileCheck %s
// RUN: ld.lld -o %t3 %t %t2 --wrap foo --wrap foo -wrap=nosuchsym
// RUN: llvm-objdump -d --print-imm-hex %t3 | FileCheck %s
// CHECK: <_start>:
// CHECK-NEXT: movl $0x11010, %edx
// CHECK-NEXT: movl $0x11010, %edx
// CHECK-NEXT: movl $0x11000, %edx
// RUN: llvm-readobj --symbols %t3 > %t4.dump
// RUN: FileCheck --check-prefix=SYM1 %s < %t4.dump
// RUN: FileCheck --check-prefix=SYM2 %s < %t4.dump
// RUN: FileCheck --check-prefix=SYM3 %s < %t4.dump
// SYM1: Name: foo
// SYM1-NEXT: Value: 0x11000
// SYM1-NEXT: Size:
// SYM1-NEXT: Binding: Global
// SYM1-NEXT: Type: None
// SYM1-NEXT: Other: 0
// SYM2: Name: __wrap_foo
// SYM2-NEXT: Value: 0x11010
// SYM2-NEXT: Size:
// SYM2-NEXT: Binding: Weak
// SYM2-NEXT: Type: None
// SYM2-NEXT: Other [
// SYM2-NEXT: STV_PROTECTED
// SYM2-NEXT: ]
// SYM3-NOT: Name: __real_foo
.global _start
_start:
movl $foo, %edx
movl $__wrap_foo, %edx
movl $__real_foo, %edx