This is a small difference I noticed to gold and bfd. When given --print-gc-sections, we print sections a linkerscript marks DISCARD. The other linkers don't.
Diff Detail
Diff Detail
Event Timeline
Comment Actions
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| test/ELF/linkerscript/discard-print-gc.s | ||
|---|---|---|
| 4 | Do you need -shared ? We link fine when do not have _start I think, if that was the case. | |
| ELF/LinkerScript.cpp | ||
|---|---|---|
| 279–280 | Can this happen? It seems more like an ASSERT rather than an error(). | |
Can this happen? It seems more like an ASSERT rather than an error().