Index: include/llvm/Support/thread.h =================================================================== --- include/llvm/Support/thread.h +++ include/llvm/Support/thread.h @@ -57,6 +57,7 @@ thread(const thread &) = delete; void join() {} + static unsigned hardware_concurrency() { return 1; }; }; } Index: test/tools/gold/X86/Inputs/thinlto_linkonceresolution.ll =================================================================== --- /dev/null +++ test/tools/gold/X86/Inputs/thinlto_linkonceresolution.ll @@ -0,0 +1,4 @@ +target triple = "x86_64-unknown-linux-gnu" +define linkonce_odr hidden void @f() { + ret void +} Index: test/tools/gold/X86/pr19901_thinlto.ll =================================================================== --- /dev/null +++ test/tools/gold/X86/pr19901_thinlto.ll @@ -0,0 +1,25 @@ +; RUN: llc %s -o %t.o -filetype=obj -relocation-model=pic +; RUN: llvm-as -function-summary %p/Inputs/pr19901-1.ll -o %t2.o +; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ +; RUN: --plugin-opt=thinlto \ +; RUN: -shared -m elf_x86_64 -o %t.so %t2.o %t.o +; RUN: llvm-readobj -t %t.so | FileCheck %s + +; CHECK: Symbol { +; CHECK: Name: f +; CHECK-NEXT: Value: +; CHECK-NEXT: Size: +; CHECK-NEXT: Binding: Local +; CHECK-NEXT: Type: Function +; CHECK-NEXT: Other: {{2|0}} +; CHECK-NEXT: Section: .text +; CHECK-NEXT: } + +target triple = "x86_64-unknown-linux-gnu" +define i32 @g() { + call void @f() + ret i32 0 +} +define linkonce_odr hidden void @f() { + ret void +} Index: test/tools/gold/X86/thinlto.ll =================================================================== --- test/tools/gold/X86/thinlto.ll +++ test/tools/gold/X86/thinlto.ll @@ -4,17 +4,55 @@ ; RUN: llvm-as %p/Inputs/thinlto.ll -o %t2.o ; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ ; RUN: --plugin-opt=thinlto \ +; RUN: --plugin-opt=thinlto-index-only \ ; RUN: -shared %t.o %t2.o -o %t3 +; RUN: not test -e %t3 +; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ +; RUN: --plugin-opt=thinlto \ +; RUN: -shared %t.o %t2.o -o %t4 +; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM +; Next generate function summary sections and test gold handling. ; RUN: llvm-as -function-summary %s -o %t.o ; RUN: llvm-as -function-summary %p/Inputs/thinlto.ll -o %t2.o +; Ensure gold generates an index and not a binary if requested. ; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ ; RUN: --plugin-opt=thinlto \ +; RUN: --plugin-opt=thinlto-index-only \ ; RUN: -shared %t.o %t2.o -o %t3 ; RUN: llvm-bcanalyzer -dump %t3.thinlto.bc | FileCheck %s --check-prefix=COMBINED ; RUN: not test -e %t3 +; Ensure gold generates an index as well as a binary by default in ThinLTO mode. +; First force single-threaded mode +; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ +; RUN: --plugin-opt=thinlto \ +; RUN: --plugin-opt=jobs=1 \ +; RUN: -shared %t.o %t2.o -o %t4 +; RUN: llvm-bcanalyzer -dump %t4.thinlto.bc | FileCheck %s --check-prefix=COMBINED +; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM + +; Next force multi-threaded mode +; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ +; RUN: --plugin-opt=thinlto \ +; RUN: --plugin-opt=jobs=2 \ +; RUN: -shared %t.o %t2.o -o %t4 +; RUN: llvm-bcanalyzer -dump %t4.thinlto.bc | FileCheck %s --check-prefix=COMBINED +; RUN: llvm-nm %t4 | FileCheck %s --check-prefix=NM + +; Test --plugin-opt=obj-path to ensure unique object files generated. +; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \ +; RUN: --plugin-opt=thinlto \ +; RUN: --plugin-opt=jobs=2 \ +; RUN: --plugin-opt=obj-path=%t5.o \ +; RUN: -shared %t.o %t2.o -o %t4 +; RUN: llvm-nm %t5.o0 | FileCheck %s --check-prefix=NM2 +; RUN: llvm-nm %t5.o1 | FileCheck %s --check-prefix=NM2 + +; NM: T f +; NM2: T {{f|g}} + ; COMBINED: