[lld] r260598 - ELF: Remove readLinkerScript and define LinkerScript::read instead.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 11 13:38:56 PST 2016
Author: ruiu
Date: Thu Feb 11 15:38:55 2016
New Revision: 260598
URL: http://llvm.org/viewvc/llvm-project?rev=260598&view=rev
Log:
ELF: Remove readLinkerScript and define LinkerScript::read instead.
Modified:
lld/trunk/ELF/Driver.cpp
lld/trunk/ELF/Driver.h
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/ELF/LinkerScript.h
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=260598&r1=260597&r2=260598&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Thu Feb 11 15:38:55 2016
@@ -98,7 +98,7 @@ void LinkerDriver::addFile(StringRef Pat
switch (identify_magic(MBRef.getBuffer())) {
case file_magic::unknown:
- readLinkerScript(&Alloc, MBRef);
+ Script->read(MBRef);
return;
case file_magic::archive:
if (WholeArchive) {
Modified: lld/trunk/ELF/Driver.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.h?rev=260598&r1=260597&r2=260598&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.h (original)
+++ lld/trunk/ELF/Driver.h Thu Feb 11 15:38:55 2016
@@ -53,9 +53,6 @@ enum {
#undef OPTION
};
-// Parses a linker script. Calling this function updates the Symtab and Config.
-void readLinkerScript(llvm::BumpPtrAllocator *A, MemoryBufferRef MB);
-
std::string findFromSearchPaths(StringRef Path);
std::string searchLibrary(StringRef Path);
std::string buildSysrootedPath(llvm::StringRef Dir, llvm::StringRef File);
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=260598&r1=260597&r2=260598&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Thu Feb 11 15:38:55 2016
@@ -370,7 +370,7 @@ static bool isUnderSysroot(StringRef Pat
}
// Entry point. The other functions or classes are private to this file.
-void elf2::readLinkerScript(BumpPtrAllocator *A, MemoryBufferRef MB) {
+void LinkerScript::read(MemoryBufferRef MB) {
StringRef Path = MB.getBufferIdentifier();
- ScriptParser(A, MB.getBuffer(), isUnderSysroot(Path)).run();
+ ScriptParser(&Alloc, MB.getBuffer(), isUnderSysroot(Path)).run();
}
Modified: lld/trunk/ELF/LinkerScript.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.h?rev=260598&r1=260597&r2=260598&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.h (original)
+++ lld/trunk/ELF/LinkerScript.h Thu Feb 11 15:38:55 2016
@@ -13,6 +13,8 @@
#include "lld/Core/LLVM.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/MapVector.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/MemoryBuffer.h"
namespace lld {
namespace elf2 {
@@ -23,6 +25,10 @@ class LinkerScript {
friend class ScriptParser;
public:
+ // Parses a linker script. Calling this function may update
+ // this object and Config.
+ void read(MemoryBufferRef MB);
+
StringRef getOutputSection(StringRef InputSection);
bool isDiscarded(StringRef InputSection);
int compareSections(StringRef A, StringRef B);
@@ -35,6 +41,8 @@ private:
// Inverse map of Sections.
llvm::DenseMap<StringRef, StringRef> RevSections;
+
+ llvm::BumpPtrAllocator Alloc;
};
extern LinkerScript *Script;
More information about the llvm-commits
mailing list