This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Xtensa Patch]: Be less strict with difference of two symbols involving constants
- From: Sterling Augustine <sterling at tensilica dot com>
- To: <binutils at sourceware dot org>
- Date: Tue, 22 Sep 2009 14:54:38 -0700
- Subject: [Xtensa Patch]: Be less strict with difference of two symbols involving constants
GCC top of trunk has recently started producing expressions of the form
(post VTA merge):
.4byte .Lfoo - constant - .Lbar
The Xtensa port of gas had been rejecting expressions of this form
because the linker relaxation contained no mechanism to cope with the
constant. This was preventing GCC top of trunk from building for Xtensa.
It seems that the Xtensa port is being too strict here, and the GCC code
does work as intended. I have therefore committed the attached patch
which removes this restriction. GCC top of trunk now builds.
Sterling
2009-09-22 Sterling Augustine <sterling@jaw.hq.tensilica.com>
* config/tc-xtensa.c (md_apply_fix): Remove check for constant
with difference of of two symbols.
(xtensa_fix_adjustable): Likewise.
Index: tc-xtensa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-xtensa.c,v
retrieving revision 1.116
diff -u -p -r1.116 tc-xtensa.c
--- tc-xtensa.c 2 Sep 2009 07:24:20 -0000 1.116
+++ tc-xtensa.c 22 Sep 2009 21:45:51 -0000
@@ -5775,14 +5775,6 @@ xtensa_elf_section_change_hook (void)
bfd_boolean
xtensa_fix_adjustable (fixS *fixP)
{
- /* An offset is not allowed in combination with the difference of two
- symbols, but that cannot be easily detected after a local symbol
- has been adjusted to a (section+offset) form. Return 0 so that such
- an fix will not be adjusted. */
- if (fixP->fx_subsy && fixP->fx_addsy && fixP->fx_offset
- && relaxable_section (S_GET_SEGMENT (fixP->fx_subsy)))
- return 0;
-
/* We need the symbol name for the VTABLE entries. */
if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
@@ -5843,15 +5835,6 @@ md_apply_fix (fixS *fixP, valueT *valP,
break;
}
- /* An offset is only allowed when it results from adjusting a
- local symbol into a section-relative offset. If the offset
- came from the original expression, tc_fix_adjustable will have
- prevented the fix from being converted to a section-relative
- form so that we can flag the error here. */
- if (fixP->fx_offset != 0 && !symbol_section_p (fixP->fx_addsy))
- as_bad_where (fixP->fx_file, fixP->fx_line,
- _("cannot represent subtraction with an offset"));
-
val = (S_GET_VALUE (fixP->fx_addsy) + fixP->fx_offset
- S_GET_VALUE (fixP->fx_subsy));