[PATCH] D30188: [ELF] - Do not segfault when using --gc-sections with linker script

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 02:26:27 PST 2017


grimar added a comment.

In https://reviews.llvm.org/D30188#682028, @jhenderson wrote:

> I'm not yet familiar enough with LLD to know the policy with asserts, but would it make sense to assert after that if statement (possibly inside switchTo()) to check that IB->OutSec is not null? That way if there are any other cases either currently or in the future where OutSec is null we'll get a nicer failure, at least in Debug builds.


We usually do not check arguments with asserts I think. Mostly using them to check logic flow conditions.



================
Comment at: test/ELF/linkerscript/sections-gc.s:7
+
+# CHECK:      Sections:
+# CHECK-NEXT: Idx Name      Size
----------------
jhenderson wrote:
> Do we really need these first two CHECKs?
Thats for self-documenting the test.
It shows we check Sections and that "00000001" is a Size field. 
I am checking a size to show that one of sections was collected.


https://reviews.llvm.org/D30188





More information about the llvm-commits mailing list