[PATCH] D80311: [lld][test] Expand testing for dynamic-list and export-dynamic

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 23 20:41:50 PDT 2020


MaskRay added a comment.

Created D80487 <https://reviews.llvm.org/D80487> for `--export-dynamic-symbol`



================
Comment at: lld/test/ELF/Inputs/invalid-dynamic-list-1.list:1
+{ "foobar; };
----------------
`echo '.........' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o` for simple tests


================
Comment at: lld/test/ELF/export-symbol-types.s:1
+## Verify that depending on symbol type, the arguments --export-dynamic 
+## and --dynamic-list put the correct symbols in the dynamic symbol table.
----------------
REQUIRES: x86

The test duplicates partially with dynsym-pie.s, symbols.s and visibility.s

Check if they can be reorganized.


================
Comment at: lld/test/ELF/export-symbol-types.s:11
+## - weak undefined symbols
+## - imported symbols
+## - common symbols
----------------
 imported symbols -> shared symbols


================
Comment at: lld/test/ELF/export-symbol-types.s:18
+
+# RUN: echo "{ undef; weakref; import; local; common; weak; abs; hidden; _start; defsym; };" > %t.list
+
----------------
`echo '{ *; };' > %t.list`


================
Comment at: lld/test/ELF/export-symbol-types.s:20
+
+# RUN: echo ".globl import" > %t.s
+# RUN: echo "import = 0xDEADBEEF" >> %t.s
----------------
write on one line and separate statements with `;`


================
Comment at: lld/test/ELF/export-symbol-types.s:24
+# RUN: llvm-mc -filetype=obj -triple=x86_64 %t.s -o %t-shared.o
+# RUN: ld.lld --shared %t-shared.o -o %t.so
+
----------------
Use the same basename for .o and .so if applicable


================
Comment at: lld/test/ELF/export-symbol-types.s:36
+# CHECK-DAG: GLOBAL PROTECTED {{.*}} _start
+# CHECK-DAG: GLOBAL DEFAULT {{.*}} common
+# CHECK-DAG: GLOBAL DEFAULT {{.*}} import
----------------
Just use `CHECK-NEXT:`

The diagnostic will be better if things go off. This does rely on the symbol table order and will require extra efforts when the order does change, but I think the cost pays off.


================
Comment at: lld/test/ELF/export-symbol-types.s:38
+# CHECK-DAG: GLOBAL DEFAULT {{.*}} import
+# CHECK-DAG: GLOBAL DEFAULT {{.*}} abs
+# CHECK-DAG: GLOBAL DEFAULT {{.*}} defsym
----------------
Use `ABS` for `abs`


================
Comment at: lld/test/ELF/export-symbol-types.s:43
+
+.weak weakref
+
----------------
technically this is not referenced. You may name it undef_weak (yes, the order `undefined weak` (instead of `weak undefined`) is used in the ELF spec)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80311/new/

https://reviews.llvm.org/D80311





More information about the llvm-commits mailing list