ELF: Remove readLinkerScript and define LinkerScript::read instead.
llvm-svn: 260598
This commit is contained in:
parent
2f43208c9a
commit
f9de0d6904
|
@ -98,7 +98,7 @@ void LinkerDriver::addFile(StringRef Path) {
|
|||
|
||||
switch (identify_magic(MBRef.getBuffer())) {
|
||||
case file_magic::unknown:
|
||||
readLinkerScript(&Alloc, MBRef);
|
||||
Script->read(MBRef);
|
||||
return;
|
||||
case file_magic::archive:
|
||||
if (WholeArchive) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -370,7 +370,7 @@ static bool isUnderSysroot(StringRef Path) {
|
|||
}
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue