[lld] [lld][test] Precommit test for ld -r links with FatLTO PIC objects (PR #92817)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Thu May 23 11:24:50 PDT 2024


https://github.com/ilovepi updated https://github.com/llvm/llvm-project/pull/92817

>From 7ae42667cab825e3a89df9b8ebff1b37dc155f79 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 20 May 2024 13:48:00 -0700
Subject: [PATCH 1/5] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 lld/test/ELF/fatlto/fatlto.test | 41 +++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/lld/test/ELF/fatlto/fatlto.test b/lld/test/ELF/fatlto/fatlto.test
index edf4ef2da2b88..2b9c41d5f5587 100644
--- a/lld/test/ELF/fatlto/fatlto.test
+++ b/lld/test/ELF/fatlto/fatlto.test
@@ -49,6 +49,25 @@
 ; RUN: ld.lld -o %t/foo-fatLTO.archive %t/a.a %t/main-LTO.bc --fat-lto-objects
 ; RUN: cmp %t/foo-fatLTO.archive %t/foo-LTO
 
+;; Test FatLTO works with relocatable links using PIC objects
+;; Currently, with PIC relocatable links, FatLTO sections are treated as
+;; orphan sections and incorrectly concatenated together. This test verifies
+;; the current behavior, but should be fixed to either merge those sections
+;; correctly, or to drop them altogether.
+; RUN: opt < %t/a-LTO.ll -passes="embed-bitcode<thinlto;emit-summary>" | llc --relocation-model=pic --filetype=obj -o %t/a-fat-pic.o
+; RUN: llvm-readobj -S %t/a-fat-pic.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+
+; RUN: opt < %t/b-LTO.ll -passes="embed-bitcode<thinlto;emit-summary>" | llc --relocation-model=pic --filetype=obj -o %t/b-fat-pic.o
+; RUN: llvm-readobj -S %t/b-fat-pic.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+
+; RUN: llvm-ar rcs %t/fat.archive %t/a-fat-pic.o %t/b-fat-pic.o
+; RUN: llvm-readobj -S %t/fat.pic.archive | FileCheck --check-prefix=HAS_LLVM_LTO %s
+
+; RUN: ld.lld --whole-archive %t/fat.pic.archive -r -o %t/fat-relocatable.o
+; RUN: llvm-readobj -S %t/fat-pic-relocatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+
+; HAS_LLVM_LTO: Name: .llvm.lto
+
 ;--- a-LTO.ll
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
@@ -71,6 +90,28 @@ attributes #0 = { noinline nounwind uwtable }
 !5 = !{i32 1, !"ThinLTO", i32 0}
 !6 = !{i32 1, !"EnableSplitLTOUnit", i32 1}
 
+;--- b-LTO.ll
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+; Function Attrs: noinline nounwind uwtable
+define dso_local i32 @foo() #0 {
+entry:
+  ret i32 0
+}
+
+attributes #0 = { noinline nounwind uwtable }
+
+!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6}
+
+!0 = !{i32 1, !"wchar_size", i32 4}
+!1 = !{i32 7, !"PIC Level", i32 2}
+!2 = !{i32 7, !"PIE Level", i32 2}
+!3 = !{i32 7, !"uwtable", i32 2}
+!4 = !{i32 7, !"frame-pointer", i32 2}
+!5 = !{i32 1, !"ThinLTO", i32 0}
+!6 = !{i32 1, !"EnableSplitLTOUnit", i32 1}
+
 ;--- main-LTO.ll
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

>From c09de94c31e087cd812646db107d91b360abf35f Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Mon, 20 May 2024 14:10:46 -0700
Subject: [PATCH 2/5] Fix filename in RUN line

Created using spr 1.3.4
---
 lld/test/ELF/fatlto/fatlto.test | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lld/test/ELF/fatlto/fatlto.test b/lld/test/ELF/fatlto/fatlto.test
