[PATCH] [lld] Make ELFLinkingContext own LinkerScript buffers
Shankar Kalpathi Easwaran
shankarke at gmail.com
Sun Feb 1 15:55:24 PST 2015
Adding a test might give more information on the functionality that you are trying to add too.
================
Comment at: include/lld/ReaderWriter/ELFLinkingContext.h:295-311
@@ -293,2 +294,19 @@
+ // We can parse several "implicit" linker scripts, which are all input files
+ // that are not recognized as objects or archives. These are stored in the
+ // ELFLinkingContext with addLinkerScriptInstance(). However, only one
+ // "master" linker script can override the default linker script, specified
+ // with -T in the command line and, here, by calling
+ // addMasterLinkerScript().
+ script::ScriptInstance &
+ addLinkerScriptInstance(std::unique_ptr<script::ScriptInstance> script) {
+ _scripts.push_back(std::move(script));
+ return *_scripts.back().get();
+ }
+ script::ScriptInstance &
+ addMasterLinkerScript(std::unique_ptr<script::ScriptInstance> script) {
+ _scripts.push_back(std::move(script));
+ _masterLinkerScript = _scripts.back().get();
+ return *_masterLinkerScript;
+ }
private:
----------------
Why do you recognize the master linker script from the rest ? The linker can use more than one -T option to specify more than one linker script too.
Input files that are linker scripts are positional too.
For example :
ld 1.o -lc
Where libc.so is a linker script that needs to be handled in command line order.
http://reviews.llvm.org/D7323
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list