[PATCH] D45846: [ELF] Increase NextGroupId with --end-group
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 19 16:04:13 PDT 2018
MaskRay updated this revision to Diff 143182.
MaskRay added a comment.
Fix readGroup as well
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D45846
Files:
ELF/Driver.cpp
ELF/InputFiles.h
ELF/ScriptParser.cpp
test/ELF/warn-backrefs.s
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
Index: ELF/ScriptParser.cpp
===================================================================
--- ELF/ScriptParser.cpp
+++ ELF/ScriptParser.cpp
@@ -333,6 +333,7 @@
InputFile::IsInGroup = true;
readInput();
InputFile::IsInGroup = Orig;
+ ++InputFile::NextGroupId;
}
void ScriptParser::readInclude() {
Index: ELF/InputFiles.h
===================================================================
--- ELF/InputFiles.h
+++ ELF/InputFiles.h
@@ -118,16 +118,15 @@
// 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);
std::vector<InputSectionBase *> Sections;
std::vector<Symbol *> Symbols;
private:
const Kind FileKind;
-
- static uint32_t NextGroupId;
};
template <typename ELFT> class ELFFileBase : public InputFile {
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45846.143182.patch
Type: text/x-patch
Size: 1818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180419/902ab59a/attachment.bin>
More information about the llvm-commits
mailing list