index 2b9c41d5f5587..e250325dc54f4 100644
--- a/lld/test/ELF/fatlto/fatlto.test
+++ b/lld/test/ELF/fatlto/fatlto.test
@@ -60,10 +60,10 @@
 ; RUN: opt < %t/b-LTO.ll -passes="embed-bitcode<thinlto;emit-summary>" | llc --relocation-model=pic --filetype=obj -o %t/b-fat-pic.o
 ; RUN: llvm-readobj -S %t/b-fat-pic.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
-; RUN: llvm-ar rcs %t/fat.archive %t/a-fat-pic.o %t/b-fat-pic.o
+; RUN: llvm-ar rcs %t/fat.pic.archive %t/a-fat-pic.o %t/b-fat-pic.o
 ; RUN: llvm-readobj -S %t/fat.pic.archive | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
-; RUN: ld.lld --whole-archive %t/fat.pic.archive -r -o %t/fat-relocatable.o
+; RUN: ld.lld --whole-archive %t/fat.pic.archive -r -o %t/fat-pic-relocatable.o
 ; RUN: llvm-readobj -S %t/fat-pic-relocatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
 ; HAS_LLVM_LTO: Name: .llvm.lto

>From 44140c19f3fdf9ea2a747b331fe266c745d935a4 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Tue, 21 May 2024 09:52:37 -0700
Subject: [PATCH 3/5] Reuse existing objects in test

Created using spr 1.3.4
---
 lld/test/ELF/fatlto/fatlto.test | 40 +++++----------------------------
 1 file changed, 6 insertions(+), 34 deletions(-)

diff --git a/lld/test/ELF/fatlto/fatlto.test b/lld/test/ELF/fatlto/fatlto.test
index e250325dc54f4..f654d4ad060f3 100644
--- a/lld/test/ELF/fatlto/fatlto.test
+++ b/lld/test/ELF/fatlto/fatlto.test
@@ -4,11 +4,11 @@
 ; RUN: rm -rf %t && split-file %s %t
 
 ;; Ensure that input files contain .llvm.lto section.
-; RUN: llc %t/a-LTO.ll --filetype=obj -o %t/a-fatLTO.o
+; RUN: llc %t/a-LTO.ll --filetype=obj -o %t/a-fatLTO.o --relocation-model=pic
 ; RUN: opt < %t/a-LTO.ll --module-summary -o %t/a-fatLTO.bc
 ; RUN: llvm-objcopy --add-section=.llvm.lto=%t/a-fatLTO.bc --set-section-flags=.llvm.lto=exclude %t/a-fatLTO.o
 
-; RUN: llc %t/main-LTO.ll --filetype=obj -o %t/main-fatLTO.o
+; RUN: llc %t/main-LTO.ll --filetype=obj -o %t/main-fatLTO.o --relocation-model=pic
 ; RUN: opt < %t/main-LTO.ll --module-summary -o %t/main-fatLTO.bc
 ; RUN: llvm-objcopy --add-section=.llvm.lto=%t/main-fatLTO.bc --set-section-flags=.llvm.lto=exclude %t/main-fatLTO.o
 
@@ -54,17 +54,11 @@
 ;; orphan sections and incorrectly concatenated together. This test verifies
 ;; the current behavior, but should be fixed to either merge those sections
 ;; correctly, or to drop them altogether.
