mirror of
https://github.com/RPCS3/llvm.git
synced 2024-11-25 04:39:51 +00:00
[gold] Consolidate the gold plugin options and actually search for
a gold binary explicitly. Substitute this binary into the tests rather than just directly executing the 'ld' binary. This should allow folks to inject a cross compiling gold binary, or in my case to use a gold binary built and installed somewhere other than /usr/bin/ld. It should also allow the tests to find 'ld.gold' so that things work even if gold isn't the default on the system. I've only stubbed out support in the makefile to preserve the existing behavior with none of the fancy logic. If someone else wants to add logic here, they're welcome to do so. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229251 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
96db150cec
commit
15db81893f
@ -538,6 +538,12 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_program(GOLD_EXECUTABLE NAMES ld.gold ld DOC "The gold linker")
|
||||
if(GOLD_EXECUTABLE)
|
||||
set(LLVM_BINUTILS_INCDIR "" CACHE PATH
|
||||
"PATH to binutils/include containing plugin-api.h for gold plugin.")
|
||||
endif()
|
||||
|
||||
include(FindOCaml)
|
||||
include(AddOCaml)
|
||||
if(WIN32)
|
||||
|
@ -128,6 +128,7 @@ lit.site.cfg: FORCE
|
||||
@$(ECHOPATH) s=@SHLIBEXT@=$(SHLIBEXT)=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@EXEEXT@=$(EXEEXT)=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@PYTHON_EXECUTABLE@=$(PYTHON)=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@GOLD_EXECUTABLE@=ld=g >> lit.tmp
|
||||
@$(ECHOPATH) s=@OCAMLFIND@=$(OCAMLFIND)=g >> lit.tmp
|
||||
@$(ECHOPATH) s!@OCAMLFLAGS@!$(addprefix -cclib ,$(LDFLAGS))!g >> lit.tmp
|
||||
@$(ECHOPATH) s=@HAVE_OCAMLOPT@=$(HAVE_OCAMLOPT)=g >> lit.tmp
|
||||
|
@ -187,6 +187,7 @@ if re.search(r'win32', config.target_triple):
|
||||
config.substitutions.append( ('%llc_dwarf', llc_dwarf) )
|
||||
|
||||
# Add site-specific substitutions.
|
||||
config.substitutions.append( ('%gold', config.gold_executable) )
|
||||
config.substitutions.append( ('%go', config.go_executable) )
|
||||
config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
|
||||
config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
|
||||
@ -333,7 +334,7 @@ def have_ld_plugin_support():
|
||||
if not os.path.exists(os.path.join(config.llvm_shlib_dir, 'LLVMgold.so')):
|
||||
return False
|
||||
|
||||
ld_cmd = subprocess.Popen(['ld', '--help'], stdout = subprocess.PIPE)
|
||||
ld_cmd = subprocess.Popen([config.gold_executable, '--help'], stdout = subprocess.PIPE)
|
||||
ld_out = ld_cmd.stdout.read().decode()
|
||||
ld_cmd.wait()
|
||||
|
||||
@ -352,7 +353,7 @@ def have_ld_plugin_support():
|
||||
if 'elf32ppc' not in emulations or 'elf_x86_64' not in emulations:
|
||||
return False
|
||||
|
||||
ld_version = subprocess.Popen(['ld', '--version'], stdout = subprocess.PIPE)
|
||||
ld_version = subprocess.Popen([config.gold_executable, '--version'], stdout = subprocess.PIPE)
|
||||
if not 'GNU gold' in ld_version.stdout.read().decode():
|
||||
return False
|
||||
ld_version.wait()
|
||||
|
@ -13,6 +13,7 @@ config.llvm_shlib_ext = "@SHLIBEXT@"
|
||||
config.llvm_exe_ext = "@EXEEXT@"
|
||||
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
|
||||
config.python_executable = "@PYTHON_EXECUTABLE@"
|
||||
config.gold_executable = "@GOLD_EXECUTABLE@"
|
||||
config.ocamlfind_executable = "@OCAMLFIND@"
|
||||
config.have_ocamlopt = "@HAVE_OCAMLOPT@"
|
||||
config.have_ocaml_ounit = "@HAVE_OCAML_OUNIT@"
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: llvm-as %p/Inputs/alias-1.ll -o %t2.o
|
||||
; RUN: ld -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o \
|
||||
; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o \
|
||||
; RUN: -plugin-opt=emit-llvm
|
||||
; RUN: llvm-dis < %t3.o -o - | FileCheck %s
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
|
||||
; RUN: not ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: -shared %t.o -o %t2.o 2>&1 | FileCheck %s
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
; RUN: llvm-mc -I=%T -filetype=obj -o %T/bcsection.bco %p/Inputs/bcsection.s
|
||||
; RUN: llvm-nm -no-llvm-bc %T/bcsection.bco | count 0
|
||||
; RUN: ld -r -o %T/bcsection.o -plugin %llvmshlibdir/LLVMgold.so %T/bcsection.bco
|
||||
; RUN: %gold -r -o %T/bcsection.o -plugin %llvmshlibdir/LLVMgold.so %T/bcsection.bco
|
||||
; RUN: llvm-nm -no-llvm-bc %T/bcsection.o | FileCheck %s
|
||||
|
||||
; CHECK: main
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
|
||||
; RUN: -shared %t.o -o %t2.o
|
||||
; RUN: llvm-dis %t2.o -o - | FileCheck %s
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: llvm-as %p/Inputs/comdat.ll -o %t2.o
|
||||
; RUN: ld -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t.o %t2.o \
|
||||
; RUN: %gold -shared -o %t3.o -plugin %llvmshlibdir/LLVMgold.so %t.o %t2.o \
|
||||
; RUN: -plugin-opt=emit-llvm
|
||||
; RUN: llvm-dis %t3.o -o - | FileCheck %s
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llvm-as %s -o %t1.o
|
||||
; RUN: llvm-as %p/Inputs/common.ll -o %t2.o
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: -shared %t1.o %t2.o -o %t3.o
|
||||
; RUN: llvm-dis %t3.o -o - | FileCheck %s
|
||||
@ -11,7 +11,7 @@
|
||||
; Shared library case, we merge @a as common and keep it for the symbol table.
|
||||
; CHECK: @a = common global i16 0, align 8
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: %t1.o %t2.o -o %t3.o
|
||||
; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=EXEC %s
|
||||
@ -20,7 +20,7 @@
|
||||
; EXEC: @a = internal global i16 0, align 8
|
||||
|
||||
; RUN: llc %p/Inputs/common.ll -o %t2.o -filetype=obj
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: %t1.o %t2.o -o %t3.o
|
||||
; RUN: llvm-dis %t3.o -o - | FileCheck --check-prefix=MIXED %s
|
||||
|
@ -1,20 +1,20 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: --plugin-opt=generate-api-file \
|
||||
; RUN: -shared %t.o -o %t2.o
|
||||
; RUN: llvm-dis %t2.o -o - | FileCheck %s
|
||||
; RUN: FileCheck --check-prefix=API %s < %T/../apifile.txt
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: -m elf_x86_64 --plugin-opt=save-temps \
|
||||
; RUN: -shared %t.o -o %t3.o
|
||||
; RUN: llvm-dis %t3.o.bc -o - | FileCheck %s
|
||||
; RUN: llvm-dis %t3.o.opt.bc -o - | FileCheck --check-prefix=OPT %s
|
||||
|
||||
; RUN: rm -f %t4.o
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: -m elf_x86_64 --plugin-opt=disable-output \
|
||||
; RUN: -shared %t.o -o %t4.o
|
||||
; RUN: not test -a %t4.o
|
||||
|
@ -1,4 +1,4 @@
|
||||
; RUN: not ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: not %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %p/Inputs/invalid.bc -o %t2 2>&1 | FileCheck %s
|
||||
|
||||
; test that only one error gets printed
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: -shared %t.o -o %t2.o \
|
||||
; RUN: -version-script=%p/Inputs/linker-script.export
|
||||
|
@ -1,12 +1,12 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: llvm-as %p/Inputs/linkonce-weak.ll -o %t2.o
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: -shared %t.o %t2.o -o %t3.o
|
||||
; RUN: llvm-dis %t3.o -o - | FileCheck %s
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: -shared %t2.o %t.o -o %t3.o
|
||||
; RUN: llvm-dis %t3.o -o - | FileCheck %s
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -m elf32ppc \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -m elf32ppc \
|
||||
; RUN: -plugin-opt=mtriple=powerpc-linux-gnu \
|
||||
; RUN: -plugin-opt=obj-path=%t3.o \
|
||||
; RUN: -shared %t.o -o %t2
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: llvm-as -o %t.bc %s
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -plugin-opt=emit-llvm \
|
||||
; RUN: --no-map-whole-files -r -o %t2.bc %t.bc
|
||||
; RUN: llvm-dis < %t2.bc -o - | FileCheck %s
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -m elf_x86_64 \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -m elf_x86_64 \
|
||||
; RUN: --plugin-opt=-jump-table-type=arity \
|
||||
; RUN: --plugin-opt=-mattr=+aes \
|
||||
; RUN: --plugin-opt=mcpu=core-avx2 \
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llc %s -o %t.o -filetype=obj -relocation-model=pic
|
||||
; RUN: llvm-as %p/Inputs/pr19901-1.ll -o %t2.o
|
||||
; RUN: ld -shared -o %t.so -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o
|
||||
; RUN: %gold -shared -o %t.so -plugin %llvmshlibdir/LLVMgold.so %t2.o %t.o
|
||||
; RUN: llvm-readobj -t %t.so | FileCheck %s
|
||||
|
||||
; CHECK: Symbol {
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=save-temps \
|
||||
; RUN: -shared %t.o -o %t2.o
|
||||
; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
|
||||
|
@ -1,7 +1,7 @@
|
||||
; REQUIRES: asserts
|
||||
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -shared \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so -shared \
|
||||
; RUN: -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: Statistics Collected
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=save-temps \
|
||||
; RUN: -shared %t.o -o %t2.o
|
||||
; RUN: llvm-dis %t2.o.opt.bc -o - | FileCheck %s
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: llvm-as %p/Inputs/weak.ll -o %t2.o
|
||||
|
||||
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
|
||||
; RUN: --plugin-opt=emit-llvm \
|
||||
; RUN: -shared %t.o %t2.o -o %t3.o
|
||||
; RUN: llvm-dis %t3.o -o - | FileCheck %s
|
||||
|
@ -1,6 +1,3 @@
|
||||
set(LLVM_BINUTILS_INCDIR "" CACHE PATH
|
||||
"PATH to binutils/include containing plugin-api.h for gold plugin.")
|
||||
|
||||
set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/gold.exports)
|
||||
|
||||
if( LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR )
|
||||
|
Loading…
Reference in New Issue
Block a user