[lld] [ELF] Support NOCROSSREFS and NOCROSSERFS_TO (PR #98773)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 08:27:05 PDT 2024


================
@@ -299,6 +304,15 @@ void ScriptParser::readDefsym(StringRef name) {
   script->sectionCommands.push_back(cmd);
 }
 
+void ScriptParser::readNoCrossRefs(bool to) {
+  expect("(");
+  NoCrossRefCommand cmd{{}, to};
+  while (!errorCount() && !consume(")"))
+    cmd.outputSections.push_back(unquote(next()));
+  if (cmd.outputSections.size() >= 2)
+    script->noCrossRefs.push_back(std::move(cmd));
+}
----------------
smithp35 wrote:

Would it be worth a warning if the `outputSections.size() < 2` I don't think there could be a legal use case for `NOCROSSREFS()` or `NOCROSSREFS(<section>)`. 

https://github.com/llvm/llvm-project/pull/98773


More information about the llvm-commits mailing list