<div dir="ltr">On Tue, Oct 7, 2014 at 7:16 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Added a test in r<span style="color:rgb(0,0,0)">219274.</span></div></blockquote><div><br></div><div>Sorry, I didn't see the response earlier. Thanks for adding that!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><div class="gmail_quote">On Tue, Oct 7, 2014 at 12:55 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Nice. Can you add a test?</div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 7, 2014 at 12:37 PM, Saleem Abdulrasool <span dir="ltr"><<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: compnerd<br>
Date: Tue Oct 7 14:37:52 2014<br>
New Revision: 219228<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=219228&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=219228&view=rev</a><br>
Log:<br>
llvm-readobj: add support to dump (COFF) directives<br>
<br>
PE/COFF has a special section (.drectve) which can be used to pass options to<br>
the linker (similar to LC_LINKER_OPTION). Add support to llvm-readobj to print<br>
the contents of the section for tests.<br>
<br>
Modified:<br>
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp<br>
llvm/trunk/tools/llvm-readobj/ObjDumper.h<br>
llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=219228&r1=219227&r2=219228&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=219228&r1=219227&r2=219228&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)<br>
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Tue Oct 7 14:37:52 2014<br>
@@ -56,6 +56,7 @@ public:<br>
void printDynamicSymbols() override;<br>
void printUnwindInfo() override;<br>
void printCOFFImports() override;<br>
+ void printCOFFDirectives() override;<br>
<br>
private:<br>
void printSymbol(const SymbolRef &Sym);<br>
@@ -932,3 +933,21 @@ void COFFDumper::printCOFFImports() {<br>
printImportedSymbols(I->imported_symbol_begin(), I->imported_symbol_end());<br>
}<br>
}<br>
+<br>
+void COFFDumper::printCOFFDirectives() {<br>
+ for (const SectionRef &Section : Obj->sections()) {<br>
+ StringRef Contents;<br>
+ StringRef Name;<br>
+<br>
+ if (error(Section.getName(Name)))<br>
+ continue;<br>
+ if (Name != ".drectve")<br>
+ continue;<br>
+<br>
+ if (error(Section.getContents(Contents)))<br>
+ return;<br>
+<br>
+ W.printString("Directive(s)", Contents);<br>
+ }<br>
+}<br>
+<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/ObjDumper.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ObjDumper.h?rev=219228&r1=219227&r2=219228&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ObjDumper.h?rev=219228&r1=219227&r2=219228&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/ObjDumper.h (original)<br>
+++ llvm/trunk/tools/llvm-readobj/ObjDumper.h Tue Oct 7 14:37:52 2014<br>
@@ -45,6 +45,7 @@ public:<br>
<br>
// Only implemented for PE/COFF.<br>
virtual void printCOFFImports() { }<br>
+ virtual void printCOFFDirectives() { }<br>
<br>
protected:<br>
StreamWriter& W;<br>
<br>
Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=219228&r1=219227&r2=219228&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=219228&r1=219227&r2=219228&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)<br>
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Tue Oct 7 14:37:52 2014<br>
@@ -145,6 +145,11 @@ namespace opts {<br>
// -coff-imports<br>
cl::opt<bool><br>
COFFImports("coff-imports", cl::desc("Display the PE/COFF import table"));<br>
+<br>
+ // -coff-directives<br>
+ cl::opt<bool><br>
+ COFFDirectives("coff-directives",<br>
+ cl::desc("Display the contents PE/COFF .drectve section"));<br>
} // namespace opts<br>
<br>
static int ReturnValue = EXIT_SUCCESS;<br>
@@ -272,6 +277,8 @@ static void dumpObject(const ObjectFile<br>
Dumper->printMipsPLTGOT();<br>
if (opts::COFFImports)<br>
Dumper->printCOFFImports();<br>
+ if (opts::COFFDirectives)<br>
+ Dumper->printCOFFDirectives();<br>
}<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Saleem Abdulrasool<br>compnerd (at) compnerd (dot) org
</div></div>