[lld] r222309 - [ELF] Sectionkey should also contain path.
Shankar Easwaran
shankare at codeaurora.org
Tue Nov 18 19:51:41 PST 2014
Author: shankare
Date: Tue Nov 18 21:51:41 2014
New Revision: 222309
URL: http://llvm.org/viewvc/llvm-project?rev=222309&view=rev
Log:
[ELF] Sectionkey should also contain path.
No change in functionality.
Modified:
lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
Modified: lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h?rev=222309&r1=222308&r2=222309&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DefaultLayout.h Tue Nov 18 21:51:41 2014
@@ -91,24 +91,26 @@ public:
// The sections are created using
// SectionName, contentPermissions
struct SectionKey {
- SectionKey(StringRef name, DefinedAtom::ContentPermissions perm)
- : _name(name), _perm(perm) {
- }
+ SectionKey(StringRef name, DefinedAtom::ContentPermissions perm,
+ StringRef path)
+ : _name(name), _perm(perm), _path(path) {}
// Data members
StringRef _name;
DefinedAtom::ContentPermissions _perm;
+ StringRef _path;
};
struct SectionKeyHash {
int64_t operator()(const SectionKey &k) const {
- return llvm::hash_combine(k._name, k._perm);
+ return llvm::hash_combine(k._name, k._perm, k._path);
}
};
struct SectionKeyEq {
bool operator()(const SectionKey &lhs, const SectionKey &rhs) const {
- return ((lhs._name == rhs._name) && (lhs._perm == rhs._perm));
+ return ((lhs._name == rhs._name) && (lhs._perm == rhs._perm) &&
+ (lhs._path == rhs._path));
}
};
@@ -178,9 +180,10 @@ public:
virtual StringRef getSectionName(const DefinedAtom *da) const;
/// \brief Gets or creates a section.
- AtomSection<ELFT> *getSection(
- StringRef name, int32_t contentType,
- DefinedAtom::ContentPermissions contentPermissions);
+ AtomSection<ELFT> *
+ getSection(StringRef name, int32_t contentType,
+ DefinedAtom::ContentPermissions contentPermissions,
+ StringRef path);
/// \brief Gets the segment for a output section
virtual Layout::SegmentType getSegmentType(Section<ELFT> *section) const;
@@ -533,10 +536,11 @@ AtomSection<ELFT> *DefaultLayout<ELFT>::
}
template <class ELFT>
-AtomSection<ELFT> *DefaultLayout<ELFT>::getSection(
- StringRef sectionName, int32_t contentType,
- DefinedAtom::ContentPermissions permissions) {
- const SectionKey sectionKey(sectionName, permissions);
+AtomSection<ELFT> *
+DefaultLayout<ELFT>::getSection(StringRef sectionName, int32_t contentType,
+ DefinedAtom::ContentPermissions permissions,
+ StringRef path) {
+ const SectionKey sectionKey(sectionName, permissions, path);
auto sec = _sectionMap.find(sectionKey);
if (sec != _sectionMap.end())
return sec->second;
@@ -563,8 +567,8 @@ ErrorOr<const lld::AtomLayout &> Default
const DefinedAtom::ContentType contentType = definedAtom->contentType();
StringRef sectionName = getSectionName(definedAtom);
- AtomSection<ELFT> *section =
- getSection(sectionName, contentType, permissions);
+ AtomSection<ELFT> *section = getSection(
+ sectionName, contentType, permissions, definedAtom->file().path());
// Add runtime relocations to the .rela section.
for (const auto &reloc : *definedAtom) {
More information about the llvm-commits
mailing list