[PATCH] Make Linkerscript accessible from LinkingContext
Davide Italiano
davide at freebsd.org
Sun Jan 25 21:06:00 PST 2015
Hi rafaelauler, ruiu, rui314,
Put a pointer to linker script AST into the LinkingContext, so everyone can access linker script information.
This is the first step needed to implement semantic actions for Linker Script constructs.
http://reviews.llvm.org/D7167
Files:
include/lld/Core/LinkingContext.h
lib/Driver/GnuLdDriver.cpp
Index: include/lld/Core/LinkingContext.h
===================================================================
--- include/lld/Core/LinkingContext.h
+++ include/lld/Core/LinkingContext.h
@@ -17,6 +17,7 @@
#include "lld/Core/Reference.h"
#include "lld/Core/range.h"
#include "lld/Core/Reader.h"
+#include "lld/ReaderWriter/LinkerScript.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
@@ -326,6 +327,13 @@
TaskGroup &getTaskGroup() { return _taskGroup; }
+ // LinkerScript
+ script::LinkerScript *getLinkerScriptAST() { return _linkerScript; };
+
+ void setLinkerScriptAST(script::LinkerScript *script) {
+ _linkerScript = script;
+ }
+
/// @}
protected:
LinkingContext(); // Must be subclassed
@@ -344,6 +352,7 @@
/// Method to create an internal file for alias symbols
std::unique_ptr<File> createAliasSymbolFile() const;
+ script::LinkerScript *_linkerScript;
StringRef _outputPath;
StringRef _entrySymbolName;
bool _deadStrip;
Index: lib/Driver/GnuLdDriver.cpp
===================================================================
--- lib/Driver/GnuLdDriver.cpp
+++ lib/Driver/GnuLdDriver.cpp
@@ -286,6 +286,9 @@
if (auto *group = dyn_cast<script::Group>(c))
if (std::error_code ec = evaluateLinkerScriptGroup(ctx, path, group, diag))
return ec;
+
+ // LinkerScript is now accessible from LinkingContext.
+ ctx.setLinkerScriptAST(script);
return std::error_code();
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7167.18737.patch
Type: text/x-patch
Size: 1480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150126/98f02fa1/attachment.bin>
More information about the llvm-commits
mailing list