1 # REQUIRES: x86-registered-target
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t
5 # RUN: llvm-objcopy -W _func %t %t2
6 # RUN: llvm-readobj --symbols %t2 | FileCheck %s -check-prefix=CHECK-1
9 # CHECK-1-NEXT: Name: _foo (1)
10 # CHECK-1-NEXT: Extern
11 # CHECK-1-NEXT: Type: Section (0xE)
12 # CHECK-1-NEXT: Section: __const (0x2)
13 # CHECK-1-NEXT: RefType: UndefinedNonLazy (0x0)
14 # CHECK-1-NEXT: Flags [ (0x0)
16 # CHECK-1-NEXT: Value: 0x0
18 # CHECK-1-NEXT: Symbol {
19 # CHECK-1-NEXT: Name: _func (6)
20 # CHECK-1-NEXT: Extern
21 # CHECK-1-NEXT: Type: Section (0xE)
22 # CHECK-1-NEXT: Section: __text (0x1)
23 # CHECK-1-NEXT: RefType: UndefinedNonLazy (0x0)
24 # CHECK-1-NEXT: Flags [ (0x80)
25 # CHECK-1-NEXT: WeakDef (0x80)
27 # CHECK-1-NEXT: Value: 0x0
30 # RUN: echo _foo > %t.weaken.txt
31 # RUN: echo _func >> %t.weaken.txt
32 # RUN: llvm-objcopy --weaken-symbols %t.weaken.txt %t %t3
33 # RUN: llvm-readobj --symbols %t3 | FileCheck %s -check-prefix=CHECK-2
36 # CHECK-2-NEXT: Name: _foo (1)
37 # CHECK-2-NEXT: Extern
38 # CHECK-2-NEXT: Type: Section (0xE)
39 # CHECK-2-NEXT: Section: __const (0x2)
40 # CHECK-2-NEXT: RefType: UndefinedNonLazy (0x0)
41 # CHECK-2-NEXT: Flags [ (0x80)
42 # CHECK-2-NEXT: WeakDef (0x80)
44 # CHECK-2-NEXT: Value: 0x0
46 # CHECK-2-NEXT: Symbol {
47 # CHECK-2-NEXT: Name: _func (6)
48 # CHECK-2-NEXT: Extern
49 # CHECK-2-NEXT: Type: Section (0xE)
50 # CHECK-2-NEXT: Section: __text (0x1)
51 # CHECK-2-NEXT: RefType: UndefinedNonLazy (0x0)
52 # CHECK-2-NEXT: Flags [ (0x80)
53 # CHECK-2-NEXT: WeakDef (0x80)
55 # CHECK-2-NEXT: Value: 0x0
58 ## Verify --weaken-symbol plays nice with --redefine-sym.
59 # RUN: llvm-objcopy -W _foo --redefine-sym _foo=_bar %t %t4
60 # RUN: llvm-readobj --symbols %t4 | FileCheck %s -check-prefix=CHECK-3
63 # CHECK-3-NEXT: Name: _bar (1)
64 # CHECK-3-NEXT: Extern
65 # CHECK-3-NEXT: Type: Section (0xE)
66 # CHECK-3-NEXT: Section: __const (0x2)
67 # CHECK-3-NEXT: RefType: UndefinedNonLazy (0x0)
68 # CHECK-3-NEXT: Flags [ (0x80)
69 # CHECK-3-NEXT: WeakDef (0x80)
71 # CHECK-3-NEXT: Value: 0x0
73 # CHECK-3-NEXT: Symbol {
74 # CHECK-3-NEXT: Name: _func (6)
75 # CHECK-3-NEXT: Extern
76 # CHECK-3-NEXT: Type: Section (0xE)
77 # CHECK-3-NEXT: Section: __text (0x1)
78 # CHECK-3-NEXT: RefType: UndefinedNonLazy (0x0)
79 # CHECK-3-NEXT: Flags [ (0x0)
81 # CHECK-3-NEXT: Value: 0x0
87 .section __TEXT,__const