diff options
author | Nick Kledzik <kledzik@apple.com> | 2012-07-30 20:10:46 +0000 |
---|---|---|
committer | Nick Kledzik <kledzik@apple.com> | 2012-07-30 20:10:46 +0000 |
commit | 7243b8945915c323d52200c21121129c88485200 (patch) | |
tree | 4214447ec4205cbf73580ec897c5b591b192c98c /lld | |
parent | d79864c59b8ebf67ce191211770df7b8dcd71956 (diff) | |
download | bcm5719-llvm-7243b8945915c323d52200c21121129c88485200.tar.gz bcm5719-llvm-7243b8945915c323d52200c21121129c88485200.zip |
PR13467: Fix mach-o writer to handle case of zero stubs. Renumber TestingHelpers kind values
llvm-svn: 160982
Diffstat (limited to 'lld')
-rw-r--r-- | lld/lib/ReaderWriter/MachO/StubsPass.hpp | 3 | ||||
-rw-r--r-- | lld/test/darwin/hello-world.objtxt | 2 | ||||
-rw-r--r-- | lld/tools/lld-core/TestingHelpers.hpp | 14 |
3 files changed, 11 insertions, 8 deletions
diff --git a/lld/lib/ReaderWriter/MachO/StubsPass.hpp b/lld/lib/ReaderWriter/MachO/StubsPass.hpp index e728796b0af..fe48627843d 100644 --- a/lld/lib/ReaderWriter/MachO/StubsPass.hpp +++ b/lld/lib/ReaderWriter/MachO/StubsPass.hpp @@ -117,6 +117,9 @@ public: virtual void addStubAtoms(File &mergedFile) { + // Exit early if no stubs needed. + if ( _targetToStub.size() == 0 ) + return; // Add all stubs to master file. for (auto it : _targetToStub) { mergedFile.addAtom(*it.second); diff --git a/lld/test/darwin/hello-world.objtxt b/lld/test/darwin/hello-world.objtxt index bb114843750..49df58b85e3 100644 --- a/lld/test/darwin/hello-world.objtxt +++ b/lld/test/darwin/hello-world.objtxt @@ -1,4 +1,4 @@ -# RUN: lld-core -platform darwin -stubs-pass %s -o %t && llvm-nm %t | FileCheck %s +# RUN: lld-core -writer=mach-o -stubs-pass %s -o %t && llvm-nm %t | FileCheck %s # # Test that hello-world can be linked into a mach-o executable diff --git a/lld/tools/lld-core/TestingHelpers.hpp b/lld/tools/lld-core/TestingHelpers.hpp index 20f4d570aeb..9e373585c7f 100644 --- a/lld/tools/lld-core/TestingHelpers.hpp +++ b/lld/tools/lld-core/TestingHelpers.hpp @@ -275,11 +275,11 @@ struct TestingKindMapping { // Table of fixup kinds in YAML documents used for testing // const TestingKindMapping sKinds[] = { - { "call32", 1, true, false, false}, - { "pcrel32", 2, false, false, false }, - { "gotLoad32", 3, false, true, true }, - { "gotUse32", 4, false, false, true }, - { "lea32wasGot", 5, false, false, false }, + { "call32", 2, true, false, false}, + { "pcrel32", 3, false, false, false }, + { "gotLoad32", 7, false, true, true }, + { "gotUse32", 9, false, false, true }, + { "lea32wasGot", 8, false, false, false }, { nullptr, 0, false, false, false } }; @@ -336,9 +336,9 @@ public: virtual void updateReferenceToGOT(const Reference *ref, bool targetIsNowGOT) { if ( targetIsNowGOT ) - (const_cast<Reference*>(ref))->setKind(2); // pcrel32 + (const_cast<Reference*>(ref))->setKind(3); // pcrel32 else - (const_cast<Reference*>(ref))->setKind(5); // lea32wasGot + (const_cast<Reference*>(ref))->setKind(8); // lea32wasGot } virtual const DefinedAtom* makeGOTEntry(const Atom &target) { |