[lld] 73ca96e - [ELF][test] Enhance x86-64-split-stack-prologue-adjust-success.s & non-abs-reloc.s

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 08:07:39 PDT 2020


Author: Fangrui Song
Date: 2020-08-11T08:06:36-07:00
New Revision: 73ca96ebc156daeb56d63981b316b8bf060b0d7f

URL: https://github.com/llvm/llvm-project/commit/73ca96ebc156daeb56d63981b316b8bf060b0d7f
DIFF: https://github.com/llvm/llvm-project/commit/73ca96ebc156daeb56d63981b316b8bf060b0d7f.diff

LOG: [ELF][test] Enhance x86-64-split-stack-prologue-adjust-success.s & non-abs-reloc.s

Catch problems when outSecOff is not zero and outSecOff is added twice or not added.

Added: 
    

Modified: 
    lld/test/ELF/non-abs-reloc.s
    lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/non-abs-reloc.s b/lld/test/ELF/non-abs-reloc.s
index 5b4ed27dd287..f58301b0a0a6 100644
--- a/lld/test/ELF/non-abs-reloc.s
+++ b/lld/test/ELF/non-abs-reloc.s
@@ -1,21 +1,31 @@
 // REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: ld.lld %t.o -o %t 2>&1 | FileCheck %s
-// CHECK: (.nonalloc+0x1): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
-// CHECK: (.nonalloc+0x6): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
+// RUN: split-file %s %t
+// RUN: llvm-mc -filetype=obj -triple=x86_64 %t/asm -o %t.o
+// RUN: ld.lld -T %t/lds %t.o -o %t.exe 2>&1 | FileCheck %s
+// CHECK:      warning: {{.*}}.o:(.nonalloc1+0x2): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
+// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x7): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
 
-// RUN: llvm-objdump -D %t | FileCheck --check-prefix=DISASM %s
+// RUN: llvm-objdump -D --no-show-raw-insn %t.exe | FileCheck --check-prefix=DISASM %s
 // DISASM:      Disassembly of section .nonalloc:
 // DISASM-EMPTY:
 // DISASM-NEXT: <.nonalloc>:
-// DISASM-NEXT: 0: {{.*}}  callq {{.*}} <_start>
-// DISASM-NEXT: 5: {{.*}}  callq {{.*}} <_start>
+// DISASM-NEXT:   0: nop
+// DISASM-NEXT:   1: callq 0x0
+// DISASM-NEXT:   6: callq 0x0
 
+//--- lds
+SECTIONS {
+  .nonalloc 0 : { *(.nonalloc*) }
+}
+//--- asm
 .globl _start
 _start:
   nop
 
-.section .nonalloc
+.section .nonalloc0
+  nop
+
+.section .nonalloc1
   .byte 0xe8
   .long _start - . - 4
   .byte 0xe8

diff  --git a/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s b/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s
index 69636b7803c8..1fce4fdf6b57 100644
--- a/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s
+++ b/lld/test/ELF/x86-64-split-stack-prologue-adjust-success.s
@@ -45,12 +45,12 @@ prologue2_calls_\function_to_call\register:
 	.size	prologue2_calls_\function_to_call\register,. - prologue2_calls_\function_to_call\register
 .endm
 
+	.section .text,"ax", at progbits,unique,0
 	.local foo
 foo:
-	.section .text,"ax", at progbits
 	.quad foo
 
-	.text
+	.section .text,"ax", at progbits,unique,1
 
 # For split-stack code calling split-stack code, ensure prologue v1 still
 # calls plain __morestack, and that any raw bytes written to the prologue


        


More information about the llvm-commits mailing list