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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 17 01:56:22 PST 2017


grimar accepted this revision.
grimar added a comment.
This revision is now accepted and ready to land.

LGTM with a nit, looks reasonable behavior for me.

btw, currently (with or without this patch)
we do not report sections as discarded when linkerscript is used with -gc-sections at all (when there is no /DISCARD/):

  # REQUIRES: x86
  # RUN: echo "SECTIONS { }" > %t.script
  # RUN: llvm-mc -triple x86_64-pc-linux %s -o %t.o -filetype=obj
  # RUN: ld.lld -o %t -T %t.script %t.o --print-gc-sections --gc-sections 2>&1 | \
  # RUN:   FileCheck -check-prefix=NOREPORT --allow-empty %s
  # NOREPORT-NOT: removing unused section
  
  .section .foo,"a"
  .quad 0



================
Comment at: test/ELF/linkerscript/discard-print-gc.s:4
+# RUN: llvm-mc -triple x86_64-pc-linux %s -o %t.o -filetype=obj
+# RUN: ld.lld -o %t.so --gc-sections %t.o --print-gc-sections -shared 2>&1 | \
+# RUN:   FileCheck -check-prefix=CHECK %s
----------------
Do you need -shared ? We link fine when do not have _start I think, if that was the case.


https://reviews.llvm.org/D30048





More information about the llvm-commits mailing list