-; RUN: opt < %t/a-LTO.ll -passes="embed-bitcode<thinlto;emit-summary>" | llc --relocation-model=pic --filetype=obj -o %t/a-fat-pic.o
-; RUN: llvm-readobj -S %t/a-fat-pic.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-ar rcs %t/fatLTO-pic.a %t/a-fatLTO.o %t/main-fatLTO.o
+; RUN: llvm-readobj -S %t/fatLTO-pic.a | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
-; RUN: opt < %t/b-LTO.ll -passes="embed-bitcode<thinlto;emit-summary>" | llc --relocation-model=pic --filetype=obj -o %t/b-fat-pic.o
-; RUN: llvm-readobj -S %t/b-fat-pic.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
-
-; RUN: llvm-ar rcs %t/fat.pic.archive %t/a-fat-pic.o %t/b-fat-pic.o
-; RUN: llvm-readobj -S %t/fat.pic.archive | FileCheck --check-prefix=HAS_LLVM_LTO %s
-
-; RUN: ld.lld --whole-archive %t/fat.pic.archive -r -o %t/fat-pic-relocatable.o
-; RUN: llvm-readobj -S %t/fat-pic-relocatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: ld.lld --whole-archive %t/fatLTO-pic.a -r -o %t/fatLTO-pic-reolcatable.o
+; RUN: llvm-readobj -S %t/fatLTO-pic-reolcatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
 ; HAS_LLVM_LTO: Name: .llvm.lto
 
@@ -90,28 +84,6 @@ attributes #0 = { noinline nounwind uwtable }
 !5 = !{i32 1, !"ThinLTO", i32 0}
 !6 = !{i32 1, !"EnableSplitLTOUnit", i32 1}
 
-;--- b-LTO.ll
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-unknown-linux-gnu"
-
-; Function Attrs: noinline nounwind uwtable
-define dso_local i32 @foo() #0 {
-entry:
-  ret i32 0
-}
-
-attributes #0 = { noinline nounwind uwtable }
-
-!llvm.module.flags = !{!0, !1, !2, !3, !4, !5, !6}
-
-!0 = !{i32 1, !"wchar_size", i32 4}
-!1 = !{i32 7, !"PIC Level", i32 2}
-!2 = !{i32 7, !"PIE Level", i32 2}
-!3 = !{i32 7, !"uwtable", i32 2}
-!4 = !{i32 7, !"frame-pointer", i32 2}
-!5 = !{i32 1, !"ThinLTO", i32 0}
-!6 = !{i32 1, !"EnableSplitLTOUnit", i32 1}
-
 ;--- main-LTO.ll
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

>From cded743e3a2b301e41227b2f2e406a9fbfeff264 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Thu, 23 May 2024 11:05:37 -0700
Subject: [PATCH 4/5] Update test to use llvm-readelf

Created using spr 1.3.4
---
 lld/test/ELF/fatlto/fatlto.test | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/lld/test/ELF/fatlto/fatlto.test b/lld/test/ELF/fatlto/fatlto.test
index 0c88c63d6f339..5c58763a98c28 100644
--- a/lld/test/ELF/fatlto/fatlto.test
+++ b/lld/test/ELF/fatlto/fatlto.test
@@ -13,32 +13,37 @@
 ; RUN: opt < %t/main-LTO.ll --module-summary -o %t/main-fatLTO.bc
 ; RUN: llvm-objcopy --add-section=.llvm.lto=%t/main-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c %t/main-fatLTO.o
 
-; RUN: llvm-readobj -S %t/a-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
-; RUN: llvm-readobj -S %t/main-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-readelf -S %t/a-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-readelf -S %t/main-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
 ;; Make sure that the section flags are set correctly
-; HAS_LLVM_LTO: Name: .llvm.lto
-; HAS_LLVM_LTO-NEXT: Type: SHT_LLVM_LTO
-; HAS_LLVM_LTO-NEXT: Flags
-; HAS_LLVM_LTO-NEXT: SHF_EXCLUDE
+; HA_LLVM_LTO: Name: .llvm.lto
+; HA_LLVM_LTO-NEXT: Type: SHT_LLVM_LTO
+; HA_LLVM_LTO-NEXT: Flags
+; HA_LLVM_LTO-NEXT: SHF_EXCLUDE
+
+; HAS_LLVM_LTO: Name Type Address Off Size ES Flg Lk Inf Al
+; HAS_LLVM_LTO: .llvm.lto LLVM_LTO {{.*}} 00  WE  0   0  1
 
 ;; Final executable should not have .llvm.lto section no matter what the target is.
 ; RUN: ld.lld -o %t/foo-fatLTO %t/a-fatLTO.o %t/main-fatLTO.o --fat-lto-objects
