[lld] r207168 - [PECOFF] Assign unique ordinals to __imp_ symbols.
Rui Ueyama
ruiu at google.com
Thu Apr 24 18:18:40 PDT 2014
Author: ruiu
Date: Thu Apr 24 20:18:40 2014
New Revision: 207168
URL: http://llvm.org/viewvc/llvm-project?rev=207168&view=rev
Log:
[PECOFF] Assign unique ordinals to __imp_ symbols.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
Modified: lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h?rev=207168&r1=207167&r2=207168&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/LinkerGeneratedSymbolFile.h Thu Apr 24 20:18:40 2014
@@ -19,15 +19,19 @@ namespace pecoff {
/// The defined atom for dllexported symbols with __imp_ prefix.
class ImpPointerAtom : public COFFLinkerInternalAtom {
public:
- ImpPointerAtom(const File &file, StringRef symbolName)
+ ImpPointerAtom(const File &file, StringRef symbolName, uint64_t ordinal)
: COFFLinkerInternalAtom(file, /*oridnal*/ 0, std::vector<uint8_t>(4),
- symbolName) {}
+ symbolName),
+ _ordinal(ordinal) {}
- uint64_t ordinal() const override { return 0; }
+ uint64_t ordinal() const override { return _ordinal; }
Scope scope() const override { return scopeGlobal; }
ContentType contentType() const override { return typeData; }
Alignment alignment() const override { return Alignment(4); }
ContentPermissions permissions() const override { return permR__; }
+
+private:
+ uint64_t _ordinal;
};
// A virtual file containing absolute symbol __ImageBase. __ImageBase (or
@@ -40,6 +44,7 @@ public:
_imageBaseAtom(*this, ctx.decorateSymbol("__ImageBase"),
Atom::scopeGlobal, ctx.getBaseAddress()) {
addAtom(_imageBaseAtom);
+ _ordinal = 1;
// Create implciit symbols for exported symbols.
for (const PECOFFLinkingContext::ExportDesc &exp : ctx.getDllExports()) {
@@ -58,10 +63,11 @@ private:
std::string sym = "_imp_";
sym.append(name);
sym = ctx.decorateSymbol(sym);
- return new (_alloc) ImpPointerAtom(*this, ctx.allocate(sym));
+ return new (_alloc) ImpPointerAtom(*this, ctx.allocate(sym), _ordinal++);
}
COFFAbsoluteAtom _imageBaseAtom;
+ uint64_t _ordinal;
llvm::BumpPtrAllocator _alloc;
};
More information about the llvm-commits
mailing list