Set ordinals of all File's created in MachO passes.

When we do debug printing of atoms, they expect their parent file
to have an ordinal.  Right now we trigger a bunch of asserts.

This doesn't actually manifest in differences in any real tests, but
even if the only thing it does is improve debuggability then its still
useful.

llvm-svn: 259450
This commit is contained in:
Pete Cooper
2016-02-02 01:52:40 +00:00
parent 68a8efa374
commit c7d4035e70
5 changed files with 15 additions and 5 deletions

View File

@@ -274,7 +274,9 @@ public:
CompactUnwindPass(const MachOLinkingContext &context)
: _ctx(context), _archHandler(_ctx.archHandler()),
_file("<mach-o Compact Unwind Pass>"),
_isBig(MachOLinkingContext::isBigEndian(_ctx.arch())) {}
_isBig(MachOLinkingContext::isBigEndian(_ctx.arch())) {
_file.setOrdinal(_ctx.getNextOrdinalAndIncrement());
}
private:
std::error_code perform(SimpleFile &mergedFile) override {

View File

@@ -91,7 +91,9 @@ class GOTPass : public Pass {
public:
GOTPass(const MachOLinkingContext &context)
: _ctx(context), _archHandler(_ctx.archHandler()),
_file("<mach-o GOT Pass>") {}
_file("<mach-o GOT Pass>") {
_file.setOrdinal(_ctx.getNextOrdinalAndIncrement());
}
private:
std::error_code perform(SimpleFile &mergedFile) override {

View File

@@ -42,7 +42,9 @@ class ShimPass : public Pass {
public:
ShimPass(const MachOLinkingContext &context)
: _ctx(context), _archHandler(_ctx.archHandler()),
_stubInfo(_archHandler.stubInfo()), _file("<mach-o shim pass>") {}
_stubInfo(_archHandler.stubInfo()), _file("<mach-o shim pass>") {
_file.setOrdinal(_ctx.getNextOrdinalAndIncrement());
}
std::error_code perform(SimpleFile &mergedFile) override {
// Scan all references in all atoms.

View File

@@ -199,7 +199,9 @@ class StubsPass : public Pass {
public:
StubsPass(const MachOLinkingContext &context)
: _ctx(context), _archHandler(_ctx.archHandler()),
_stubInfo(_archHandler.stubInfo()), _file("<mach-o Stubs pass>") {}
_stubInfo(_archHandler.stubInfo()), _file("<mach-o Stubs pass>") {
_file.setOrdinal(_ctx.getNextOrdinalAndIncrement());
}
std::error_code perform(SimpleFile &mergedFile) override {
// Skip this pass if output format uses text relocations instead of stubs.

View File

@@ -65,7 +65,9 @@ class TLVPass : public Pass {
public:
TLVPass(const MachOLinkingContext &context)
: _ctx(context), _archHandler(_ctx.archHandler()),
_file("<mach-o TLV Pass>") {}
_file("<mach-o TLV Pass>") {
_file.setOrdinal(_ctx.getNextOrdinalAndIncrement());
}
private:
std::error_code perform(SimpleFile &mergedFile) override {