[lld] r198103 - temporary commit
Rui Ueyama
ruiu at google.com
Sat Dec 28 00:40:23 PST 2013
Author: ruiu
Date: Sat Dec 28 02:40:23 2013
New Revision: 198103
URL: http://llvm.org/viewvc/llvm-project?rev=198103&view=rev
Log:
temporary commit
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h
lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp?rev=198103&r1=198102&r2=198103&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.cpp Sat Dec 28 02:40:23 2013
@@ -32,6 +32,20 @@ static bool compare(const TableEntry &a,
return a.exportName.compare(b.exportName) < 0;
}
+static void assignOrdinals(PECOFFLinkingContext &ctx) {
+ std::set<PECOFFLinkingContext::ExportDesc> exports;
+ int maxOrdinal = -1;
+ for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports())
+ maxOrdinal = std::max(maxOrdinal, desc.ordinal);
+ int nextOrdinal = (maxOrdinal == -1) ? 1 : (maxOrdinal + 1);
+ for (PECOFFLinkingContext::ExportDesc desc : ctx.getDllExports()) {
+ if (desc.ordinal == -1)
+ desc.ordinal = nextOrdinal++;
+ exports.insert(desc);
+ }
+ ctx.getDllExports().swap(exports);
+}
+
static bool getExportedAtoms(const PECOFFLinkingContext &ctx, MutableFile *file,
std::vector<TableEntry> &ret) {
std::map<StringRef, const DefinedAtom *> definedAtoms;
@@ -121,6 +135,8 @@ EdataPass::createOrdinalTable(const std:
}
void EdataPass::perform(std::unique_ptr<MutableFile> &file) {
+ assignOrdinals(_ctx);
+
std::vector<TableEntry> entries;
if (!getExportedAtoms(_ctx, file.get(), entries))
return;
Modified: lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h?rev=198103&r1=198102&r2=198103&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/EdataPass.h Sat Dec 28 02:40:23 2013
@@ -66,7 +66,7 @@ public:
class EdataPass : public lld::Pass {
public:
- EdataPass(const PECOFFLinkingContext &ctx)
+ EdataPass(PECOFFLinkingContext &ctx)
: _ctx(ctx), _file(ctx), _stringOrdinal(1024) {}
virtual void perform(std::unique_ptr<MutableFile> &file);
@@ -89,7 +89,7 @@ private:
createOrdinalTable(const std::vector<edata::TableEntry> &entries,
int ordinalBase);
- const PECOFFLinkingContext &_ctx;
+ PECOFFLinkingContext &_ctx;
VirtualFile _file;
int _stringOrdinal;
mutable llvm::BumpPtrAllocator _alloc;
Modified: lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp?rev=198103&r1=198102&r2=198103&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/PECOFFLinkingContext.cpp Sat Dec 28 02:40:23 2013
@@ -32,20 +32,6 @@
namespace lld {
-static void assignOrdinals(PECOFFLinkingContext &ctx) {
- std::set<PECOFFLinkingContext::ExportDesc> exports;
- int maxOrdinal = -1;
- for (const PECOFFLinkingContext::ExportDesc &desc : ctx.getDllExports())
- maxOrdinal = std::max(maxOrdinal, desc.ordinal);
- int nextOrdinal = (maxOrdinal == -1) ? 1 : (maxOrdinal + 1);
- for (PECOFFLinkingContext::ExportDesc desc : ctx.getDllExports()) {
- if (desc.ordinal == -1)
- desc.ordinal = nextOrdinal++;
- exports.insert(desc);
- }
- ctx.getDllExports().swap(exports);
-}
-
bool PECOFFLinkingContext::validateImpl(raw_ostream &diagnostics) {
if (_stackReserve < _stackCommit) {
diagnostics << "Invalid stack size: reserve size must be equal to or "
@@ -93,9 +79,6 @@ bool PECOFFLinkingContext::validateImpl(
return false;
}
- // Assign default ordinals to export symbols.
- assignOrdinals(*this);
-
_writer = createWriterPECOFF(*this);
return true;
}
Modified: lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp?rev=198103&r1=198102&r2=198103&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/WinLinkDriverTest.cpp Sat Dec 28 02:40:23 2013
@@ -164,7 +164,7 @@ TEST_F(WinLinkParserTest, Export) {
EXPECT_EQ(1U, exports.size());
auto it = exports.begin();
EXPECT_EQ("_foo", it->name);
- EXPECT_EQ(1, it->ordinal);
+ EXPECT_EQ(-1, it->ordinal);
EXPECT_FALSE(it->noname);
EXPECT_FALSE(it->isData);
}
More information about the llvm-commits
mailing list