diff --git a/llvm/lib/ExecutionEngine/Orc/Core.cpp b/llvm/lib/ExecutionEngine/Orc/Core.cpp index 6a9ebb41e79f6..978057237e531 100644 --- a/llvm/lib/ExecutionEngine/Orc/Core.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Core.cpp @@ -1821,17 +1821,10 @@ ExecutionSession::lookup(const JITDylibSearchOrder &SearchOrder, RegisterDependenciesFunction RegisterDependencies) { #if LLVM_ENABLE_THREADS // In the threaded case we use promises to return the results. - std::promise PromisedResult; - Error ResolutionError = Error::success(); + std::promise> PromisedResult; auto NotifyComplete = [&](Expected R) { - if (R) - PromisedResult.set_value(std::move(*R)); - else { - ErrorAsOutParameter _(ResolutionError); - ResolutionError = R.takeError(); - PromisedResult.set_value(SymbolMap()); - } + PromisedResult.set_value(std::move(R)); }; #else @@ -1848,18 +1841,11 @@ ExecutionSession::lookup(const JITDylibSearchOrder &SearchOrder, #endif // Perform the asynchronous lookup. - lookup(K, SearchOrder, std::move(Symbols), RequiredState, NotifyComplete, - RegisterDependencies); + lookup(K, SearchOrder, std::move(Symbols), RequiredState, + std::move(NotifyComplete), RegisterDependencies); #if LLVM_ENABLE_THREADS - auto ResultFuture = PromisedResult.get_future(); - auto Result = ResultFuture.get(); - - if (ResolutionError) - return std::move(ResolutionError); - - return std::move(Result); - + return PromisedResult.get_future().get(); #else if (ResolutionError) return std::move(ResolutionError); diff --git a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s index b4f6e04d4eb4a..9296f048e51ed 100644 --- a/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s +++ b/llvm/test/ExecutionEngine/JITLink/AArch32/ELF_data_alignment.s @@ -1,16 +1,18 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=armv7-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t_armv7.o %s # RUN: llvm-objdump -s --section=.rodata %t_armv7.o | FileCheck --check-prefix=CHECK-OBJ %s -# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \ -# RUN: -slab-page-size 4096 %t_armv7.o -debug-only=jitlink 2>&1 \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -slab-address 0x76ff0000 -slab-allocate 10Kb \ +# RUN: -slab-page-size 4096 %t_armv7.o 2>&1 \ # RUN: | FileCheck --check-prefix=CHECK-LG %s # RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \ # RUN: -slab-page-size 4096 %t_armv7.o -check %s # RUN: llvm-mc -triple=thumbv7-linux-gnueabi -arm-add-build-attributes -filetype=obj -o %t_thumbv7.o %s # RUN: llvm-objdump -s --section=.rodata %t_thumbv7.o | FileCheck --check-prefix=CHECK-OBJ %s -# RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \ -# RUN: -slab-page-size 4096 %t_thumbv7.o -debug-only=jitlink 2>&1 \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -slab-address 0x76ff0000 -slab-allocate 10Kb \ +# RUN: -slab-page-size 4096 %t_thumbv7.o 2>&1 \ # RUN: | FileCheck --check-prefix=CHECK-LG %s # RUN: llvm-jitlink -noexec -slab-address 0x76ff0000 -slab-allocate 10Kb \ # RUN: -slab-page-size 4096 %t_thumbv7.o -check %s diff --git a/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_ehframe.s b/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_ehframe.s index 151a041e7bcda..b25ffee270c45 100644 --- a/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_ehframe.s +++ b/llvm/test/ExecutionEngine/JITLink/AArch64/ELF_ehframe.s @@ -1,7 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=aarch64-linux-gnu -filetype=obj -o %t %s -# RUN: llvm-jitlink -noexec -phony-externals -debug-only=jitlink %t 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -phony-externals %t 2>&1 | FileCheck %s # # Check that splitting of eh-frame sections works. # diff --git a/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_compact_unwind.s b/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_compact_unwind.s index 20534d5a48656..b2adb8566e7c1 100644 --- a/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_compact_unwind.s +++ b/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_compact_unwind.s @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=arm64-apple-ios -filetype=obj -o %t %s -# RUN: llvm-jitlink -noexec -debug-only=jitlink %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s # # Check that splitting of compact-unwind sections works. # diff --git a/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_ehframe.s b/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_ehframe.s index 8d43b0f975f69..4e84518f86a0a 100644 --- a/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_ehframe.s +++ b/llvm/test/ExecutionEngine/JITLink/AArch64/MachO_ehframe.s @@ -1,7 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=arm64-apple-darwin11 -filetype=obj -o %t %s -# RUN: llvm-jitlink -noexec -phony-externals -debug-only=jitlink %t 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -phony-externals %t 2>&1 | FileCheck %s # # Check that splitting of eh-frame sections works. # diff --git a/llvm/test/ExecutionEngine/JITLink/LoongArch/ELF_loongarch64_ehframe.s b/llvm/test/ExecutionEngine/JITLink/LoongArch/ELF_loongarch64_ehframe.s index cc545853f3278..806cdcf392f29 100644 --- a/llvm/test/ExecutionEngine/JITLink/LoongArch/ELF_loongarch64_ehframe.s +++ b/llvm/test/ExecutionEngine/JITLink/LoongArch/ELF_loongarch64_ehframe.s @@ -1,7 +1,7 @@ # REQUIRES: asserts -# RUN: llvm-mc --triple=loongarch64-linux-gnu --filetype=obj -o %t %s -# RUN: llvm-jitlink --noexec --phony-externals --debug-only=jitlink %t 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-mc -triple=loongarch64-linux-gnu -filetype=obj -o %t %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -phony-externals %t 2>&1 | FileCheck %s ## Check that splitting of eh-frame sections works. diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s index 480fbb8613107..2b5c9e383c04f 100644 --- a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s +++ b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call.s @@ -1,15 +1,15 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=riscv32 -mattr=+relax -filetype=obj -o %t.rv32 %s -# RUN: llvm-jitlink -noexec \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s %t.rv32 \ -# RUN: 2>&1 | FileCheck %s +# RUN: -check %s %t.rv32 2>&1 \ +# RUN: | FileCheck %s # RUN: llvm-mc -triple=riscv64 -mattr=+relax -filetype=obj -o %t.rv64 %s -# RUN: llvm-jitlink -noexec \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s %t.rv64 \ -# RUN: 2>&1 | FileCheck %s +# RUN: -check %s %t.rv64 2>&1 \ +# RUN: | FileCheck %s .text diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s index e8a2928999f4a..3bbfd557a0a6c 100644 --- a/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s +++ b/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_call_rvc.s @@ -1,43 +1,43 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=riscv32 -mattr=+relax,+c -filetype=obj -o %t.rv32 %s -# RUN: llvm-jitlink -noexec \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s %t.rv32 \ -# RUN: 2>&1 | FileCheck %s -# RUN: llvm-jitlink -noexec \ +# RUN: -check %s %t.rv32 2>&1 \ +# RUN: | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s -check-name=jitlink-check-rv32 %t.rv32 \ -# RUN: 2>&1 | FileCheck -check-prefix=CHECK-RV32 %s +# RUN: -check %s -check-name=jitlink-check-rv32 %t.rv32 2>&1 \ +# RUN: | FileCheck -check-prefix=CHECK-RV32 %s # RUN: llvm-mc -triple=riscv64 -mattr=+relax,+c -filetype=obj -o %t.rv64 %s -# RUN: llvm-jitlink -noexec \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s %t.rv64 \ -# RUN: 2>&1 | FileCheck %s -# RUN: llvm-jitlink -noexec \ +# RUN: -check %s %t.rv64 2>&1 \ +# RUN: | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s -check-name=jitlink-check-rv64 %t.rv64 \ -# RUN: 2>&1 | FileCheck -check-prefix=CHECK-RV64 %s +# RUN: -check %s -check-name=jitlink-check-rv64 %t.rv64 2>&1 \ +# RUN: | FileCheck -check-prefix=CHECK-RV64 %s # RUN: llvm-mc -triple=riscv32 -mattr=+relax,+zca -filetype=obj -o %t.rv32zca %s -# RUN: llvm-jitlink -noexec \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s %t.rv32zca \ -# RUN: 2>&1 | FileCheck %s -# RUN: llvm-jitlink -noexec \ +# RUN: -check %s %t.rv32zca 2>&1 \ +# RUN: | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s -check-name=jitlink-check-rv32 %t.rv32zca \ -# RUN: 2>&1 | FileCheck -check-prefix=CHECK-RV32 %s +# RUN: -check %s -check-name=jitlink-check-rv32 %t.rv32zca 2>&1 \ +# RUN: | FileCheck -check-prefix=CHECK-RV32 %s # RUN: llvm-mc -triple=riscv64 -mattr=+relax,+c -filetype=obj -o %t.rv64 %s -# RUN: llvm-jitlink -noexec \ +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s %t.rv64 \ -# RUN: 2>&1 | FileCheck %s -# RUN: llvm-jitlink -noexec \ +# RUN: -check %s %t.rv64 2>&1 \ +# RUN: | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ # RUN: -slab-allocate 100Kb -slab-address 0x1000 -slab-page-size 4096 \ -# RUN: -debug-only=jitlink -check %s -check-name=jitlink-check-rv64 %t.rv64 \ -# RUN: 2>&1 | FileCheck -check-prefix=CHECK-RV64 %s +# RUN: -check %s -check-name=jitlink-check-rv64 %t.rv64 2>&1 \ +# RUN: | FileCheck -check-prefix=CHECK-RV64 %s .text diff --git a/llvm/test/ExecutionEngine/JITLink/RISCV/anonymous_symbol.s b/llvm/test/ExecutionEngine/JITLink/RISCV/anonymous_symbol.s index e7114e4d643c6..a1badfd0ee3dc 100644 --- a/llvm/test/ExecutionEngine/JITLink/RISCV/anonymous_symbol.s +++ b/llvm/test/ExecutionEngine/JITLink/RISCV/anonymous_symbol.s @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=riscv64 -filetype=obj -o %t %s -# RUN: llvm-jitlink -debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -debug-only=jitlink -num-threads=0 -noexec %t 2>&1 \ +# RUN: | FileCheck %s # # Because of the exist of cfi directive, sections like eh_frame section will be emitted # in llvm's object code emission phase. Anonymous symbols will also be emitted to indicate diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_ehframe.s b/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_ehframe.s index 9e9b340c5d8d2..75f09ff402ad9 100644 --- a/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_ehframe.s +++ b/llvm/test/ExecutionEngine/JITLink/ppc64/ELF_ppc64_ehframe.s @@ -1,10 +1,12 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o %t %s -# RUN: llvm-jitlink -noexec -phony-externals -debug-only=jitlink %t 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec -phony-externals \ +# RUN: %t 2>&1 \ +# RUN: | FileCheck %s # RUN: llvm-mc -triple=powerpc64-unknown-linux-gnu -filetype=obj -o %t %s -# RUN: llvm-jitlink -noexec -phony-externals -debug-only=jitlink %t 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec -phony-externals \ +# RUN: %t 2>&1 \ +# RUN: | FileCheck %s # # Check that splitting of eh-frame sections works. # diff --git a/llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s b/llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s index 0bc90903caf97..7021a27294c93 100644 --- a/llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s +++ b/llvm/test/ExecutionEngine/JITLink/ppc64/external_weak.s @@ -4,8 +4,9 @@ # RUN: %t/external_weak.o %S/Inputs/external_weak.s # RUN: llvm-mc -triple=powerpc64le-unknown-linux-gnu -filetype=obj -o \ # RUN: %t/external_weak_main.o %S/Inputs/external_weak_main.s -# RUN: llvm-jitlink -noexec -debug-only=jitlink %t/external_weak.o \ -# RUN: %t/external_weak_main.o 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: %t/external_weak.o %t/external_weak_main.o 2>&1 \ +# RUN: | FileCheck %s # CHECK: Created ELFLinkGraphBuilder for "{{.*}}external_weak_main.o" # CHECK: Creating defined graph symbol for ELF symbol "foo" # CHECK: External symbols: diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_abs.s b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_abs.s index 830a2e00f4872..d69dbbdd70404 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_abs.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_abs.s @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t -# RUN: llvm-jitlink --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s # # Check absolute symbol is created with a correct value. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_any.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_any.test index 10f118280b1d8..b1176744b9a46 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_any.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_any.test @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check a weak symbol is created for a COMDAT symbol with IMAGE_COMDAT_SELECT_ANY selection type. # # CHECK: Creating graph symbols... diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative.test index 7dfb4c7ec8eaa..8915d04d7cbf9 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_associative.test @@ -1,16 +1,19 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check COMDAT associative symbol is emitted as local symbol. # -# CHECK: Creating graph symbols... -# CHECK: 2: Creating defined graph symbol for COFF symbol ".text" in .text (index: 2) -# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000001, linkage: strong, scope: local, dead - -# CHECK-NEXT: 4: Exporting COMDAT graph symbol for COFF symbol "func" in section 2 -# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000001, linkage: weak, scope: default, dead - func -# CHECK-NEXT: 5: Creating defined graph symbol for COFF symbol ".xdata" in .xdata (index: 3) -# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000000, linkage: strong, scope: local, dead - .xdata +# CHECK: Creating graph symbols... +# CHECK: 0: Creating defined graph symbol for COFF symbol ".text" in .text (index: 1) +# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000000, linkage: strong, scope: local, dead - .text +# CHECK-NEXT: 4: Exporting COMDAT graph symbol for COFF symbol "func" in section 2 +# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000000, linkage: weak, scope: default, dead - func +# CHECK-NEXT: 4: Creating defined graph symbol for COFF symbol "func" in .text (index: 2) +# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000000, linkage: weak, scope: default, dead - func +# CHECK-NEXT: 5: Creating defined graph symbol for COFF symbol ".xdata" in .xdata (index: 3) +# CHECK-NEXT: 0x0 (block + 0x00000000): size: 0x00000000, linkage: strong, scope: local, dead - .xdata --- !COFF header: diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_exact_match.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_exact_match.test index f7572714bae16..76a0ac4813b86 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_exact_match.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_exact_match.test @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check a weak symbol is created for a COMDAT symbol with IMAGE_COMDAT_SELECT_EXACT_MATCH selection type. # Doesn't check the content validation. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_intervene.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_intervene.test index 11a1825783797..79f4b15bd53b5 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_intervene.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_intervene.test @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check a comdat export is done correctly even if second symbol of comdat sequences appear out of order # # CHECK: Creating graph symbols... diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_largest.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_largest.test index 86d809d63ed2b..dc0529780f6a5 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_largest.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_largest.test @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check jitlink handles largest selection type as plain weak symbol. # # CHECK: Creating graph symbols... diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_noduplicate.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_noduplicate.test index 53b2c81b5ec7f..0c5313eb7d61b 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_noduplicate.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_noduplicate.test @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check a strong symbol is created for a COMDAT symbol with IMAGE_COMDAT_SELECT_NODUPLICATES selection type. # # CHECK: Creating graph symbols... diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_offset.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_offset.test index 97467fdb5ee9a..6cd8ff9b1e5ae 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_offset.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_offset.test @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check a COMDAT symbol with an offset is handled correctly. # # CHECK: Creating graph symbols... diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_same_size.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_same_size.test index ef0f84a584c3c..e1d955f54ffb1 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_same_size.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_same_size.test @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s +# # Check a weak symbol is created for a COMDAT symbol with IMAGE_COMDAT_SELECT_SAME_SIZE selection type. # Doesn't check the size validation. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_weak.s b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_weak.s index 79ac75ffe441f..8fa8ba0d8c950 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_weak.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_comdat_weak.s @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t -# RUN: llvm-jitlink --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s # # Check a COMDAT any symbol is exported as a weak symbol. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_common_symbol.s b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_common_symbol.s index 2d4ad30f94d8d..2788a9b0ae142 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_common_symbol.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_common_symbol.s @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t -# RUN: llvm-jitlink --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s # # Check a common symbol is created. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_duplicate_externals.test b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_duplicate_externals.test index e929c01316860..ebce7958442cd 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_duplicate_externals.test +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_duplicate_externals.test @@ -1,10 +1,10 @@ # REQUIRES: asserts # RUN: yaml2obj %s -o %t -# RUN: llvm-jitlink -noexec -abs __ImageBase=0xfff00000 \ -# RUN: --debug-only=jitlink \ -# RUN: -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \ -# RUN: %t 2>&1 | FileCheck %s -# +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -abs __ImageBase=0xfff00000 -slab-allocate 100Kb \ +# RUN: -slab-address 0xfff00000 -slab-page-size 4096 %t 2>&1 \ +# RUN: | FileCheck %s +# # Check duplicate undefined external symbols are handled correctly. # # CHECK: Creating graph symbols... diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_file_debug.s b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_file_debug.s index 3980f81801ac2..ac1ef2dc962bf 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_file_debug.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_file_debug.s @@ -1,6 +1,8 @@ # REQUIRES: asserts # RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t -# RUN: llvm-jitlink -abs func=0xcafef00d --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -abs func=0xcafef00d %t 2>&1 \ +# RUN: | FileCheck %s # # Check a file debug symbol is skipped. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_static_var.s b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_static_var.s index 5275c7d81766e..dce0c1eaa77ca 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_static_var.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_static_var.s @@ -1,6 +1,8 @@ # REQUIRES: asserts # RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t -# RUN: llvm-jitlink -abs var=0xcafef00d --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -abs var=0xcafef00d %t 2>&1 \ +# RUN: | FileCheck %s # # Check a local symbol is created for a static variable. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_weak_external.s b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_weak_external.s index c750d75b82f2d..d49d56150017b 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_weak_external.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/COFF_weak_external.s @@ -1,6 +1,8 @@ # REQUIRES: asserts # RUN: llvm-mc -filetype=obj -triple=x86_64-windows-msvc %s -o %t -# RUN: llvm-jitlink -abs var=0xcafef00d --debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -abs var=0xcafef00d %t 2>&1 | \ +# RUN: FileCheck %s # # Check a default symbol is aliased as a weak external symbol. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_debug_section_lifetime_is_NoAlloc.yaml b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_debug_section_lifetime_is_NoAlloc.yaml index 0afcda467c326..09dda47392253 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_debug_section_lifetime_is_NoAlloc.yaml +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_debug_section_lifetime_is_NoAlloc.yaml @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: yaml2obj -o %t.o %s -# RUN: llvm-jitlink -debug-only=jitlink -noexec %t.o 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t.o 2>&1 \ +# RUN: | FileCheck %s # # Check that debug sections get NoAlloc lifetimes. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_basic.s b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_basic.s index c01ced5d0523b..9339f076c67f8 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_basic.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_basic.s @@ -2,8 +2,9 @@ # UNSUPPORTED: system-windows # RUN: llvm-mc -triple=x86_64-unknown-linux -position-independent \ # RUN: -filetype=obj -o %t %s -# RUN: llvm-jitlink -debug-only=jitlink -abs bar=0x01 \ -# RUN: -abs _ZTIi=0x02 -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -abs bar=0x01 -abs _ZTIi=0x02 %t 2>&1 \ +# RUN: | FileCheck %s # # FIXME: This test should run on windows. Investigate spurious # 'note: command had no output on stdout or stderr' errors, then re-enable. diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_large_static_personality_encodings.s b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_large_static_personality_encodings.s index 64990b5d38f07..98fc5f4e3acc4 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_large_static_personality_encodings.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/ELF_ehframe_large_static_personality_encodings.s @@ -2,8 +2,9 @@ # UNSUPPORTED: system-windows # RUN: llvm-mc -triple=x86_64-pc-linux-gnu -large-code-model \ # RUN: -filetype=obj -o %t %s -# RUN: llvm-jitlink -debug-only=jitlink -noexec -phony-externals %t 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -phony-externals %t 2>&1 \ +# RUN: | FileCheck %s # # Check handling of pointer encodings for personality functions when compiling # with `-mcmodel=large -static`. diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/LocalDependencyPropagation.s b/llvm/test/ExecutionEngine/JITLink/x86-64/LocalDependencyPropagation.s index 0898ad8b18230..83d71cdf6fc83 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/LocalDependencyPropagation.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/LocalDependencyPropagation.s @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t %s -# RUN: llvm-jitlink -debug-only=orc -num-threads=0 -noexec \ -# RUN: -abs _external_func=0x1 -entry=_foo %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=orc -noexec \ +# RUN: -abs _external_func=0x1 -entry=_foo %t 2>&1 \ +# RUN: | FileCheck %s # # Check that simplification eliminates dependencies on symbols in this unit, # and correctly propagates dependencies on symbols outside the unit (including diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO-check-dwarf-filename.s b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO-check-dwarf-filename.s index df44ce996ecad..81ea18f249340 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO-check-dwarf-filename.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO-check-dwarf-filename.s @@ -1,6 +1,7 @@ # RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t.o %s -# RUN: llvm-jitlink -debug-only=orc -noexec -debugger-support %t.o 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=orc -noexec -debugger-support \ +# RUN: %t.o 2>&1 \ +# RUN: | FileCheck %s # # REQUIRES: asserts && system-darwin # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_compact_unwind.s b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_compact_unwind.s index e57831418304c..38522078f4ce9 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_compact_unwind.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_compact_unwind.s @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=x86_64-apple-darwin11 -filetype=obj -o %t %s -# RUN: llvm-jitlink -noexec -debug-only=jitlink %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s # # Check that splitting of compact-unwind sections works. # diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_alignment.s b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_alignment.s index 5a8cef5749f0a..3859a35ce2214 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_alignment.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_alignment.s @@ -1,6 +1,7 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=x86_64-apple-macos10.9 -filetype=obj -o %t %s -# RUN: llvm-jitlink -debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s # # Verify that PC-begin candidate symbols have been sorted correctly when adding # PC-begin edges for FDEs. In this test both _main and _X are at address zero, diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_splitting.s b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_splitting.s index a5baf5611cc29..0d68a10c59d19 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_splitting.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_cstring_section_splitting.s @@ -1,7 +1,8 @@ # REQUIRES: asserts # RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t %s -# RUN: llvm-jitlink -debug-only=jitlink -noexec -entry hook %t 2>&1 | \ -# RUN: FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec \ +# RUN: -entry hook %t 2>&1 \ +# RUN: | FileCheck %s # # Verify that we split C string literals on null-terminators, rather than on # symbol boundaries. We expect four dead-stripped symbols: l_str.0, l_str.2, diff --git a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_non_subsections_via_symbols.s b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_non_subsections_via_symbols.s index e1adb3bc75a1f..66fcb47fc7abf 100644 --- a/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_non_subsections_via_symbols.s +++ b/llvm/test/ExecutionEngine/JITLink/x86-64/MachO_non_subsections_via_symbols.s @@ -4,7 +4,8 @@ # # REQUIRES: asserts # RUN: llvm-mc -triple=x86_64-apple-macosx10.9 -filetype=obj -o %t %s -# RUN: llvm-jitlink -debug-only=jitlink -noexec %t 2>&1 | FileCheck %s +# RUN: llvm-jitlink -num-threads=0 -debug-only=jitlink -noexec %t 2>&1 \ +# RUN: | FileCheck %s # CHECK: Creating graph symbols... # CHECK: Graphifying regular section __DATA,__data... diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp index 646d4cef01a57..431b86a27e16b 100644 --- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp +++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp @@ -1667,6 +1667,12 @@ static Error sanitizeArguments(const Triple &TT, const char *ArgV0) { inconvertibleErrorCode()); } +#ifndef NDEBUG + if (DebugFlag && MaterializationThreads != 0) + errs() << "Warning: debugging output is not thread safe. " + "Use -num-threads=0 to stabilize output.\n"; +#endif // NDEBUG + // Only one of -oop-executor and -oop-executor-connect can be used. if (!!OutOfProcessExecutor.getNumOccurrences() && !!OutOfProcessExecutorConnect.getNumOccurrences())