This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix ppc64 undefined .LCTOC0 failures (PR target/17751)
On Tue, Oct 12, 2004 at 06:51:12PM -0400, David Edelsohn wrote:
> The original problem is an attempt at being too clever by half to
> avoid defining the TOC section. Making the logic even more complicated is
> not the right direction. GCC on AIX calls toc_section() from
> rs6000_xcoff_file_start() to always define the section. Please do not
> sprinkle ensure_toc_section() throughout the code and instead extend the
> AIX solution.
Ok.
> I would recommend moving the initialization to
> rs6000_file_start(), protected by
>
> if (DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
>
> and removing the duplicate from rs6000_xcoff_file_start().
> Also, removing
> the conditional definition from emit_load_toc_table().
I'm not sure this is possible with
if ((DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic == 2))
&& !toc_initialized)
{
toc_section ();
function_section (current_function_decl);
}
in rs6000_file_start.
emit_load_toc_table is called e.g. for:
if ((TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
|| (DEFAULT_ABI == ABI_V4 && flag_pic == 1
&& regs_ever_live[RS6000_PIC_OFFSET_TABLE_REGNUM]))
or:
"(DEFAULT_ABI == ABI_V4 && flag_pic == 1)
|| (TARGET_TOC && TARGET_MINIMAL_TOC)
so the condition in rs6000_file_start would need to be probably:
(DEFAULT_ABI == ABI_AIX || (TARGET_ELF && flag_pic))
to cover e.g. linux -m32 -fpic as well.
Jakub