[PATCH] D32289: [ELF] - Linkerscript: support combination of linkerscript and --compress-debug-sections.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 03:27:22 PDT 2017


grimar added inline comments.


================
Comment at: test/ELF/linkerscript/compress-debug-sections.s:6
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2.o
+# RUN: echo "SECTIONS { .debug_str 0 : { *(.debug_str) } }" > %t.script
+# RUN: ld.lld %t1.o %t2.o %t.script -o %t --compress-debug-sections=zlib
----------------
ruiu wrote:
> What is the point of such linker script? I wonder why do you want to control the layout of .debug_str section.
Its just a sample script reduced from script of FreeBSD kernel:
https://svnweb.freebsd.org/base/head/sys/conf/ldscript.amd64?revision=315522&view=markup#l223
I do not think they really want to control layout.

Probably for this testcase I really could use just empty script and let debug section to be orphan. I'll check it when will update this patch.


================
Comment at: test/ELF/linkerscript/compress-debug-sections.s:18-20
+  .asciz "AAAAAAAAAAAAAAAAAAAAAAAAAAA"
+.Linfo_string1:
+  .asciz "BBBBBBBBBBBBBBBBBBBBBBBBBBB"
----------------
ruiu wrote:
> nit: Can you reduce number of repetitions of A, B, C and D? Just a few characters should suffice.
Interesting that doing that revealed an issue. After reducing amount of repetitions I ended up with broken sections size or errors during decompression.
That happens because void LinkerScript::process(BaseCommand &Base) calculates size of output section wrong when doing output(). It takes each input section and updates size of output section, what works wrong for compressed case.
It's just a luck that testcase "worked" before.

I'll try to find how to fix this properly.


https://reviews.llvm.org/D32289





More information about the llvm-commits mailing list