[lld] lld: add support for NOCROSSREFS(_TO) (PR #95714)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 19 06:21:18 PDT 2024
================
@@ -2358,3 +2358,52 @@ template void elf::scanRelocations<ELF32LE>();
template void elf::scanRelocations<ELF32BE>();
template void elf::scanRelocations<ELF64LE>();
template void elf::scanRelocations<ELF64BE>();
+
+static void forEachAllocInputSectionDescription(
+ ArrayRef<OutputSection *> outputSections,
+ llvm::function_ref<void(OutputSection *, InputSectionDescription *)> fn) {
+ for (OutputSection *os : outputSections) {
+ if (!(os->flags & SHF_ALLOC))
+ continue;
+ for (SectionCommand *bc : os->commands)
+ if (auto *isd = dyn_cast<InputSectionDescription>(bc))
+ fn(os, isd);
+ }
+}
+
+static void checkSectionNoCrossRefs(OutputSection *outSec,
+ InputSectionDescription *inSecDescr) {
+
+ std::string message = "";
+
+ for (const auto &list : script->noCrossRefLists) {
+ if (!list.matchesRefFromSection(outSec)) {
----------------
smithp35 wrote:
Apologies for the nit. LLD coding style tends not to put braces around a single statement, unless it is in a chain of if, else if ...
```
if (!list.matchesRefFromSection(outSec))
continue;
```
https://github.com/llvm/llvm-project/pull/95714
More information about the llvm-commits
mailing list