[PATCH] [lld][LinkerScript] Add matching of output sections to segments

Sean Silva chisophugis at gmail.com
Thu Jun 11 14:05:29 PDT 2015


================
Comment at: test/elf/linkerscript/phdrs-invalid.test:41-62
@@ +40,24 @@
+
+RUN: not lld -flavor gnu -target x86_64 -T %p/phdrs/undef-no-phdrs.script %t.o -static -o %t1 &> %t1-error
+RUN: FileCheck -check-prefix UNDEF-NO-PHDRS %s < %t1-error
+
+UNDEF-NO-PHDRS: Linker script has wrong segments set for output section .text
+*/
+
+/*
+Test undefined header used when PHDRS is empty.
+
+RUN: not lld -flavor gnu -target x86_64 -T %p/phdrs/undef-empty-phdrs.script %t.o -static -o %t2 &> %t2-error
+RUN: FileCheck -check-prefix UNDEF-EMPTY-PHDRS %s < %t2-error
+
+UNDEF-EMPTY-PHDRS: Linker script has wrong segments set for output section .data
+*/
+
+/*
+Test undefined header used when PHDRS contains definitions.
+
+RUN: not lld -flavor gnu -target x86_64 -T %p/phdrs/undef-id-phdrs.script %t.o -static -o %t3 &> %t3-error
+RUN: FileCheck -check-prefix UNDEF-ID-PHDRS %s < %t3-error
+
+UNDEF-ID-PHDRS: Linker script has wrong segments set for output section .text
+*/
----------------
denis-protivensky wrote:
> silvas wrote:
> > Can you put the `RUN:` lines and check lines in the corresponding files?
> > (you might need to add a lit.local.cfg that identifies the interesting suffixes as tests)
> Don't understand the purpose of separating test cases. My intent was to logically group similar tests in one file. Moreover, I won't be able to split up phdrs-default.test file above in the same fasion without test code duplication.
It's not so much about having them separate as it is about having good locality of the check lines with the actual input file (in this case the linker script).

I can see the benefit in this case of having them together though.

I'll leave it to another reviewer to decide on what is best in this case.

http://reviews.llvm.org/D10359

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list