[lld] 360718f - [test] Improve symbol-location.s to check --defsym

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 11:22:25 PST 2024


Author: Fangrui Song
Date: 2024-11-24T11:22:19-08:00
New Revision: 360718fb90cb60572c210ed4fa671128232cf3ba

URL: https://github.com/llvm/llvm-project/commit/360718fb90cb60572c210ed4fa671128232cf3ba
DIFF: https://github.com/llvm/llvm-project/commit/360718fb90cb60572c210ed4fa671128232cf3ba.diff

LOG: [test] Improve symbol-location.s to check --defsym

Added: 
    

Modified: 
    lld/test/ELF/linkerscript/symbol-location.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/linkerscript/symbol-location.s b/lld/test/ELF/linkerscript/symbol-location.s
index 4620982bf3f206..fd5cc9de048f1d 100644
--- a/lld/test/ELF/linkerscript/symbol-location.s
+++ b/lld/test/ELF/linkerscript/symbol-location.s
@@ -2,6 +2,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
 # RUN: echo 'foo = _start;' > %t.script
 # RUN: not ld.lld -shared -T %t.script %t.o -o /dev/null 2>&1 | FileCheck %s
+# RUN: not ld.lld -shared --defsym 'foo = _start' %t.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK2
 
 ## Here we check that symbol 'foo' location is reported properly.
 
@@ -9,6 +10,10 @@
 # CHECK: >>> defined in {{.*}}.script:1
 # CHECK: >>> referenced by {{.*}}.o:(.text+0x1)
 
+# CHECK2: error: relocation R_X86_64_PC32 cannot be used against symbol 'foo'
+# CHECK2: >>> defined in --defsym{{$}}
+# CHECK2: >>> referenced by {{.*}}.o:(.text+0x1)
+
 .text
 .globl _start
 _start:


        


More information about the llvm-commits mailing list