[lld] 6fa8f7b - [ELF][test] Test that .o definition does not inherit .so STV_PROTECTED

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 26 15:00:16 PST 2021


Author: Fangrui Song
Date: 2021-11-26T15:00:10-08:00
New Revision: 6fa8f7beb1928dfad291314c8baf16374a1cc145

URL: https://github.com/llvm/llvm-project/commit/6fa8f7beb1928dfad291314c8baf16374a1cc145
DIFF: https://github.com/llvm/llvm-project/commit/6fa8f7beb1928dfad291314c8baf16374a1cc145.diff

LOG: [ELF][test] Test that .o definition does not inherit .so STV_PROTECTED

Test %t2.so %t.o beside %t.o %t2.so

Added: 
    

Modified: 
    lld/test/ELF/protected-shared.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/protected-shared.s b/lld/test/ELF/protected-shared.s
index 9406b36b650c3..5fed37f9838d3 100644
--- a/lld/test/ELF/protected-shared.s
+++ b/lld/test/ELF/protected-shared.s
@@ -1,52 +1,26 @@
-// REQUIRES: x86
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
-// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/protected-shared.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: ld.lld %t.o %t2.so -o %t
-// RUN: llvm-readobj --symbols --dyn-symbols %t | FileCheck %s
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/protected-shared.s -o %t2.o
+# RUN: ld.lld -shared --soname=t2 %t2.o -o %t2.so
+# RUN: ld.lld %t.o %t2.so -o %t
+# RUN: llvm-readelf -s %t | FileCheck %s
+# RUN: ld.lld %t2.so %t.o -o %t1
+# RUN: llvm-readelf -s %t1 | FileCheck %s
+
+# CHECK: Symbol table '.dynsym'
+# CHECK:    Num:    Value          Size Type    Bind   Vis      Ndx Name
+# CHECK:      1: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND foo
+
+# CHECK: Symbol table '.symtab'
+# CHECK:    Num:    Value          Size Type    Bind   Vis      Ndx Name
+# CHECK:         0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND foo
+# CHECK:         {{.*}}               0 NOTYPE  GLOBAL DEFAULT [[#]] bar
 
         .global  _start
 _start:
 
-        .global bar
-bar:
-
         .data
         .quad foo
 
-// CHECK:      Name: bar
-// CHECK-NEXT: Value:
-// CHECK-NEXT: Size: 0
-// CHECK-NEXT: Binding: Global
-// CHECK-NEXT: Type: None
-// CHECK-NEXT: Other: 0
-// CHECK-NEXT: Section: .text
-
-// CHECK:      Name: foo
-// CHECK-NEXT: Value: 0x0
-// CHECK-NEXT: Size: 0
-// CHECK-NEXT: Binding: Global
-// CHECK-NEXT: Type: None
-// CHECK-NEXT: Other: 0
-// CHECK-NEXT: Section: Undefined
-
-// CHECK:      DynamicSymbols [
-// CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name:
-// CHECK-NEXT:     Value: 0x0
-// CHECK-NEXT:     Size: 0
-// CHECK-NEXT:     Binding: Local (0x0)
-// CHECK-NEXT:     Type: None (0x0)
-// CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: Undefined (0x0)
-// CHECK-NEXT:   }
-// CHECK-NEXT:   Symbol {
-// CHECK-NEXT:     Name: foo
-// CHECK-NEXT:     Value: 0x0
-// CHECK-NEXT:     Size: 0
-// CHECK-NEXT:     Binding: Global
-// CHECK-NEXT:     Type: None
-// CHECK-NEXT:     Other: 0
-// CHECK-NEXT:     Section: Undefined
-// CHECK-NEXT:   }
-// CHECK-NEXT: ]
+        .global bar
+bar:


        


More information about the llvm-commits mailing list