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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 10:24:10 PDT 2024


================
@@ -2367,7 +2367,63 @@ void elf::hexagonTLSSymbolUpdate(ArrayRef<OutputSection *> outputSections) {
       });
 }
 
+static bool matchesRefTo(const NoCrossRefCommand &cmd, StringRef osec) {
+  if (cmd.toFirst)
+    return cmd.outputSections[0] == osec;
+  return llvm::is_contained(cmd.outputSections, osec);
+}
+
+template <class ELFT, class Rels>
+static void scanCrossRefs(const NoCrossRefCommand &cmd, OutputSection *osec,
+                          InputSection *sec, Rels rels) {
+  for (const auto &r : rels) {
+    Symbol &sym = sec->file->getSymbol(r.getSymbol(config->isMips64EL));
+    // The destination output section can be nullptr, osec, or those described
----------------
MaskRay wrote:

Thanks for the suggestion. Improved the comment.

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


More information about the llvm-commits mailing list