[PATCH] D24229: [ELF] - Versionscript: do not treat non-wildcarded names as wildcards.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 15:18:41 PDT 2016


ruiu added a comment.

If you think of this, that grammar looks very weird because it lacks a way to write a glob pattern containing a whitespace character. For example, if you want to write a pattern that matches strings starting with "foo " followed by any characters, you need this glob pattern: "foo *". However, if you write that in a linker script, it means the literal string "foo *" instead of a glob pattern, because the token is quoted. That means there's no way to express that in the linker script.

Being said that, this is what GNU does, and linker scripts are written that way, so unfortunately there's no way other than implementing the same thing.


================
Comment at: ELF/ScriptParser.cpp:63
@@ -62,3 +62,3 @@
 
     // Quoted token.
     if (S.startswith("\"")) {
----------------
Please add a comment why we leave double quotes in a resulting token.

  // Quoted token. Note that double-quote characters are parts of a token
  // because, in a glob match context, only unquoted tokens are interpreted
  // as glob patterns. Double-quoted tokens are literal patterns in that context.

================
Comment at: test/ELF/version-script-extern-exact.s:7
@@ +6,3 @@
+# RUN:      extern \"C++\" {   \
+# RUN:         \"aaa*\";    \
+# RUN:   };                  \
----------------
  echo "FOO { global: extern \"C++\" \"aaa*\"; }; };" > %t.script


https://reviews.llvm.org/D24229





More information about the llvm-commits mailing list