[PATCH] D24650: [ELF] - Linkerscript: PR30387 - cannot handle EXCLUDE_FILE in the middle of a input section description.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 14:41:40 PDT 2016


ruiu added inline comments.

================
Comment at: lld/trunk/ELF/LinkerScript.cpp:992
@@ +991,3 @@
+// Example: *(.foo.1 EXCLUDE_FILE (*a.o) .foo.2 EXCLUDE_FILE (*b.o) .foo.3)
+void ScriptParser::readSectionExcludes(InputSectionDescription *Cmd) {
+  llvm::Regex ExcludeFileRe;
----------------
grimar wrote:
> grimar wrote:
> > ruiu wrote:
> > > It's not clear to me what the grammar of this thing is.
> > > 
> > >   A B EXCLUDE_FILE(C) D E
> > > 
> > > Does the above pattern mean A, B, D except those matching C, and E? Or A, B, D except those matching C, E except those matching C?
> > > 
> > > What if the pattern is this?
> > > 
> > >   A B EXCLUDE_FILE(C) EXCLUDE_FILE(D) E
> > > 
> > Example from PR30387:
> > 
> > sec0 EXCLUDE_FILE (zed1.o) sec1  EXCLUDE_FILE (zed2.o) sec2 )
> > 
> > The semantics according to bfd are:
> > Include sec1 from every file but zed1.o
> > Include sec2 from every file but zed2.o
> > Include sec0 from every file
> > 
> > So
> > ```
> > A B EXCLUDE_FILE(C) D E
> > ```
> > 
> > Should be all A, B sections + all D, E excluding those in file C.
> > 
> > 
> > Pattern of 
> > ```
> > A B EXCLUDE_FILE(C) EXCLUDE_FILE(D) E
> > ```
> > then should be all A, B + all E except those in file E.
> Fix for last:
> A B EXCLUDE_FILE(C) EXCLUDE_FILE(D) E
> then should be all A, B + all E except those in **file D.**
I think two consecutve EXCLUDE_FILEs are more like a syntax error than a valid grammar, no? Is there any reason you want to accept it?


Repository:
  rL LLVM

https://reviews.llvm.org/D24650





More information about the llvm-commits mailing list