Skip to content

Commit

Permalink
[ORC] Make sure we add initializers to the SymbolFlags map for objects.
Browse files Browse the repository at this point in the history
  • Loading branch information
lhames committed Mar 3, 2020
1 parent 22ed8c4 commit ff4fd8d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/ExecutionEngine/Orc/Mangling.cpp
Expand Up @@ -119,6 +119,7 @@ getObjectSymbolInfo(ExecutionSession &ES, MemoryBufferRef ObjBuffer) {
raw_string_ostream(InitSymString)
<< "$." << ObjBuffer.getBufferIdentifier() << ".__inits";
InitSymbol = ES.intern(InitSymString);
SymbolFlags[InitSymbol] = JITSymbolFlags();
break;
}
}
Expand Down
21 changes: 21 additions & 0 deletions llvm/test/ExecutionEngine/JITLink/X86/MachO_initializers.s
@@ -0,0 +1,21 @@
# RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t.o %s
# RUN: llvm-jitlink -noexec %t.o

.section __TEXT,__text,regular,pure_instructions
.macosx_version_min 10, 14 sdk_version 10, 15

.globl _main
_main:
retq

.section __TEXT,__StaticInit,regular,pure_instructions
.p2align 4, 0x90
_foo:
retq


.section __DATA,__mod_init_func,mod_init_funcs
.p2align 3
.quad _foo

.subsections_via_symbols

0 comments on commit ff4fd8d

Please sign in to comment.