52 lines · plain
1# REQUIRES: x86-registered-target2 3# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t4 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 07# RUN: llvm-readobj --symbols %t2 | FileCheck %s8 9# RUN: echo '_func _cnuf1234 #rename func' > %t.rename.txt10# RUN: echo ' _foo _ba ' >> %t.rename.txt11# RUN: echo '_notexist _notexist' >> %t.rename.txt12# RUN: llvm-objcopy --redefine-syms %t.rename.txt %t %t3 2>&1 | count 013# RUN: cmp %t2 %t314 15# CHECK: Symbol {16# CHECK-NEXT: Name: _ba (1)17# CHECK-NEXT: Extern18# CHECK-NEXT: Type: Section (0xE)19# CHECK-NEXT: Section: __const (0x2)20# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)21# CHECK-NEXT: Flags [ (0x0)22# CHECK-NEXT: ]23# CHECK-NEXT: Value: 0x024# CHECK-NEXT: }25# CHECK-NEXT: Symbol {26# CHECK-NEXT: Name: _cnuf1234 (5)27# CHECK-NEXT: Extern28# CHECK-NEXT: Type: Section (0xE)29# CHECK-NEXT: Section: __text (0x1)30# CHECK-NEXT: RefType: UndefinedNonLazy (0x0)31# CHECK-NEXT: Flags [ (0x0)32# CHECK-NEXT: ]33# CHECK-NEXT: Value: 0x034# CHECK-NEXT: }35 36## Check that --redefine-sym executes before --strip-symbol.37# RUN: llvm-objcopy --strip-symbol _foo --redefine-sym _foo=_ba %t %t.notstripped38# RUN: llvm-readobj --symbols %t.notstripped | FileCheck %s --check-prefix=NOTSTRIPPED39# NOTSTRIPPED: Name: _ba40# NOTSTRIPPED: Name: _func41 42## FIXME: _ba should be stripped after --strip-symbol is implemented.43# RUN: llvm-objcopy --strip-symbol _ba --redefine-sym _foo=_ba %t %t.noba44# RUN: llvm-readobj --symbols %t.noba | FileCheck %s --check-prefix=NOTSTRIPPED45 46.globl _func47_func:48 49.section __TEXT,__const50.globl _foo51_foo:52