-; RUN: llvm-readobj -S %t/foo-fatLTO | FileCheck --check-prefix=CHECK-LTO-TARGET %s
+; RUN: llvm-readelf -S %t/foo-fatLTO | FileCheck --check-prefix=CHECK-LTO-TARGET %s
 
 ;; Check that fat objects work w/ --start-lib.
 ; RUN: ld.lld -o %t/foo-fatLTO.start_lib --start-lib %t/a-fatLTO.o %t/main-fatLTO.o --fat-lto-objects
-; RUN: llvm-readobj -S %t/foo-fatLTO.start_lib | FileCheck --check-prefix=CHECK-LTO-TARGET %s
+; RUN: llvm-readelf -S %t/foo-fatLTO.start_lib | FileCheck --check-prefix=CHECK-LTO-TARGET %s
 
 ;; Check if .llvm.lto section gets aggregated in LTO target.
-; CHECK-LTO-TARGET-NOT: Name: .llvm.lto
+; CHECK-LTO-TARGET: Name Type Address Off Size ES Flg Lk Inf Al
+; CHECK-LTO-TARGET-NOT: .llvm.lto
 
 ;; Final executable should not have .llvm.lto section no matter what the target is.
 ; RUN: ld.lld -o %t/foo-fatNoLTO %t/a-fatLTO.o %/t/main-fatLTO.o
-; RUN: llvm-readobj -S %t/foo-fatNoLTO | FileCheck --check-prefix=CHECK-NON-LTO-TARGET %s
+; RUN: llvm-readelf -S %t/foo-fatNoLTO | FileCheck --check-prefix=CHECK-NON-LTO-TARGET %s
 
 ;; Check if .llvm.lto section gets aggregated in non-LTO target.
-; CHECK-NON-LTO-TARGET-NOT: Name: .llvm.lto
+; CHECK-NON-LTO-TARGET: Name Type Address Off Size ES Flg Lk Inf Al
+; CHECK-NON-LTO-TARGET-NOT: .llvm.lto
 
 ;; Check if the LTO target executable produced from FatLTO object file is
 ;; identical to the one produced from LTO modules.
@@ -65,10 +70,10 @@
 ;; the current behavior, but should be fixed to either merge those sections
 ;; correctly, or to drop them altogether.
 ; RUN: llvm-ar rcs %t/fatLTO-pic.a %t/a-fatLTO.o %t/main-fatLTO.o
-; RUN: llvm-readobj -S %t/fatLTO-pic.a | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-readelf -S %t/fatLTO-pic.a | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
 ; RUN: ld.lld --whole-archive %t/fatLTO-pic.a -r -o %t/fatLTO-pic-reolcatable.o
-; RUN: llvm-readobj -S %t/fatLTO-pic-reolcatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-readelf -S %t/fatLTO-pic-reolcatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
 ;--- a-LTO.ll
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

>From 8318fad716c02f228da0237739350f51bb2df8e3 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Thu, 23 May 2024 11:24:36 -0700
Subject: [PATCH 5/5] CD into temp dir

Created using spr 1.3.4
---
 lld/test/ELF/fatlto/fatlto.test | 60 ++++++++++++++++-----------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/lld/test/ELF/fatlto/fatlto.test b/lld/test/ELF/fatlto/fatlto.test
index 5c58763a98c28..ed137087746e9 100644
--- a/lld/test/ELF/fatlto/fatlto.test
+++ b/lld/test/ELF/fatlto/fatlto.test
@@ -1,20 +1,20 @@
 ;; Basic FatLTO tests.
 ; REQUIRES: x86
 
-; RUN: rm -rf %t && split-file %s %t
+; RUN: rm -rf %t && split-file %s %t && cd %t
 
 ;; Ensure that input files contain .llvm.lto section.
