[PATCH] D68758: Improve error message for bad SHF_MERGE sections

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 03:28:35 PDT 2019


grimar added inline comments.


================
Comment at: lld/test/ELF/invalid/merge-invalid-size.s:4
 // RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
-// CHECK: SHF_MERGE section size must be a multiple of sh_entsize
+// CHECK: merge-invalid-size.s.tmp.o:(.foo): SHF_MERGE section size (2) must be a multiple of sh_entsize (4)
 
----------------
ruiu wrote:
> grimar wrote:
> > ruiu wrote:
> > > grimar wrote:
> > > > You should probably be able to do something like the following I think:
> > > > 
> > > > ```
> > > > // ... | FileCheck %s - DFILE=%t.o
> > > > // CHECK: [[FILE]]:(.foo): SHF_MERGE section size (2) must be a multiple of sh_entsize (4)
> > > > ```
> > > I'm not sure if that use of `-D`  makes things easier, so I'd like to stick with this.
> > Hardcoding something is indeed easier. Problem is that here you depend on the naming rules.
> > I.e. what if ".tmp." suffix changes to something else? Such tests will fail.
> > FWIW in llvm tools test cases `-D` is used heavily.
> Yeah, you are right, though I'm not too worried about that. If writing a full filename here is too much, I'd change this to `.o:(.foo)` so that it is not too picky about filenames.
That is in line with what we usually did in LLD before and sounds good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68758/new/

https://reviews.llvm.org/D68758





More information about the llvm-commits mailing list