-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This creates a symbol alias similar to --defsym in the elf linker. This is used by swiftpm for all executables, so it's useful to support. This doesn't implement -alias_list but that could be done pretty easily as needed. Differential Revision: https://reviews.llvm.org/D129938
- Loading branch information
Showing
6 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# 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 | ||
|
||
# RUN: %lld -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 | ||
.globl _foo | ||
_foo: | ||
ret | ||
|
||
#--- main.s | ||
.globl _main | ||
_main: | ||
ret |