-; RUN: llc %t/a-LTO.ll --filetype=obj -o %t/a-fatLTO.o --relocation-model=pic
-; RUN: opt < %t/a-LTO.ll --module-summary -o %t/a-fatLTO.bc
-; RUN: llvm-objcopy --add-section=.llvm.lto=%t/a-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c %t/a-fatLTO.o
+; RUN: llc a-LTO.ll --filetype=obj -o a-fatLTO.o --relocation-model=pic
+; RUN: opt < a-LTO.ll --module-summary -o a-fatLTO.bc
+; RUN: llvm-objcopy --add-section=.llvm.lto=a-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c a-fatLTO.o
 
 
-; RUN: llc %t/main-LTO.ll --filetype=obj -o %t/main-fatLTO.o --relocation-model=pic
-; RUN: opt < %t/main-LTO.ll --module-summary -o %t/main-fatLTO.bc
-; RUN: llvm-objcopy --add-section=.llvm.lto=%t/main-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c %t/main-fatLTO.o
+; RUN: llc main-LTO.ll --filetype=obj -o main-fatLTO.o --relocation-model=pic
+; RUN: opt < main-LTO.ll --module-summary -o main-fatLTO.bc
+; RUN: llvm-objcopy --add-section=.llvm.lto=main-fatLTO.bc --set-section-flags=.llvm.lto=exclude --set-section-type=.llvm.lto=0x6fff4c0c main-fatLTO.o
 
-; RUN: llvm-readelf -S %t/a-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
-; RUN: llvm-readelf -S %t/main-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-readelf -S a-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-readelf -S main-fatLTO.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
 ;; Make sure that the section flags are set correctly
 ; HA_LLVM_LTO: Name: .llvm.lto
@@ -26,20 +26,20 @@
 ; HAS_LLVM_LTO: .llvm.lto LLVM_LTO {{.*}} 00  WE  0   0  1
 
 ;; Final executable should not have .llvm.lto section no matter what the target is.
-; RUN: ld.lld -o %t/foo-fatLTO %t/a-fatLTO.o %t/main-fatLTO.o --fat-lto-objects
-; RUN: llvm-readelf -S %t/foo-fatLTO | FileCheck --check-prefix=CHECK-LTO-TARGET %s
+; RUN: ld.lld -o foo-fatLTO a-fatLTO.o main-fatLTO.o --fat-lto-objects
+; RUN: llvm-readelf -S foo-fatLTO | FileCheck --check-prefix=CHECK-LTO-TARGET %s
 
 ;; Check that fat objects work w/ --start-lib.
-; RUN: ld.lld -o %t/foo-fatLTO.start_lib --start-lib %t/a-fatLTO.o %t/main-fatLTO.o --fat-lto-objects
-; RUN: llvm-readelf -S %t/foo-fatLTO.start_lib | FileCheck --check-prefix=CHECK-LTO-TARGET %s
+; RUN: ld.lld -o foo-fatLTO.start_lib --start-lib a-fatLTO.o main-fatLTO.o --fat-lto-objects
+; RUN: llvm-readelf -S foo-fatLTO.start_lib | FileCheck --check-prefix=CHECK-LTO-TARGET %s
 
 ;; Check if .llvm.lto section gets aggregated in LTO target.
 ; CHECK-LTO-TARGET: Name Type Address Off Size ES Flg Lk Inf Al
 ; CHECK-LTO-TARGET-NOT: .llvm.lto
 
 ;; Final executable should not have .llvm.lto section no matter what the target is.
