[PATCH] D30048: Don't print DISCARD sections as gced

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 11:05:15 PST 2017


Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> ruiu added inline comments.
>
>
> ================
> Comment at: ELF/LinkerScript.cpp:279-280
>      S->Live = false;
> -    reportDiscarded(S);
> +    if (S == In<ELFT>::ShStrTab)
> +      error("discarding .shstrtab section is not allowed");
>  
> ----------------
> Can this happen? It seems more like an ASSERT rather than an error().

It is, test/ELF/linkerscript/sections.s has a testcase:

# Attemp to discard .shstrtab section.
# RUN: echo "SECTIONS { /DISCARD/ : { *(.shstrtab) } }" > %t.script
# RUN: not ld.lld -o %t5 --script %t.script %t 2>&1 | \
# RUN:   FileCheck -check-prefix=SEC-DISCARD %s
# SEC-DISCARD: discarding .shstrtab section is not allowed


Cheers,
Rafael


More information about the llvm-commits mailing list