1 # REQUIRES: x86-registered-target
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t
5 ## A non-existent symbol does not error.
6 # RUN: llvm-objcopy --redefine-sym _func=_cnuf1234 --redefine-sym _foo=_ba --redefine-sym=_notexist= %t %t2 2>&1 | count 0
7 # RUN: llvm-readobj --symbols %t2 | FileCheck %s
9 # RUN: echo '_func _cnuf1234 #rename func' > %t.rename.txt
10 # RUN: echo ' _foo _ba ' >> %t.rename.txt
11 # RUN: echo '_notexist _notexist' >> %t.rename.txt
12 # RUN: llvm-objcopy --redefine-syms %t.rename.txt %t %t3 2>&1 | count 0
16 # CHECK-NEXT: Name: _ba (1)
18 # CHECK-NEXT: Type: Section (0xE)
19 # CHECK-NEXT: Section: __const (0x2)
20 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
21 # CHECK-NEXT: Flags [ (0x0)
23 # CHECK-NEXT: Value: 0x0
25 # CHECK-NEXT: Symbol {
26 # CHECK-NEXT: Name: _cnuf1234 (5)
28 # CHECK-NEXT: Type: Section (0xE)
29 # CHECK-NEXT: Section: __text (0x1)
30 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
31 # CHECK-NEXT: Flags [ (0x0)
33 # CHECK-NEXT: Value: 0x0
36 ## Check that --redefine-sym executes before --strip-symbol.
37 # RUN: llvm-objcopy --strip-symbol _foo --redefine-sym _foo=_ba %t %t.notstripped
38 # RUN: llvm-readobj --symbols %t.notstripped | FileCheck %s --check-prefix=NOTSTRIPPED
39 # NOTSTRIPPED: Name: _ba
40 # NOTSTRIPPED: Name: _func
42 ## FIXME: _ba should be stripped after --strip-symbol is implemented.
43 # RUN: llvm-objcopy --strip-symbol _ba --redefine-sym _foo=_ba %t %t.noba
44 # RUN: llvm-readobj --symbols %t.noba | FileCheck %s --check-prefix=NOTSTRIPPED
49 .section __TEXT,__const