<div dir="ltr">Oops, this is an accidental commit. This is part of commit r198104 and intended to be merged with it before submitting. Sorry about that.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 28, 2013 at 5:40 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">Author: ruiu<br>
Date: Sat Dec 28 02:40:23 2013<br>
New Revision: 198103<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=198103&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=198103&view=rev</a><br>
Log:<br>
temporary commit<br>
<br>
Modified:<br>
lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp<br>
lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h<br>
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp<br>
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp?rev=198103&r1=198102&r2=198103&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp?rev=198103&r1=198102&r2=198103&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp Sat Dec 28 02:40:23 2013<br>
@@ -32,6 +32,20 @@ static bool compare(const TableEntry &a,<br>
return a.exportName.compare(b.exportName) < 0;<br>
}<br>
<br>
+static void assignOrdinals(PECOFFLinkingContext &ctx) {<br>
+ std::set<PECOFFLinkingContext::ExportDesc> exports;<br>
+ int maxOrdinal = -1;<br>
+ for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports())<br>
+ maxOrdinal = std::max(maxOrdinal, desc.ordinal);<br>
+ int nextOrdinal = (maxOrdinal == -1) ? 1 : (maxOrdinal + 1);<br>
+ for (PECOFFLinkingContext::ExportDesc desc : ctx.getDllExports()) {<br>
+ if (desc.ordinal == -1)<br>
+ desc.ordinal = nextOrdinal++;<br>
+ exports.insert(desc);<br>
+ }<br>
+ ctx.getDllExports().swap(exports);<br>
+}<br>
+<br>
static bool getExportedAtoms(const PECOFFLinkingContext &ctx, MutableFile *file,<br>
std::vector<TableEntry> &ret) {<br>
std::map<StringRef, const DefinedAtom *> definedAtoms;<br>
@@ -121,6 +135,8 @@ EdataPass::createOrdinalTable(const std:<br>
}<br>
<br>
void EdataPass::perform(std::unique_ptr<MutableFile> &file) {<br>
+ assignOrdinals(_ctx);<br>
+<br>
std::vector<TableEntry> entries;<br>
if (!getExportedAtoms(_ctx, file.get(), entries))<br>
return;<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h?rev=198103&r1=198102&r2=198103&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h?rev=198103&r1=198102&r2=198103&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h (original)<br>
+++ lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h Sat Dec 28 02:40:23 2013<br>
@@ -66,7 +66,7 @@ public:<br>
<br>
class EdataPass : public lld::Pass {<br>
public:<br>
- EdataPass(const PECOFFLinkingContext &ctx)<br>
+ EdataPass(PECOFFLinkingContext &ctx)<br>
: _ctx(ctx), _file(ctx), _stringOrdinal(1024) {}<br>
<br>
virtual void perform(std::unique_ptr<MutableFile> &file);<br>
@@ -89,7 +89,7 @@ private:<br>
createOrdinalTable(const std::vector<edata::TableEntry> &entries,<br>
int ordinalBase);<br>
<br>
- const PECOFFLinkingContext &_ctx;<br>
+ PECOFFLinkingContext &_ctx;<br>
VirtualFile _file;<br>
int _stringOrdinal;<br>
mutable llvm::BumpPtrAllocator _alloc;<br>
<br>
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=198103&r1=198102&r2=198103&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=198103&r1=198102&r2=198103&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)<br>
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Sat Dec 28 02:40:23 2013<br>
@@ -32,20 +32,6 @@<br>
<br>
namespace lld {<br>
<br>
-static void assignOrdinals(PECOFFLinkingContext &ctx) {<br>
- std::set<PECOFFLinkingContext::ExportDesc> exports;<br>
- int maxOrdinal = -1;<br>
- for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports())<br>
- maxOrdinal = std::max(maxOrdinal, desc.ordinal);<br>
- int nextOrdinal = (maxOrdinal == -1) ? 1 : (maxOrdinal + 1);<br>
- for (PECOFFLinkingContext::ExportDesc desc : ctx.getDllExports()) {<br>
- if (desc.ordinal == -1)<br>
- desc.ordinal = nextOrdinal++;<br>
- exports.insert(desc);<br>
- }<br>
- ctx.getDllExports().swap(exports);<br>
-}<br>
-<br>
bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {<br>
if (_stackReserve < _stackCommit) {<br>
diagnostics << "Invalid stack size: reserve size must be equal to or "<br>
@@ -93,9 +79,6 @@ bool PECOFFLinkingContext::validateImpl(<br>
return false;<br>
}<br>
<br>
- // Assign default ordinals to export symbols.<br>
- assignOrdinals(*this);<br>
-<br>
_writer = createWriterPECOFF(*this);<br>
return true;<br>
}<br>
<br>
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=198103&r1=198102&r2=198103&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=198103&r1=198102&r2=198103&view=diff</a><br>
==============================================================================<br>
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)<br>
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Sat Dec 28 02:40:23 2013<br>
@@ -164,7 +164,7 @@ TEST_F(WinLinkParserTest, Export) {<br>
EXPECT_EQ(1U, exports.size());<br>
auto it = exports.begin();<br>
EXPECT_EQ("_foo", it->name);<br>
- EXPECT_EQ(1, it->ordinal);<br>
+ EXPECT_EQ(-1, it->ordinal);<br>
EXPECT_FALSE(it->noname);<br>
EXPECT_FALSE(it->isData);<br>
}<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">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>