[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:46 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) {
----------------
MaskRay wrote:

Added an early return to `elf::checkNoCrossRefs`: `(noxref.toFirst && noxref.outputSections[0] == osec->name)`

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


More information about the llvm-commits mailing list