This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PowerPC64 large toc optimization
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 1 Jul 2010 14:19:21 +0930
- Subject: Re: PowerPC64 large toc optimization
- References: <20100625052144.GH21855@bubble.grove.modra.org> <20100701041118.GE6954@bubble.grove.modra.org>
With large toc support, it is no longer appropriate for gas to warn
on encountering a ".toc" section that exceeds 64k in size.
* config/tc-ppc.c (toc_reloc_types): New variable.
(md_assemble): Set it.
(ppc_frob_file_before_adjust): Don't warn about toc section size
if we have large toc relocs and no small toc relocs.
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.168
diff -u -p -r1.168 tc-ppc.c
--- gas/config/tc-ppc.c 14 Jun 2010 14:48:03 -0000 1.168
+++ gas/config/tc-ppc.c 1 Jul 2010 04:44:29 -0000
@@ -183,6 +183,12 @@ int ppc_cie_data_alignment;
/* The type of processor we are assembling for. This is one or more
of the PPC_OPCODE flags defined in opcode/ppc.h. */
ppc_cpu_t ppc_cpu = 0;
+
+/* Flags set on encountering toc relocs. */
+enum {
+ has_large_toc_reloc = 1,
+ has_small_toc_reloc = 2
+} toc_reloc_types;
/* The target specific pseudo-ops which we support. */
@@ -2168,6 +2174,7 @@ ppc_frob_file_before_adjust (void)
toc = bfd_get_section_by_name (stdoutput, ".toc");
if (toc != NULL
+ && toc_reloc_types != has_large_toc_reloc
&& bfd_section_size (stdoutput, toc) > 0x10000)
as_warn (_("TOC section size exceeds 64k"));
@@ -2783,6 +2790,20 @@ md_assemble (char *str)
}
}
+ switch (reloc)
+ {
+ case BFD_RELOC_PPC_TOC16:
+ toc_reloc_types |= has_small_toc_reloc;
+ break;
+ case BFD_RELOC_PPC64_TOC16_LO:
+ case BFD_RELOC_PPC64_TOC16_HI:
+ case BFD_RELOC_PPC64_TOC16_HA:
+ toc_reloc_types |= has_large_toc_reloc;
+ break;
+ default:
+ break;
+ }
+
if (ppc_obj64
&& (operand->flags & (PPC_OPERAND_DS | PPC_OPERAND_DQ)) != 0)
{
--
Alan Modra
Australia Development Lab, IBM