[llvm] r276860 - [test/gold] Add gold test subdirectory tests needing v1.12 (or higher)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 05:59:52 PDT 2016


Author: tejohnson
Date: Wed Jul 27 07:59:51 2016
New Revision: 276860

URL: http://llvm.org/viewvc/llvm-project?rev=276860&view=rev
Log:
[test/gold] Add gold test subdirectory tests needing v1.12 (or higher)

Summary:
As discussed in the review for D22677, added a subdirectory to
enable tests that require at least version 1.12 of gold.

Add an initial test requiring this version.

Reviewers: davidxl, mehdi_amini

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D22827

Added:
    llvm/trunk/test/tools/gold/X86/v1.12/
    llvm/trunk/test/tools/gold/X86/v1.12/Inputs/
    llvm/trunk/test/tools/gold/X86/v1.12/Inputs/thinlto_emit_linked_objects.ll
    llvm/trunk/test/tools/gold/X86/v1.12/lit.local.cfg
    llvm/trunk/test/tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll

Added: llvm/trunk/test/tools/gold/X86/v1.12/Inputs/thinlto_emit_linked_objects.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/v1.12/Inputs/thinlto_emit_linked_objects.ll?rev=276860&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/v1.12/Inputs/thinlto_emit_linked_objects.ll (added)
+++ llvm/trunk/test/tools/gold/X86/v1.12/Inputs/thinlto_emit_linked_objects.ll Wed Jul 27 07:59:51 2016
@@ -0,0 +1,7 @@
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @foo() {
+entry:
+  ret void
+}

Added: llvm/trunk/test/tools/gold/X86/v1.12/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/v1.12/lit.local.cfg?rev=276860&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/v1.12/lit.local.cfg (added)
+++ llvm/trunk/test/tools/gold/X86/v1.12/lit.local.cfg Wed Jul 27 07:59:51 2016
@@ -0,0 +1,26 @@
+import re
+import subprocess
+
+def is_gold_v1_12_linker_available():
+
+  if not config.gold_executable:
+    return False
+  try:
+    ld_cmd = subprocess.Popen([config.gold_executable, '-v'], stdout = subprocess.PIPE)
+    ld_out = ld_cmd.stdout.read().decode()
+    ld_cmd.wait()
+  except:
+    return False
+
+  match = re.search(r'GNU gold \(.*\) (\d+)\.(\d+)', ld_out)
+  if not match:
+    return False
+  major = int(match.group(1))
+  minor = int(match.group(2))
+  if major < 1 or (major == 1 and minor < 12):
+    return False
+
+  return True
+
+if not is_gold_v1_12_linker_available():
+  config.unsupported = True

Added: llvm/trunk/test/tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll?rev=276860&view=auto
==============================================================================
--- llvm/trunk/test/tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll (added)
+++ llvm/trunk/test/tools/gold/X86/v1.12/thinlto_emit_linked_objects.ll Wed Jul 27 07:59:51 2016
@@ -0,0 +1,30 @@
+; First generate bitcode with a module summary index for each file
+; RUN: opt -module-summary %s -o %t.o
+; RUN: opt -module-summary %p/Inputs/thinlto_emit_linked_objects.ll -o %t2.o
+
+; Next do the ThinLink step, specifying thinlto-index-only so that the gold
+; plugin exits after generating individual indexes. The objects the linker
+; decided to include in the link should be emitted into the file specified
+; after 'thinlto-index-only='. In this version of the test, only %t.o will
+; be included in the link, and not %t2.o since it is within
+; a library (--start-lib/--end-lib pair) and not strongly referenced.
+; Note that the support for detecting this is in gold v1.12.
+; RUN: %gold -plugin %llvmshlibdir/LLVMgold.so \
+; RUN:    --plugin-opt=thinlto \
+; RUN:    --plugin-opt=thinlto-index-only=%t3 \
+; RUN:    -m elf_x86_64 \
+; RUN:    -o %t4 \
+; RUN:    %t.o \
+; RUN:    --start-lib %t2.o --end-lib
+
+; RUN: cat %t3 | FileCheck %s
+; CHECK: thinlto_emit_linked_objects.ll.tmp.o
+; CHECK-NOT: thinlto_emit_linked_objects.ll.tmp2.o
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define i32 @main() {
+entry:
+  ret i32 0
+}




More information about the llvm-commits mailing list