Start adding some tests for the gold plugin.

These are only used when the 'ld' in the path is gold and the plugin has
been built, but it is already a start to make sure we don't regress features
that cannot be tested with llvm-lto.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214058 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-07-27 23:11:06 +00:00
parent 77b9fc127b
commit 12cc465b43
3 changed files with 48 additions and 1 deletions

View File

@ -301,8 +301,28 @@ else:
if config.host_triple == config.target_triple: if config.host_triple == config.target_triple:
config.available_features.add("native") config.available_features.add("native")
# Ask llvm-config about assertion mode.
import subprocess import subprocess
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)
if not '-plugin' in ld_cmd.stdout.read():
return False
ld_cmd.wait()
ld_version = subprocess.Popen(['ld', '--version'], stdout = subprocess.PIPE)
if not 'GNU gold' in ld_version.stdout.read():
return False
ld_version.wait()
return True
if have_ld_plugin_support():
config.available_features.add('ld_plugin')
# Ask llvm-config about assertion mode.
try: try:
llvm_config_cmd = subprocess.Popen( llvm_config_cmd = subprocess.Popen(
[os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'], [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'],

View File

@ -0,0 +1,3 @@
if (not 'ld_plugin' in config.available_features or
not 'X86' in config.root.targets):
config.unsupported = True

24
test/tools/gold/option.ll Normal file
View File

@ -0,0 +1,24 @@
; RUN: llvm-as %s -o %t.o
; RUN: ld -plugin %llvmshlibdir/LLVMgold.so -m elf_x86_64 \
; RUN: --plugin-opt=-jump-table-type=arity \
; RUN: --plugin-opt=-mattr=+aes \
; RUN: -shared %t.o -o %t2.o
; RUN: llvm-nm %t2.o | FileCheck %s
; CHECK: T __llvm_jump_instr_table_0_1
; CHECK: T __llvm_jump_instr_table_1_1
target triple = "x86_64-unknown-linux-gnu"
define i32 @g(i32 %a) unnamed_addr jumptable {
ret i32 %a
}
define i32 @f() unnamed_addr jumptable {
ret i32 0
}
define <2 x i64> @test_avx(<2 x i64> %a0, <2 x i64> %a1) {
%res = call <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64> %a0, <2 x i64> %a1)
ret <2 x i64> %res
}
declare <2 x i64> @llvm.x86.aesni.aesenc(<2 x i64>, <2 x i64>) nounwind readnone