[PATCH] D41773: [ELF] Compress debug sections after assignAddresses and support custom layout

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 15:27:01 PST 2018


James Henderson via Phabricator <reviews at reviews.llvm.org> writes:

> Index: test/ELF/linkerscript/compress-debug-sections-custom.s
> ===================================================================
> --- test/ELF/linkerscript/compress-debug-sections-custom.s
> +++ test/ELF/linkerscript/compress-debug-sections-custom.s
> @@ -0,0 +1,26 @@
> +# REQUIRES: x86, zlib
> +
> +# RUN: echo "SECTIONS { \
> +# RUN:          .text : { . += 0x10; *(.text) } \
> +# RUN:          .debug_str : { . += 0x10; *(.debug_str) } \
> +# RUN:          .debug_other : { . += 0x10; *(.debug_other) } \
> +# RUN:          }" > %t.script
> +
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/../Inputs/compress-debug.s -o %t2.o
> +# RUN: ld.lld %t2.o %t.o -o %t1 -Ttext=0x20 --compress-debug-sections=zlib -T %t.script
> +# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s
> +# CHECK: 0x00000010: "T"
> +# CHECK: 0x00000014: "R"

Please add a small comment on what this is testing and why T and R are
the right values.


> Index: test/ELF/compress-debug-sections-reloc.s
> ===================================================================
> --- test/ELF/compress-debug-sections-reloc.s
> +++ test/ELF/compress-debug-sections-reloc.s
> @@ -0,0 +1,20 @@
> +# REQUIRES: x86, zlib
> +
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
> +# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/compress-debug.s -o %t2.o
> +# RUN: ld.lld %t2.o %t.o -o %t1 -Ttext=0x20 --compress-debug-sections=zlib
> +# RUN: llvm-dwarfdump %t1 -debug-str | FileCheck %s
> +# CHECK: 0x00000000: "D"
> +# CHECK: 0x00000004: "B"

Same here.

LGTM with that.

I agree that this is the right way to do it. We compute "addresses" with
the original size, compress and then compute offsets.

Cheers,
Rafael


More information about the llvm-commits mailing list