[PATCH] D114103: [ELF] Ensure output section is also not empty in addStartEndSymbols()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 18:33:49 PST 2021


MaskRay added inline comments.


================
Comment at: lld/test/ELF/linkerscript/pre_init_array_empty.test:1
+# REQUIRES: x86
+## PR52534: https://bugs.llvm.org/show_bug.cgi?id=52534
----------------
preinit-array-empty.test


================
Comment at: lld/test/ELF/linkerscript/pre_init_array_empty.test:6
+# RUN: split-file %s %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t/t.s -o %t.o
+# RUN: ld.lld --script %t/t.script %t.o -o /dev/null --image-base=0x80000000
----------------



================
Comment at: lld/test/ELF/linkerscript/pre_init_array_empty.test:7
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t/t.s -o %t.o
+# RUN: ld.lld --script %t/t.script %t.o -o /dev/null --image-base=0x80000000
+
----------------
Use `llvm-readelf -s` to check the value of `__preinit_array_start`.

This makes better use of a test case: not just check that the link succeeds, also catches unintended value change in the future. You can add a comment that as long as `__preinit_array_start=__preinit_array_end`, the exact value doesn't matter.


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

https://reviews.llvm.org/D114103



More information about the llvm-commits mailing list