Index: ELF/Driver.cpp =================================================================== --- ELF/Driver.cpp +++ ELF/Driver.cpp @@ -987,6 +987,7 @@ if (!InputFile::IsInGroup) error("stray --end-group"); InputFile::IsInGroup = false; + ++InputFile::NextGroupId; break; case OPT_start_lib: InLib = true; Index: ELF/InputFiles.h =================================================================== --- ELF/InputFiles.h +++ ELF/InputFiles.h @@ -118,6 +118,7 @@ // ID. For more info, see checkDependency() in SymbolTable.cpp. uint32_t GroupId; static bool IsInGroup; + static uint32_t NextGroupId; protected: InputFile(Kind K, MemoryBufferRef M); @@ -126,8 +127,6 @@ private: const Kind FileKind; - - static uint32_t NextGroupId; }; template class ELFFileBase : public InputFile { Index: test/ELF/warn-backrefs.s =================================================================== --- test/ELF/warn-backrefs.s +++ test/ELF/warn-backrefs.s @@ -21,6 +21,7 @@ # RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.a %t1.o 2>&1 | FileCheck %s # RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe %t2.a "-(" %t1.o "-)" 2>&1 | FileCheck %s +# RUN: not ld.lld --fatal-warnings --warn-backrefs -o %t.exe --start-group %t2.a --end-group %t1.o 2>&1 | FileCheck %s # CHECK: backward reference detected: foo in {{.*}}1.o refers to {{.*}}2.a