[lld] 4fb49f4 - [ELF][test] Test relocations referencing symbols relative to sections discarded by /DISCARD/

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 14 14:30:51 PDT 2023


Author: Fangrui Song
Date: 2023-10-14T14:30:44-07:00
New Revision: 4fb49f44fdf558a942de2b0fc81e7f1fdf1c798c

URL: https://github.com/llvm/llvm-project/commit/4fb49f44fdf558a942de2b0fc81e7f1fdf1c798c
DIFF: https://github.com/llvm/llvm-project/commit/4fb49f44fdf558a942de2b0fc81e7f1fdf1c798c.diff

LOG: [ELF][test] Test relocations referencing symbols relative to sections discarded by /DISCARD/

Added: 
    

Modified: 
    lld/test/ELF/linkerscript/discard-section.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/linkerscript/discard-section.s b/lld/test/ELF/linkerscript/discard-section.s
index fbdff5dfbe84993..df73f715494f41d 100644
--- a/lld/test/ELF/linkerscript/discard-section.s
+++ b/lld/test/ELF/linkerscript/discard-section.s
@@ -1,14 +1,23 @@
 # REQUIRES: x86
-# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
-# RUN: echo "SECTIONS { /DISCARD/ : { *(.aaa*) } }" > %t.script
-# RUN: ld.lld -o %t1 --script %t.script %t
-# RUN: llvm-objdump --section-headers %t1 | FileCheck %s
+## Test relocations referencing symbols defined relative to sections discarded by /DISCARD/.
 
-# CHECK-NOT: .aaa
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: echo "SECTIONS { /DISCARD/ : { *(.aaa*) } }" > %t.lds
+# RUN: ld.lld -T %t.lds %t.o -z undefs -o /dev/null 2>&1 | count 0
+# RUN: ld.lld -T %t.lds %t.o -o /dev/null 2>&1 | count 0
+# RUN: ld.lld -r -T %t.lds %t.o -o /dev/null 2>&1 | count 0
+
+.globl _start
+_start:
 
 .section .aaa,"a"
-aab:
+.globl global
+.weak weak
+global:
+weak:
   .quad 0
 
 .section .zzz,"a"
-  .quad aab
+  .quad .aaa
+  .quad global
+  .quad weak


        


More information about the llvm-commits mailing list