File: alias-option.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (44 lines) | stat: -rw-r--r-- 1,506 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# REQUIRES: x86
# RUN: rm -rf %t; split-file %s %t

# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/foo.o %t/foo.s
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main.o %t/main.s

# RUN: %lld -alias _foo _bar -u _bar -exported_symbol _bar %t/main.o %t/foo.o -o %t/bar.o
# RUN: llvm-nm %t/bar.o | FileCheck %s --check-prefix=BAR

# BAR: [[#%x,FOO_ADDR:]] T _bar
# BAR: [[#FOO_ADDR]]     t _foo

# RUN: not %lld -alias _missing _bar -alias _missing2 _baz %t/main.o -o %t/missing.o %s 2>&1 | FileCheck %s --check-prefix=MISSING

# MISSING-DAG: undefined base symbol '_missing' for alias '_bar'
# MISSING-DAG: undefined base symbol '_missing2' for alias '_baz'

# RUN: %lld -alias _foo _main %t/foo.o -o %t/main_rename.o
# RUN: llvm-nm %t/main_rename.o | FileCheck %s --check-prefix=MAIN

# MAIN: [[#%x,FOO_ADDR:]] T _foo
# MAIN: [[#FOO_ADDR]]     T _main

## Verify dead stripping doesn't remove the aliased symbol. This behavior differs
## from ld64 where it actually does dead strip only the alias, not the original symbol.
# RUN: %lld -dead_strip -alias _foo _bar -alias _main _fake_main %t/main.o %t/foo.o -o %t/multiple.o
# RUN: llvm-nm %t/multiple.o | FileCheck %s --check-prefix=MULTIPLE

# MULTIPLE: [[#%x,FOO_ADDR:]]  T _bar
# MULTIPLE: [[#%x,MAIN_ADDR:]] T _fake_main
# MULTIPLE: [[#FOO_ADDR]]      T _foo
# MULTIPLE: [[#MAIN_ADDR]]     T _main

#--- foo.s
.subsections_via_symbols
.globl _foo
_foo:
  ret

#--- main.s
.subsections_via_symbols
.globl _main
_main:
  ret