[PATCH] D88037: [ELF][test] Make some tests' temporary files smaller

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 11:10:53 PDT 2020


MaskRay created this revision.
MaskRay added reviewers: psmith, sfertile.
Herald added subscribers: llvm-commits, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay requested review of this revision.

These tests test branch ranges and fix addresses with output section addresses.
Use two text segments to prevent LLD from filling the gap and unnecessarily increasing the output size.

Large files are cumbersome on some filesystems and can more easily trigger ENOSPC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88037

Files:
  lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
  lld/test/ELF/aarch64-thunk-script.s


Index: lld/test/ELF/aarch64-thunk-script.s
===================================================================
--- lld/test/ELF/aarch64-thunk-script.s
+++ 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: rm -rf %t && 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 @@
 /// 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
+}
Index: lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
===================================================================
--- lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
+++ lld/test/ELF/aarch64-cortex-a53-843419-thunk-range.s
@@ -1,10 +1,9 @@
 // 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
 
+//--- asm
 /// We use %(\parameter) to evaluate expression, which requires .altmacro.
  .altmacro
 
@@ -85,3 +84,13 @@
  .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
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88037.293219.patch
Type: text/x-patch
Size: 2662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200921/724d06aa/attachment.bin>


More information about the llvm-commits mailing list