+
+ if (forDarwin) {
+ // Output stubs for dynamically-linked functions
+ unsigned j = 1;
+ for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end();
+ i != e; ++i, ++j)
+ {
+ O << "\t.symbol_stub\n";
+ O << "L" << *i << "$stub:\n";
+ O << "\t.indirect_symbol " << *i << "\n";
+ O << "\tjmp\t*L" << j << "$lz\n";
+ O << "L" << *i << "$stub_binder:\n";
+ O << "\tpushl\t$L" << j << "$lz\n";
+ O << "\tjmp\tdyld_stub_binding_helper\n";
+ O << "\t.section __DATA, __la_sym_ptr3,lazy_symbol_pointers\n";
+ O << "L" << j << "$lz:\n";
+ O << "\t.indirect_symbol " << *i << "\n";
+ O << "\t.long\tL" << *i << "$stub_binder\n";
+ }
+
+ O << "\n";
+
+ // Output stubs for external global variables
+ if (GVStubs.begin() != GVStubs.end())
+ O << ".data\n.non_lazy_symbol_pointer\n";
+ for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end();
+ i != e; ++i) {
+ O << "L" << *i << "$non_lazy_ptr:\n";
+ O << "\t.indirect_symbol " << *i << "\n";
+ O << "\t.long\t0\n";
+ }
+
+ // Output stubs for link-once variables
+ if (LinkOnceStubs.begin() != LinkOnceStubs.end())
+ O << ".data\n.align 2\n";
+ for (std::set<std::string>::iterator i = LinkOnceStubs.begin(),
+ e = LinkOnceStubs.end(); i != e; ++i) {
+ O << "L" << *i << "$non_lazy_ptr:\n"
+ << "\t.long\t" << *i << '\n';
+ }
+ }