https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68662
--- Comment #13 from Alan Modra <amodra at gcc dot gnu.org> --- Author: amodra Date: Tue Feb 2 00:01:16 2016 New Revision: 233061 URL: https://gcc.gnu.org/viewcvs?rev=233061&root=gcc&view=rev Log: [RS6000] ABI_V4 init of toc section Since 4c4a180d lto has turned off flag_pic when linking a fixed position executable. So flag_pic is zero in rs6000_file_start. However, when we get to actually emitting code, flag_pic may be on again. This results in undefined references to ".LCTOC1". PR target/68662 * config/rs6000/rs6000.c (need_toc_init): New var, set it whenever toc_label_name used. (rs6000_file_start): Don't set up toc section here, (rs6000_output_function_epilogue): do so here instead, (rs6000_xcoff_file_start): and here. * config/rs6000/rs6000.md (load_toc_aix_si): Set need_toc_init. (load_toc_aix_di): Likewise. Modified: trunk/gcc/ChangeLog trunk/gcc/config/rs6000/rs6000.c trunk/gcc/config/rs6000/rs6000.md