[lld] 6d637fa - [ELF][test] Delete large temporary files and make some temporary files smaller with two text segments
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 12:09:26 PDT 2020
Author: Fangrui Song
Date: 2020-09-21T12:09:17-07:00
New Revision: 6d637fa560f0196b93e377b98489661ecd7a1af0
URL: https://github.com/llvm/llvm-project/commit/6d637fa560f0196b93e377b98489661ecd7a1af0
DIFF: https://github.com/llvm/llvm-project/commit/6d637fa560f0196b93e377b98489661ecd7a1af0.diff
LOG: [ELF][test] Delete large temporary files and make some temporary files smaller with two text segments
Large files are cumbersome on some filesystems and can more easily trigger ENOSPC.
Some tests use two text sections with output section addresses to test branch ranges.
Use two text segments to prevent LLD from filling the gap and unnecessarily increasing the output size.
With this change, there is no test/ELF temporary file larger than 100MiB.
Reviewed By: psmith
Differential Revision: https://reviews.llvm.org/D88037
Added:
Modified:
lld/test/ELF/aarch64-cortex-a53-843419-large.s
lld/test/ELF/aarch64-cortex-a53-843419-large2.s
lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
lld/test/ELF/aarch64-thunk-pi.s
lld/test/ELF/aarch64-thunk-script.s
lld/test/ELF/aarch64-thunk-section-location.s
lld/test/ELF/arm-thumb-plt-range-thunk-os.s
Removed:
################################################################################
diff --git a/lld/test/ELF/aarch64-cortex-a53-843419-large.s b/lld/test/ELF/aarch64-cortex-a53-843419-large.s
index fcce9cd1a232..35b25323d415 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-large.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-large.s
@@ -8,6 +8,7 @@
// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=102842376 --stop-address=102842392 | FileCheck --check-prefix=CHECK5 %s
// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=136384524 --stop-address=136384528 | FileCheck --check-prefix=CHECK6 %s
// RUN: llvm-objdump --triple=aarch64-linux-gnu -d %t2 --start-address=136388604 --stop-address=136388628 | FileCheck --check-prefix=CHECK7 %s
+// RUN: rm %t.o %t2
// Test case for Cortex-A53 Erratum 843419 in an OutputSection exceeding
// the maximum branch range. Both range extension thunks and patches are
// required.
diff --git a/lld/test/ELF/aarch64-cortex-a53-843419-large2.s b/lld/test/ELF/aarch64-cortex-a53-843419-large2.s
index 643e97dcf472..a8337fc1073d 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-large2.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-large2.s
@@ -2,6 +2,8 @@
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
// RUN: ld.lld --fix-cortex-a53-843419 -Ttext=0x8000000 %t.o -o %t2
// RUN: llvm-objdump -d --start-address=0x8001000 --stop-address=0x8001004 %t2 | FileCheck %s
+/// The temporary files are more than 128MiB. Delete them early.
+// RUN: rm %t.o %t2
.section .text.01, "ax", %progbits
.balign 4096
diff --git a/lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s b/lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
index 64658d37efdf..fb72dfc89695 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
@@ -1,10 +1,11 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux --asm-macro-max-nesting-depth=40000 %s -o %t.o
-// RUN: echo "SECTIONS { \
-// RUN: .text1 0x10000 : { *(.text.*) } \
-// RUN: .text2 0xf010000 : { *(.target) } } " > %t.script
-// RUN: ld.lld --script %t.script -fix-cortex-a53-843419 %t.o -o %t2 --print-map 2>&1 | FileCheck %s
+// RUN: split-file %s %t
+// RUN: llvm-mc -filetype=obj -triple=aarch64 --asm-macro-max-nesting-depth=40000 %t/asm -o %t.o
+// RUN: ld.lld -T %t/lds -fix-cortex-a53-843419 %t.o -o %t2 --print-map 2>&1 | FileCheck %s
+/// %t2 is more than 128MiB. Delete it early.
+// RUN: rm %t.o %t2
+//--- asm
/// We use %(\parameter) to evaluate expression, which requires .altmacro.
.altmacro
@@ -85,3 +86,13 @@ far\from:
.global dat1
dat1:
.xword 0
+
+//--- lds
+PHDRS {
+ low PT_LOAD FLAGS(0x1 | 0x4);
+ high PT_LOAD FLAGS(0x1 | 0x4);
+}
+SECTIONS {
+ .text1 0x10000 : { *(.text.*) } :low
+ .text2 0xf010000 : { *(.target) } :high
+}
diff --git a/lld/test/ELF/aarch64-thunk-pi.s b/lld/test/ELF/aarch64-thunk-pi.s
index 7586344c75c4..50322c524046 100644
--- a/lld/test/ELF/aarch64-thunk-pi.s
+++ b/lld/test/ELF/aarch64-thunk-pi.s
@@ -1,13 +1,12 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
-// RUN: echo "SECTIONS { \
-// RUN: .text_low : { *(.text_low) } \
-// RUN: .text_high 0x10000000 : { *(.text_high) } \
-// RUN: } " > %t.script
-// RUN: ld.lld --script %t.script --shared %t.o -o %t.so 2>&1
+// RUN: split-file %s %t
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %t/asm -o %t.o
+// RUN: ld.lld --script %t/lds --shared %t.o -o %t.so 2>&1
// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t.so | FileCheck %s
// Check that Position Independent thunks are generated for shared libraries.
+
+//--- asm
.section .text_low, "ax", %progbits
.globl low_target
.type low_target, %function
@@ -102,3 +101,13 @@ high_target2:
// CHECK-NEXT: ldr x17, [x16, #0x130]
// CHECK-NEXT: add x16, x16, #0x130
// CHECK-NEXT: br x17
+
+//--- lds
+PHDRS {
+ low PT_LOAD FLAGS(0x1 | 0x4);
+ high PT_LOAD FLAGS(0x1 | 0x4);
+}
+SECTIONS {
+ .text_low : { *(.text_low) } :low
+ .text_high 0x10000000 : { *(.text_high) } :high
+}
diff --git a/lld/test/ELF/aarch64-thunk-script.s b/lld/test/ELF/aarch64-thunk-script.s
index 0c376b1553a2..4e48ff44c036 100644
--- a/lld/test/ELF/aarch64-thunk-script.s
+++ b/lld/test/ELF/aarch64-thunk-script.s
@@ -1,13 +1,11 @@
// REQUIRES: aarch64
-// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
-// RUN: echo "SECTIONS { \
-// RUN: .text_low 0x2000: { *(.text_low) } \
-// RUN: .text_high 0x8002000 : { *(.text_high) } \
-// RUN: } " > %t.script
-// RUN: ld.lld --script %t.script %t.o -o %t
-// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t | FileCheck %s
-// RUN: llvm-nm --no-sort --special-syms %t | FileCheck --check-prefix=NM %s
+// RUN: split-file %s %t
+// RUN: llvm-mc -filetype=obj -triple=aarch64 %t/asm -o %t.o
+// RUN: ld.lld --script %t/lds %t.o -o %t/out
+// RUN: llvm-objdump -d --no-show-raw-insn --print-imm-hex %t/out | FileCheck %s
+// RUN: llvm-nm --no-sort --special-syms %t/out | FileCheck --check-prefix=NM %s
+//--- asm
// Check that we have the out of branch range calculation right. The immediate
// field is signed so we have a slightly higher negative displacement.
.section .text_low, "ax", %progbits
@@ -65,3 +63,13 @@ high_target:
/// Global symbols.
// NM-NEXT: T _start
// NM-NEXT: T high_target
+
+//--- lds
+PHDRS {
+ low PT_LOAD FLAGS(0x1 | 0x4);
+ high PT_LOAD FLAGS(0x1 | 0x4);
+}
+SECTIONS {
+ .text_low 0x2000: { *(.text_low) } :low
+ .text_high 0x8002000 : { *(.text_high) } :high
+}
diff --git a/lld/test/ELF/aarch64-thunk-section-location.s b/lld/test/ELF/aarch64-thunk-section-location.s
index 1579f609e32d..82ced3ab2fa4 100644
--- a/lld/test/ELF/aarch64-thunk-section-location.s
+++ b/lld/test/ELF/aarch64-thunk-section-location.s
@@ -2,6 +2,7 @@
// RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %s -o %t.o
// RUN: ld.lld %t.o -o %t
// RUN: llvm-objdump -d --start-address=0x81d1008 --stop-address=0x81d1014 --no-show-raw-insn %t | FileCheck %s
+// RUN: rm %t.o %t
// Check that the range extension thunks are dumped close to the aarch64 branch
// range of 128 MiB
.section .text.1, "ax", %progbits
diff --git a/lld/test/ELF/arm-thumb-plt-range-thunk-os.s b/lld/test/ELF/arm-thumb-plt-range-thunk-os.s
index 3c61ca1a54bd..0a84b32cdcd3 100644
--- a/lld/test/ELF/arm-thumb-plt-range-thunk-os.s
+++ b/lld/test/ELF/arm-thumb-plt-range-thunk-os.s
@@ -7,6 +7,7 @@
// RUN: llvm-objdump -d %t.so --start-address=0x2800004 --stop-address=0x2800034 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK2 %s
// RUN: llvm-objdump -d %t.so --start-address=0x4000000 --stop-address=0x4000010 --triple=thumbv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK3 %s
// RUN: llvm-objdump -d %t.so --start-address=0x4000010 --stop-address=0x4000100 --triple=armv7a-linux-gnueabihf | FileCheck --check-prefix=CHECK4 %s
+// RUN: rm %t.so
.syntax unified
.thumb
More information about the llvm-commits
mailing list