Rename HasSections -> HasSectionsComand.

HasSections is true if there is at least one SECTIONS linker
script command, and it is not directly related to whether we have
section objects or not. So I think the new name is better.

llvm-svn: 315405
This commit is contained in:
Rui Ueyama 2017-10-11 01:34:51 +00:00
parent 7f1c266e43
commit a323e2a722
4 changed files with 9 additions and 9 deletions

View File

@ -763,7 +763,7 @@ void LinkerScript::allocateHeaders(std::vector<PhdrEntry *> &Phdrs) {
uint64_t HeaderSize = getHeaderSize();
// When linker script with SECTIONS is being used, don't output headers
// unless there's a space for them.
uint64_t Base = HasSections ? alignDown(Min, Config->MaxPageSize) : 0;
uint64_t Base = HasSectionsCommand ? alignDown(Min, Config->MaxPageSize) : 0;
if (HeaderSize <= Min - Base || Script->hasPhdrsCommands()) {
Min = alignDown(Min - HeaderSize, Config->MaxPageSize);
Out::ElfHeader->Addr = Min;

View File

@ -251,7 +251,7 @@ public:
// PHDRS command list.
std::vector<PhdrsCommand> PhdrsCommands;
bool HasSections = false;
bool HasSectionsCommand = false;
// List of section patterns specified with KEEP commands. They will
// be kept even if they are unused and --gc-sections is specified.

View File

@ -434,7 +434,7 @@ void ScriptParser::readSearchDir() {
}
void ScriptParser::readSections() {
Script->HasSections = true;
Script->HasSectionsCommand = true;
// -no-rosegment is used to avoid placing read only non-executable sections in
// their own segment. We do the same if SECTIONS command is present in linker

View File

@ -161,7 +161,7 @@ template <class ELFT> void Writer<ELFT>::run() {
addReservedSymbols();
// Create output sections.
if (Script->HasSections) {
if (Script->HasSectionsCommand) {
// If linker script contains SECTIONS commands, let it create sections.
Script->processCommands(Factory);
@ -813,7 +813,7 @@ template <class ELFT> void Writer<ELFT>::addReservedSymbols() {
addOptionalRegular<ELFT>(Name, Out::ElfHeader, 0, STV_HIDDEN);
// If linker script do layout we do not need to create any standart symbols.
if (Script->HasSections)
if (Script->HasSectionsCommand)
return;
auto Add = [](StringRef S, int64_t Pos) {
@ -1055,7 +1055,7 @@ template <class ELFT> void Writer<ELFT>::sortSections() {
if (auto *Sec = dyn_cast<OutputSection>(Base))
Sec->SortRank = getSectionRank(Sec);
if (!Script->HasSections) {
if (!Script->HasSectionsCommand) {
// We know that all the OutputSections are contiguous in
// this case.
auto E = Script->Commands.end();
@ -1355,7 +1355,7 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
InX::Dynamic},
[](SyntheticSection *SS) { SS->finalizeContents(); });
if (!Script->HasSections && !Config->Relocatable)
if (!Script->HasSectionsCommand && !Config->Relocatable)
fixSectionAlignments();
// Some architectures use small displacements for jump instructions.
@ -1681,7 +1681,7 @@ template <class ELFT> void Writer<ELFT>::assignFileOffsets() {
for (OutputSection *Sec : OutputSections) {
Off = setOffset(Sec, Off);
if (Script->HasSections)
if (Script->HasSectionsCommand)
continue;
// If this is a last section of the last executable segment and that
// segment is the last loadable segment, align the offset of the
@ -1860,7 +1860,7 @@ static void fillTrap(uint8_t *I, uint8_t *End) {
// We'll leave other pages in segments as-is because the rest will be
// overwritten by output sections.
template <class ELFT> void Writer<ELFT>::writeTrapInstr() {
if (Script->HasSections)
if (Script->HasSectionsCommand)
return;
// Fill the last page.