[lld][ELF] Rename typeTLV content type for ELF

typeTLV content type is used by Darwin to represent thread local
storage. A new contentType has to be made to represent ELF
thread local storage data. These have been set to

- typeThreadZeroFill (represents TBSS storage)
- typeThreadData     (represents TDATA storage)

llvm-svn: 189137
This commit is contained in:
Shankar Easwaran 2013-08-23 20:03:28 +00:00
parent d17ba4bd4d
commit d9e0a49357
7 changed files with 23 additions and 14 deletions

View File

@ -145,6 +145,8 @@ public:
typeTLVInitialZeroFill, // TLV initial zero fill data [Darwin]
typeTLVInitializerPtr, // pointer to thread local initializer [Darwin]
typeDataDirectoryEntry, // linker created for data directory header [PECOFF]
typeThreadZeroFill, // Uninitialized thread local data(TBSS) [ELF]
typeThreadData, // Initialized thread local data(TDATA) [ELF]
};
// Permission bits for atoms and segments. The order of these values are
@ -311,7 +313,8 @@ public:
ContentType atomContentType = contentType();
return !(atomContentType == DefinedAtom::typeZeroFill ||
atomContentType == DefinedAtom::typeZeroFillFast ||
atomContentType == DefinedAtom::typeTLVInitialZeroFill);
atomContentType == DefinedAtom::typeTLVInitialZeroFill ||
atomContentType == DefinedAtom::typeThreadZeroFill);
}
protected:

View File

@ -65,6 +65,8 @@ DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) {
case typeTLVInitialData:
case typeTLVInitialZeroFill:
case typeTLVInitializerPtr:
case typeThreadData:
case typeThreadZeroFill:
return permRW_L;
case typeUnknown:

View File

@ -286,8 +286,8 @@ public:
if (_section->sh_flags ==
(llvm::ELF::SHF_ALLOC | llvm::ELF::SHF_WRITE | llvm::ELF::SHF_TLS)) {
return _contentType = _section->sh_type == llvm::ELF::SHT_NOBITS ? typeTLVInitialZeroFill
: typeTLVInitialData;
return _contentType = _section->sh_type == llvm::ELF::SHT_NOBITS ? typeThreadZeroFill
: typeThreadData;
}
if (_symbol->getType() == llvm::ELF::STT_GNU_IFUNC)

View File

@ -343,9 +343,9 @@ Layout::SectionOrder DefaultLayout<ELFT>::getSectionOrder(
case DefinedAtom::typeStub:
return ORDER_PLT;
case DefinedAtom::typeTLVInitialData:
case DefinedAtom::typeThreadData:
return ORDER_TDATA;
case DefinedAtom::typeTLVInitialZeroFill:
case DefinedAtom::typeThreadZeroFill:
return ORDER_TBSS;
default:
// If we get passed in a section push it to OTHER

View File

@ -146,11 +146,11 @@ public:
case DefinedAtom::typeGOT:
case DefinedAtom::typeStub:
case DefinedAtom::typeResolver:
case DefinedAtom::typeTLVInitialData:
case DefinedAtom::typeThreadData:
this->_type = SHT_PROGBITS;
break;
case DefinedAtom::typeTLVInitialZeroFill:
case DefinedAtom::typeThreadZeroFill:
case DefinedAtom::typeZeroFillFast:
case DefinedAtom::typeZeroFill:
this->_type = SHT_NOBITS;
@ -167,8 +167,8 @@ public:
case DefinedAtom::permRW_:
case DefinedAtom::permRW_L:
this->_flags = SHF_ALLOC | SHF_WRITE;
if (_contentType == DefinedAtom::typeTLVInitialData ||
_contentType == DefinedAtom::typeTLVInitialZeroFill)
if (_contentType == DefinedAtom::typeThreadData ||
_contentType == DefinedAtom::typeThreadZeroFill)
this->_flags |= SHF_TLS;
break;
case DefinedAtom::permRWX:
@ -292,7 +292,7 @@ const lld::AtomLayout &AtomSection<ELFT>::appendAtom(const Atom *atom) {
case DefinedAtom::typeGOT:
case DefinedAtom::typeStub:
case DefinedAtom::typeResolver:
case DefinedAtom::typeTLVInitialData:
case DefinedAtom::typeThreadData:
_atoms.push_back(new (_alloc) lld::AtomLayout(atom, fOffset, 0));
this->_fsize = fOffset + definedAtom->size();
this->_msize = mOffset + definedAtom->size();
@ -301,7 +301,7 @@ const lld::AtomLayout &AtomSection<ELFT>::appendAtom(const Atom *atom) {
<< "Adding atom: " << atom->name() << "@"
<< fOffset << "\n");
break;
case DefinedAtom::typeTLVInitialZeroFill:
case DefinedAtom::typeThreadZeroFill:
case DefinedAtom::typeZeroFill:
case DefinedAtom::typeZeroFillFast:
_atoms.push_back(new (_alloc) lld::AtomLayout(atom, mOffset, 0));
@ -713,8 +713,8 @@ void SymbolTable<ELFT>::addDefinedAtom(Elf_Sym &sym, const DefinedAtom *da,
type = llvm::ELF::STT_OBJECT;
sym.st_value = addr;
break;
case DefinedAtom::typeTLVInitialData:
case DefinedAtom::typeTLVInitialZeroFill:
case DefinedAtom::typeThreadData:
case DefinedAtom::typeThreadZeroFill:
type = llvm::ELF::STT_TLS;
sym.st_value = addr;
break;

View File

@ -487,6 +487,10 @@ struct ScalarEnumerationTraits<lld::DefinedAtom::ContentType> {
lld::DefinedAtom::typeTLVInitialZeroFill);
io.enumCase(value, "tlv-initializer-ptr",
lld::DefinedAtom::typeTLVInitializerPtr);
io.enumCase(value, "thread-data",
lld::DefinedAtom::typeThreadData);
io.enumCase(value, "thread-zero-fill",
lld::DefinedAtom::typeThreadZeroFill);
}
};

View File

@ -19,6 +19,6 @@ CHECK: size: 4000
CHECK: section-name: .bss
CHECK: - name: largetbss
CHECK: scope: global
CHECK: type: tlv-zero-fill
CHECK: type: thread-zero-fill
CHECK: size: 4000
CHECK: section-name: .tbss