[lld] 561b98f - [ELF][test] Improve non-abs-reloc.s to test non-STT_SECTION local symbol
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 14:40:37 PDT 2023
Author: Fangrui Song
Date: 2023-09-20T14:40:32-07:00
New Revision: 561b98f9e025363b416f4e89af750d01d1e8c4cc
URL: https://github.com/llvm/llvm-project/commit/561b98f9e025363b416f4e89af750d01d1e8c4cc
DIFF: https://github.com/llvm/llvm-project/commit/561b98f9e025363b416f4e89af750d01d1e8c4cc.diff
LOG: [ELF][test] Improve non-abs-reloc.s to test non-STT_SECTION local symbol
Added:
Modified:
lld/test/ELF/non-abs-reloc.s
Removed:
################################################################################
diff --git a/lld/test/ELF/non-abs-reloc.s b/lld/test/ELF/non-abs-reloc.s
index 2212421c2373df6..04f583ab253472d 100644
--- a/lld/test/ELF/non-abs-reloc.s
+++ b/lld/test/ELF/non-abs-reloc.s
@@ -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
More information about the llvm-commits
mailing list