[PATCH] D36546: Garbage-collect common symbols.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 9 13:46:32 PDT 2017


Rui Ueyama via Phabricator via llvm-commits
<llvm-commits at lists.llvm.org> writes:

> Index: lld/test/ELF/common-gc.s
> ===================================================================
> --- /dev/null
> +++ lld/test/ELF/common-gc.s
> @@ -0,0 +1,19 @@
> +# REQUIRES: x86
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
> +
> +# RUN: ld.lld %t -o %t2
> +# RUN: llvm-readobj -sections -symbols %t2 | FileCheck %s --check-prefix=NOGC
> +# NOGC: Name: bar
> +# NOGC: Name: foo
> +
> +# RUN: ld.lld -gc-sections %t -o %t1
> +# RUN: llvm-readobj -sections -symbols %t1 | FileCheck %s --check-prefix=GC
> +# GC-NOT: Name: bar
> +
> +.comm foo,4,4
> +.comm bar,4,4
> +
> +.text
> +.globl _start
> +_start:
> + .quad foo

Please test the size of .bss in at least one test to show that we are
dropping the space in addition to the symbol.

LGTM with that, but please wait for George too.

Cheers,
Rafael


More information about the llvm-commits mailing list