[PATCH] D36145: [ELF] - Do not segfault when doing logical and/or operations on symbols that have no output sections.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 08:20:33 PDT 2017


ruiu added inline comments.


================
Comment at: test/ELF/linkerscript/early-assign-symbol.s:10-15
+# RUN: echo "SECTIONS { aaa = foo | 1; .text  : { *(.text*) } }" > %t3.script
+# RUN: not ld.lld -o %t --script %t3.script %t.o 2>&1 | FileCheck %s
+
+# RUN: echo "SECTIONS { aaa = foo & 1; .text  : { *(.text*) } }" > %t4.script
+# RUN: not ld.lld -o %t --script %t4.script %t.o 2>&1 | FileCheck %s
+
----------------
grimar wrote:
> ruiu wrote:
> > What is the difference between these two tests? If they are testing the same thing, remove one of them. Unnecessary tests do harm than good. Please do not add tests for "just in case".
> First checks `|` and second checks `&` operator.
> 
> Them are implemented via `bitAnd()` and `bitOr()` (both use `getValue()` changed in patch atm), 
> so I think we want to check both flows ?
No, as long as one test covers new code, adding more test is mostly redundant. Just like attempting new code concise and clean, you want to try to make tests concise.


https://reviews.llvm.org/D36145





More information about the llvm-commits mailing list