X-Git-Url: https://git.saurik.com/apple/ld64.git/blobdiff_plain/afe874b1634377ecb27057ee76deb04915bb34d7..b1f7435d66a93f03b77932b3a9ad8a83ce5e1ebc:/src/ld/passes/got.cpp diff --git a/src/ld/passes/got.cpp b/src/ld/passes/got.cpp index bb94ddf..4631d5b 100644 --- a/src/ld/passes/got.cpp +++ b/src/ld/passes/got.cpp @@ -52,8 +52,6 @@ public: { _fixup.weakImport = weakImport; internal.addAtom(*this); } virtual const ld::File* file() const { return NULL; } - virtual bool translationUnitSource(const char** dir, const char**) const - { return false; } virtual const char* name() const { return _target->name(); } virtual uint64_t size() const { return 8; } virtual uint64_t objectAddress() const { return 0; } @@ -89,8 +87,21 @@ static bool gotFixup(const Options& opts, ld::Internal& internal, const ld::Atom } if ( targetOfGOT->scope() == ld::Atom::scopeGlobal ) { // cannot do LEA optimization if target is weak exported symbol - if ( (targetOfGOT->definition() == ld::Atom::definitionRegular) && (targetOfGOT->combine() == ld::Atom::combineByName) ) - *optimizable = false; + if ( (targetOfGOT->definition() == ld::Atom::definitionRegular) && (targetOfGOT->combine() == ld::Atom::combineByName) ) { + switch ( opts.outputKind() ) { + case Options::kDynamicExecutable: + case Options::kDynamicLibrary: + case Options::kDynamicBundle: + case Options::kKextBundle: + *optimizable = false; + break; + case Options::kStaticExecutable: + case Options::kDyld: + case Options::kPreload: + case Options::kObjectFile: + break; + } + } // cannot do LEA optimization if target is interposable if ( opts.interposable(targetOfGOT->name()) ) *optimizable = false;