OK'd by Mike in the PR thread.
Applied to trunk and 4.6
Iain
gcc:
PR target/45233
* config/rs6000/rs6000.c (rs6000_legitimize_reload_address):
Only expand a symbol ref. into an access when the entity is defined
in the TU.
PR bootstrap/50822
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 181311)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -6169,6 +6169,7 @@ rs6000_legitimize_reload_address (rtx x, enum mach
#if TARGET_MACHO
&& DEFAULT_ABI == ABI_DARWIN
&& (flag_pic || MACHO_DYNAMIC_NO_PIC_P)
+ && machopic_symbol_defined_p (x)
#else
&& DEFAULT_ABI == ABI_V4
&& !flag_pic