forked from OSchip/llvm-project
[Layout] Dont set ordinals to Files by default.
This change removes code in various places which was setting the File Ordinals. This is because the file ordinals are assigned by the way files are resolved. There was no other way than making the getNextFileAndOrdinal be set const and change the _nextOrdinal to mutable. There are so many places in code, that you would need to cleanup to make LinkingContext non-const! llvm-svn: 192280
This commit is contained in:
parent
2d0d180ab4
commit
49408ece47
|
@ -220,7 +220,8 @@ protected:
|
|||
static atom_collection_empty<SharedLibraryAtom> _noSharedLibraryAtoms;
|
||||
static atom_collection_empty<AbsoluteAtom> _noAbsoluteAtoms;
|
||||
|
||||
StringRef _path;
|
||||
private:
|
||||
StringRef _path;
|
||||
Kind _kind;
|
||||
mutable uint64_t _ordinal;
|
||||
};
|
||||
|
|
|
@ -316,7 +316,7 @@ public:
|
|||
virtual void setResolverState(uint32_t resolverState);
|
||||
|
||||
/// Return the next ordinal and Increment it.
|
||||
virtual uint64_t getNextOrdinalAndIncrement() { return _nextOrdinal++; }
|
||||
virtual uint64_t getNextOrdinalAndIncrement() const { return _nextOrdinal++; }
|
||||
|
||||
/// @}
|
||||
|
||||
|
@ -367,7 +367,7 @@ protected:
|
|||
std::unique_ptr<InputGraph> _inputGraph;
|
||||
mutable llvm::BumpPtrAllocator _allocator;
|
||||
InputElement *_currentInputElement;
|
||||
uint64_t _nextOrdinal;
|
||||
mutable uint64_t _nextOrdinal;
|
||||
|
||||
private:
|
||||
/// Validate the subclass bits. Only called by validate.
|
||||
|
|
|
@ -24,10 +24,7 @@ namespace lld {
|
|||
class SimpleFile : public MutableFile {
|
||||
public:
|
||||
SimpleFile(const LinkingContext &context, StringRef path)
|
||||
: MutableFile(context, path) {
|
||||
static uint32_t lastOrdinal = 0;
|
||||
_ordinal = lastOrdinal++;
|
||||
}
|
||||
: MutableFile(context, path) {}
|
||||
|
||||
virtual void addAtom(const Atom &atom) {
|
||||
if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(&atom)) {
|
||||
|
|
|
@ -299,6 +299,7 @@ void Resolver::resolveUndefines() {
|
|||
if (error_code(nextFile) == InputGraphError::no_more_files)
|
||||
break;
|
||||
if (nextFile->kind() == File::kindObject) {
|
||||
assert(!nextFile->hasOrdinal());
|
||||
nextFile->setOrdinal(_context.getNextOrdinalAndIncrement());
|
||||
handleFile(*nextFile);
|
||||
}
|
||||
|
|
|
@ -62,9 +62,8 @@ public:
|
|||
|
||||
class HexagonInitFiniFile : public SimpleFile {
|
||||
public:
|
||||
HexagonInitFiniFile(const ELFLinkingContext &context):
|
||||
SimpleFile(context, "command line option -init/-fini")
|
||||
{}
|
||||
HexagonInitFiniFile(const ELFLinkingContext &context)
|
||||
: SimpleFile(context, "command line option -init/-fini"), _ordinal(0) {}
|
||||
|
||||
void addInitFunction(StringRef name) {
|
||||
Atom *initFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
|
||||
|
@ -88,6 +87,7 @@ public:
|
|||
|
||||
private:
|
||||
llvm::BumpPtrAllocator _allocator;
|
||||
uint64_t _ordinal;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,9 @@ public:
|
|||
|
||||
class ELFPassFile : public SimpleFile {
|
||||
public:
|
||||
ELFPassFile(const ELFLinkingContext &eti) : SimpleFile(eti, "ELFPassFile") {}
|
||||
ELFPassFile(const ELFLinkingContext &eti) : SimpleFile(eti, "ELFPassFile") {
|
||||
setOrdinal(eti.getNextOrdinalAndIncrement());
|
||||
}
|
||||
|
||||
llvm::BumpPtrAllocator _alloc;
|
||||
};
|
||||
|
|
|
@ -78,7 +78,9 @@ public:
|
|||
|
||||
class ELFPassFile : public SimpleFile {
|
||||
public:
|
||||
ELFPassFile(const ELFLinkingContext &eti) : SimpleFile(eti, "ELFPassFile") {}
|
||||
ELFPassFile(const ELFLinkingContext &eti) : SimpleFile(eti, "ELFPassFile") {
|
||||
setOrdinal(eti.getNextOrdinalAndIncrement());
|
||||
}
|
||||
|
||||
llvm::BumpPtrAllocator _alloc;
|
||||
};
|
||||
|
@ -478,9 +480,8 @@ public:
|
|||
|
||||
class X86_64InitFiniFile : public SimpleFile {
|
||||
public:
|
||||
X86_64InitFiniFile(const ELFLinkingContext &context):
|
||||
SimpleFile(context, "command line option -init/-fini")
|
||||
{}
|
||||
X86_64InitFiniFile(const ELFLinkingContext &context)
|
||||
: SimpleFile(context, "command line option -init/-fini"), _ordinal(0) {}
|
||||
|
||||
void addInitFunction(StringRef name) {
|
||||
Atom *initFunctionAtom = new (_allocator) SimpleUndefinedAtom(*this, name);
|
||||
|
@ -504,6 +505,7 @@ public:
|
|||
|
||||
private:
|
||||
llvm::BumpPtrAllocator _allocator;
|
||||
uint64_t _ordinal;
|
||||
};
|
||||
|
||||
} // end anon namespace
|
||||
|
|
Loading…
Reference in New Issue