-; RUN: ld.lld -o %t/foo-fatNoLTO %t/a-fatLTO.o %/t/main-fatLTO.o
-; RUN: llvm-readelf -S %t/foo-fatNoLTO | FileCheck --check-prefix=CHECK-NON-LTO-TARGET %s
+; RUN: ld.lld -o foo-fatNoLTO a-fatLTO.o %/t/main-fatLTO.o
+; RUN: llvm-readelf -S foo-fatNoLTO | FileCheck --check-prefix=CHECK-NON-LTO-TARGET %s
 
 ;; Check if .llvm.lto section gets aggregated in non-LTO target.
 ; CHECK-NON-LTO-TARGET: Name Type Address Off Size ES Flg Lk Inf Al
@@ -47,33 +47,33 @@
 
 ;; Check if the LTO target executable produced from FatLTO object file is
 ;; identical to the one produced from LTO modules.
-; RUN: opt < %t/a-LTO.ll --module-summary -o %t/a-LTO.bc
-; RUN: opt < %t/main-LTO.ll --module-summary -o %t/main-LTO.bc
-; RUN: ld.lld -o %t/foo-LTO %t/a-LTO.bc %t/main-LTO.bc
-; RUN: cmp %t/foo-fatLTO %t/foo-LTO
+; RUN: opt < a-LTO.ll --module-summary -o a-LTO.bc
+; RUN: opt < main-LTO.ll --module-summary -o main-LTO.bc
+; RUN: ld.lld -o foo-LTO a-LTO.bc main-LTO.bc
+; RUN: cmp foo-fatLTO foo-LTO
 
 ;; Check if the no-LTO target executable produced from FatLTO object file is
 ;; identical to the one produced from regular object files.
-; RUN: llc %t/a-LTO.ll --filetype=obj -o %t/a.o
-; RUN: llc %t/main-LTO.ll --filetype=obj -o %t/main.o
-; RUN: ld.lld -o %t/foo-noLTO %t/a.o %t/main.o
-; RUN: cmp %t/foo-fatNoLTO %t/foo-noLTO
+; RUN: llc a-LTO.ll --filetype=obj -o a.o
+; RUN: llc main-LTO.ll --filetype=obj -o main.o
+; RUN: ld.lld -o foo-noLTO a.o main.o
+; RUN: cmp foo-fatNoLTO foo-noLTO
 
 ;; Check archive support.
-; RUN: llvm-ar rcs %t/a.a %t/a-fatLTO.o 
-; RUN: ld.lld -o %t/foo-fatLTO.archive %t/a.a %t/main-LTO.bc --fat-lto-objects
-; RUN: cmp %t/foo-fatLTO.archive %t/foo-LTO
+; RUN: llvm-ar rcs a.a a-fatLTO.o 
+; RUN: ld.lld -o foo-fatLTO.archive a.a main-LTO.bc --fat-lto-objects
+; RUN: cmp foo-fatLTO.archive foo-LTO
 
 ;; Test FatLTO works with relocatable links using PIC objects
 ;; Currently, with PIC relocatable links, FatLTO sections are treated as
 ;; orphan sections and incorrectly concatenated together. This test verifies
 ;; the current behavior, but should be fixed to either merge those sections
 ;; correctly, or to drop them altogether.
-; RUN: llvm-ar rcs %t/fatLTO-pic.a %t/a-fatLTO.o %t/main-fatLTO.o
-; RUN: llvm-readelf -S %t/fatLTO-pic.a | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: llvm-ar rcs fatLTO-pic.a a-fatLTO.o main-fatLTO.o
+; RUN: llvm-readelf -S fatLTO-pic.a | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
-; RUN: ld.lld --whole-archive %t/fatLTO-pic.a -r -o %t/fatLTO-pic-reolcatable.o
-; RUN: llvm-readelf -S %t/fatLTO-pic-reolcatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
+; RUN: ld.lld --whole-archive fatLTO-pic.a -r -o fatLTO-pic-reolcatable.o
+; RUN: llvm-readelf -S fatLTO-pic-reolcatable.o | FileCheck --check-prefix=HAS_LLVM_LTO %s
 
 ;--- a-LTO.ll
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"



More information about the llvm-commits mailing list