[lld] r299579 - Fix comments.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 5 12:20:55 PDT 2017
Author: ruiu
Date: Wed Apr 5 14:20:54 2017
New Revision: 299579
URL: http://llvm.org/viewvc/llvm-project?rev=299579&view=rev
Log:
Fix comments.
Modified:
lld/trunk/ELF/LinkerScript.h
lld/trunk/ELF/ScriptParser.cpp
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=299579&r1=299578&r2=299579&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Wed Apr 5 14:20:54 2017
@@ -208,7 +208,7 @@ struct ScriptConfiguration {
// A map from memory region name to a memory region descriptor.
llvm::DenseMap<llvm::StringRef, MemoryRegion> MemoryRegions;
- // A list of undefined symbols referenced by the script.
+ // A list of symbols referenced by the script.
std::vector<llvm::StringRef> ReferencedSymbols;
};
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=299579&r1=299578&r2=299579&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Wed Apr 5 14:20:54 2017
@@ -434,13 +434,19 @@ SortSectionPolicy ScriptParser::readSort
return SortSectionPolicy::Default;
}
-// Method reads a list of sequence of excluded files and section globs given in
-// a following form: ((EXCLUDE_FILE(file_pattern+))? section_pattern+)+
-// Example: *(.foo.1 EXCLUDE_FILE (*a.o) .foo.2 EXCLUDE_FILE (*b.o) .foo.3)
-// The semantics of that is next:
-// * Include .foo.1 from every file.
-// * Include .foo.2 from every file but a.o
-// * Include .foo.3 from every file but b.o
+// Reads SECTIONS command contents in the following form:
+//
+// <contents> ::= <elem>*
+// <elem> ::= <exclude>? <glob-pattern>
+// <exclude> ::= "EXCLUDE_FILE" "(" <glob-pattern>+ ")"
+//
+// For example,
+//
+// *(.foo EXCLUDE_FILE (a.o) .bar EXCLUDE_FILE (b.o) .baz)
+//
+// is parsed as ".foo", ".bar" with "a.o", and ".baz" with "b.o".
+// The semantics of that is section .foo in any file, section .bar in
+// any file but a.o, and section .baz in any file but b.o.
std::vector<SectionPattern> ScriptParser::readInputSectionsList() {
std::vector<SectionPattern> Ret;
while (!Error && peek() != ")") {
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=299579&r1=299578&r2=299579&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Apr 5 14:20:54 2017
@@ -446,8 +446,8 @@ bool X86TargetInfo::isTlsInitialExecRel(
void X86TargetInfo::writePltHeader(uint8_t *Buf) const {
if (Config->Pic) {
const uint8_t V[] = {
- 0xff, 0xb3, 0x04, 0x00, 0x00, 0x00, // pushl 4(%ebx)
- 0xff, 0xa3, 0x08, 0x00, 0x00, 0x00, // jmp *8(%ebx)
+ 0xff, 0xb3, 0x04, 0x00, 0x00, 0x00, // pushl GOTPLT+4(%ebx)
+ 0xff, 0xa3, 0x08, 0x00, 0x00, 0x00, // jmp *GOTPLT+8(%ebx)
0x90, 0x90, 0x90, 0x90 // nop
};
memcpy(Buf, V, sizeof(V));
@@ -460,8 +460,8 @@ void X86TargetInfo::writePltHeader(uint8
}
const uint8_t PltData[] = {
- 0xff, 0x35, 0x00, 0x00, 0x00, 0x00, // pushl (GOT+4)
- 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *(GOT+8)
+ 0xff, 0x35, 0x00, 0x00, 0x00, 0x00, // pushl (GOTPLT+4)
+ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *(GOTPLT+8)
0x90, 0x90, 0x90, 0x90 // nop
};
memcpy(Buf, PltData, sizeof(PltData));
@@ -720,15 +720,15 @@ void X86_64TargetInfo<ELFT>::writeGotPlt
template <class ELFT>
void X86_64TargetInfo<ELFT>::writePltHeader(uint8_t *Buf) const {
const uint8_t PltData[] = {
- 0xff, 0x35, 0x00, 0x00, 0x00, 0x00, // pushq GOT+8(%rip)
- 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *GOT+16(%rip)
- 0x0f, 0x1f, 0x40, 0x00 // nopl 0x0(rax)
+ 0xff, 0x35, 0x00, 0x00, 0x00, 0x00, // pushq GOTPLT+8(%rip)
+ 0xff, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp *GOTPLT+16(%rip)
+ 0x0f, 0x1f, 0x40, 0x00 // nop
};
memcpy(Buf, PltData, sizeof(PltData));
- uint64_t Got = In<ELFT>::GotPlt->getVA();
+ uint64_t GotPlt = In<ELFT>::GotPlt->getVA();
uint64_t Plt = In<ELFT>::Plt->getVA();
- write32le(Buf + 2, Got - Plt + 2); // GOT+8
- write32le(Buf + 8, Got - Plt + 4); // GOT+16
+ write32le(Buf + 2, GotPlt - Plt + 2); // GOTPLT+8
+ write32le(Buf + 8, GotPlt - Plt + 4); // GOTPLT+16
}
template <class ELFT>
@@ -2222,14 +2222,16 @@ void MipsTargetInfo<ELFT>::writePltHeade
write32<E>(Buf + 8, 0x279c0000); // addiu $28, $28, %lo(&GOTPLT[0])
write32<E>(Buf + 12, 0x031cc023); // subu $24, $24, $28
}
+
write32<E>(Buf + 16, 0x03e07825); // move $15, $31
write32<E>(Buf + 20, 0x0018c082); // srl $24, $24, 2
write32<E>(Buf + 24, 0x0320f809); // jalr $25
write32<E>(Buf + 28, 0x2718fffe); // subu $24, $24, 2
- uint64_t Got = In<ELFT>::GotPlt->getVA();
- writeMipsHi16<E>(Buf, Got);
- writeMipsLo16<E>(Buf + 4, Got);
- writeMipsLo16<E>(Buf + 8, Got);
+
+ uint64_t GotPlt = In<ELFT>::GotPlt->getVA();
+ writeMipsHi16<E>(Buf, GotPlt);
+ writeMipsLo16<E>(Buf + 4, GotPlt);
+ writeMipsLo16<E>(Buf + 8, GotPlt);
}
template <class ELFT>
More information about the llvm-commits
mailing list