Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JITLink][MachO] Re-apply b64afad, MachO linker-private support, with…
… fixes. Global symbols with linker-private prefixes should be resolvable across object boundaries, but internal symbols with linker-private prefixes should not.
- Loading branch information
Showing
6 changed files
with
65 additions
and
8 deletions.
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
12 changes: 12 additions & 0 deletions
12
llvm/test/ExecutionEngine/JITLink/X86/Inputs/MachO_global_linker_private_def.s
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,12 @@ | ||
# Supplies a global definition, l_foo, with a linker-private prefix. Since this | ||
# definition is marked as global it should be resolvable outside the object. | ||
|
||
.section __TEXT,__text,regular,pure_instructions | ||
.macosx_version_min 10, 14 | ||
.globl l_foo | ||
.p2align 4, 0x90 | ||
l_foo: | ||
xorl %eax, %eax | ||
retq | ||
|
||
.subsections_via_symbols |
12 changes: 12 additions & 0 deletions
12
llvm/test/ExecutionEngine/JITLink/X86/Inputs/MachO_internal_linker_private_def.s
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,12 @@ | ||
# Supplies an internal definition, l_foo, with a linker-private prefix. Since | ||
# this definition is not marked as global it should not be resolvable outside | ||
# the object. | ||
|
||
.section __TEXT,__text,regular,pure_instructions | ||
.macosx_version_min 10, 14 | ||
.p2align 4, 0x90 | ||
l_foo: | ||
xorl %eax, %eax | ||
retq | ||
|
||
.subsections_via_symbols |
22 changes: 22 additions & 0 deletions
22
llvm/test/ExecutionEngine/JITLink/X86/MachO_linker_private_symbols.s
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,22 @@ | ||
# RUN: rm -rf %t && mkdir -p %t | ||
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \ | ||
# RUN: -o %t/global_lp_def.o %S/Inputs/MachO_global_linker_private_def.s | ||
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \ | ||
# RUN: -o %t/internal_lp_def.o %S/Inputs/MachO_internal_linker_private_def.s | ||
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj \ | ||
# RUN: -o %t/macho_lp_test.o %s | ||
# RUN: llvm-jitlink -noexec %t/global_lp_def.o %t/macho_lp_test.o | ||
# RUN: not llvm-jitlink -noexec %t/internal_lp_def.o %t/macho_lp_test.o | ||
# | ||
# Check that we can resolve global symbols whose names start with the | ||
# linker-private prefix 'l' across object boundaries, and that we can't resolve | ||
# internals with the linker-private prefix across object boundaries. | ||
|
||
.section __TEXT,__text,regular,pure_instructions | ||
.macosx_version_min 10, 14 | ||
.globl _main | ||
.p2align 4, 0x90 | ||
_main: | ||
jmp l_foo | ||
|
||
.subsections_via_symbols |