mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
[ELF][test] Improve non-abs-reloc.s to test non-STT_SECTION local symbol
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
// RUN: llvm-mc -filetype=obj -triple=i386 --defsym X86_32=1 asm -o a.o
|
||||
// RUN: ld.lld -T lds a.o -o a 2>&1 | FileCheck %s --implicit-check-not=warning:
|
||||
// CHECK: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_386_PC32 against symbol '_start'
|
||||
// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_386_PC32 against symbol '_start'
|
||||
// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_386_PC32 against symbol 'ifunc'
|
||||
// CHECK-NEXT: warning: {{.*}}.o:(.nonalloc1+0xa): has non-ABS relocation R_386_PC32 against symbol ''
|
||||
|
||||
// RUN: llvm-objdump -D --no-show-raw-insn a | FileCheck --check-prefix=DISASM %s
|
||||
// DISASM: Disassembly of section .nonalloc:
|
||||
@@ -11,7 +12,7 @@
|
||||
// DISASM-NEXT: <.nonalloc>:
|
||||
// DISASM-NEXT: 0: nop
|
||||
// DISASM-NEXT: 1: call{{.}} 0x0
|
||||
// DISASM-NEXT: 6: call{{.}} 0x0
|
||||
// DISASM-NEXT: 6: call{{.}} 0x5
|
||||
|
||||
/// There is currently no error for -r. See also https://github.com/ClangBuiltLinux/linux/issues/1937
|
||||
// RUN: ld.lld -T lds -r a.o -o /dev/null --fatal-warnings
|
||||
@@ -21,7 +22,8 @@
|
||||
// RUN: llvm-objdump -D --no-show-raw-insn b | FileCheck --check-prefix=DISASM %s
|
||||
// RUN: ld.lld -T lds -r b.o -o /dev/null --fatal-warnings
|
||||
// CHECK2: warning: {{.*}}.o:(.nonalloc1+0x1): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
|
||||
// CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_X86_64_PC32 against symbol '_start'
|
||||
// CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0x6): has non-ABS relocation R_X86_64_PC32 against symbol 'ifunc'
|
||||
// CHECK2-NEXT: warning: {{.*}}.o:(.nonalloc1+0xa): has non-ABS relocation R_X86_64_PC32 against symbol ''
|
||||
|
||||
//--- lds
|
||||
SECTIONS {
|
||||
@@ -33,6 +35,10 @@ _start:
|
||||
.L0:
|
||||
nop
|
||||
|
||||
resolver: ret
|
||||
.type ifunc, @gnu_indirect_function
|
||||
.set ifunc, resolver
|
||||
|
||||
.section .nonalloc0
|
||||
nop
|
||||
|
||||
@@ -40,7 +46,8 @@ _start:
|
||||
.byte 0xe8
|
||||
.long _start - . - 4
|
||||
.byte 0xe8
|
||||
.long _start - . - 4
|
||||
.long ifunc - .
|
||||
.long .nonalloc0 - .
|
||||
|
||||
// GCC may relocate DW_AT_GNU_call_site_value with R_386_GOTOFF.
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98946
|
||||
|
||||
Reference in New Issue
Block a user