File tree Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Expand file tree Collapse file tree 2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -808,13 +808,18 @@ void LinkerScript::processSectionCommands() {
808
808
809
809
// Input sections cannot have a section class parent past this point; they
810
810
// must have been assigned to an output section.
811
- for (const auto &[_, sc] : sectionClasses)
812
- for (InputSectionDescription *isd : sc->sc .commands )
813
- for (InputSectionBase *sec : isd->sectionBases )
814
- if (sec->parent && isa<SectionClass>(sec->parent ))
815
- errorOrWarn (" section '" + sec->name + " ' assigned to class '" +
816
- sec->parent ->name +
817
- " ' but unreferenced by any output section" );
811
+ for (const auto &[_, sc] : sectionClasses) {
812
+ for (InputSectionDescription *isd : sc->sc .commands ) {
813
+ for (InputSectionBase *sec : isd->sectionBases ) {
814
+ if (sec->parent && isa<SectionClass>(sec->parent )) {
815
+ errorOrWarn (" section class '" + sec->parent ->name +
816
+ " ' is unreferenced" );
817
+ goto nextClass;
818
+ }
819
+ }
820
+ }
821
+ nextClass:;
822
+ }
818
823
}
819
824
820
825
void LinkerScript::processSymbolAssignments () {
Original file line number Diff line number Diff line change @@ -142,12 +142,12 @@ SECTIONS {
142
142
}
143
143
144
144
# RUN: not ld.lld -T unreferenced.lds matching.o 2>&1 | \
145
- # RUN: FileCheck %s --check-prefix=UNREFERENCED
145
+ # RUN: FileCheck %s --check-prefix=UNREFERENCED -implicit-check-not=error:
146
146
# RUN: ld.lld -T unreferenced.lds matching.o -o out --noinhibit-exec 2>&1 | \
147
- # RUN: FileCheck %s --check-prefix=UNREFERENCED-WARN
147
+ # RUN: FileCheck %s --check-prefix=UNREFERENCED-WARN -implicit-check-not=error:
148
148
149
- # UNREFERENCED: error: section '.rodata.a' assigned to class 'a' but unreferenced by any output section
150
- # UNREFERENCED-WARN: warning: section '.rodata.a' assigned to class 'a' but unreferenced by any output section
149
+ # UNREFERENCED: error: section class 'a' is unreferenced
150
+ # UNREFERENCED-WARN: warning: section class 'a' is unreferenced
151
151
152
152
#--- class-references-class.lds
153
153
## One section class references another.
You can’t perform that action at this time.
0 commit comments