[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.
This commit is contained in:
Fangrui Song 2020-08-10 08:52:16 -07:00
parent dbc468dc31
commit 73ca96ebc1
2 changed files with 20 additions and 10 deletions

View File

@ -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

View File

@ -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",@progbits,unique,0
.local foo
foo:
.section .text,"ax",@progbits
.quad foo
.text
.section .text,"ax",@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