This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
fix Xtensa linker optimization for "absolute" literals
- From: Bob Wilson <bwilson at tensilica dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 03 Oct 2005 14:49:47 -0700
- Subject: fix Xtensa linker optimization for "absolute" literals
I'm committing this patch from David Heine to fix a performance problem in the
linker's optimization of Xtensa literals. The "absolute-mode" literals are not
PC-relative, but the code had been checking the range of the literal offset from
the PC anyway. Redundant literals not placed close to the code were not being
merged. Built and tested with an xtensa-elf target.
2005-10-03 David Heine <dlheine@tensilica.com>
* elf32-xtensa.c (relocations_reach): Skip range check for
absolute literals.
Index: elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.59
diff -u -p -r1.59 elf32-xtensa.c
--- elf32-xtensa.c 25 Aug 2005 02:32:10 -0000 1.59
+++ elf32-xtensa.c 3 Oct 2005 21:44:22 -0000
@@ -7462,6 +7462,11 @@ relocations_reach (source_reloc *reloc,
!= sec->output_section)
return FALSE;
+ /* Absolute literals in the same output section can always be
+ combined. */
+ if (reloc[i].is_abs_literal)
+ continue;
+
/* A literal with no PC-relative relocations can be moved anywhere. */
if (reloc[i].opnd != -1)
{