+
+ -- As long as we're in a shared library ourselves,
+ -- we can use the plt.
+ -- NOTE: We might want to disable this, because this
+ -- prevents -fPIC code from being linked statically.
+ | isJump && labelDynamic lbl && opt_PIC = AccessViaStub
+
+ -- TODO: it would be OK to access non-Haskell code via a stub
+-- | isJump && labelDynamic lbl && not isHaskellCode lbl = AccessViaStub
+
+ -- Using code stubs for jumps from the main program to an entry
+ -- label in a dynamic library is deadly; this will cause the dynamic
+ -- linker to replace all references (even data references) to that
+ -- label by references to the stub, so we won't find our info tables
+ -- any more.
+#endif
+
+ -- A dynamic label needs to be accessed via a symbol pointer.
+ -- NOTE: It would be OK to jump to foreign code via a PLT stub.
+ | labelDynamic lbl = AccessViaSymbolPtr
+
+#if powerpc_ARGET_ARCH
+ -- For PowerPC32 -fPIC, we have to access even static data
+ -- via a symbol pointer (see below for an explanation why
+ -- PowerPC32 Linux is especially broken).
+ | opt_PIC && not isJump = AccessViaSymbolPtr