* config/tc-arm.c (find_real_start): Check S_IS_LOCAL on
	symbolP as well as for names with a leading dot.  Use ACONCAT.
	(md_apply_fix): For branch relocations, only replace value
	with fixP->fx_offset (under #ifdef OBJ_ELF) when !fixP->fx_done.
	(arm_force_relocation): Remove #ifdef OBJ_ELF case.
	* config/tc-arm.h (LOCAL_LABEL): Remove unnecessary parentheses.
	(LOCAL_LABEL_PREFIX): Don't define.
gas/testsuite:
	* gas/arm/thumb.s: Only branch to labels defined in this file.
	* gas/arm/thumb.d, gas/arm/thumb32.d: Adjust expected output.
This commit is contained in:
Zack Weinberg
2005-06-13 15:34:39 +00:00
parent 7b5c6b52e4
commit 37f6032b85
7 changed files with 83 additions and 106 deletions

View File

@@ -1414,15 +1414,15 @@ find_real_start (symbolS * symbolP)
if (name == NULL)
abort ();
/* Names that start with '.' are local labels, not function entry points.
The compiler may generate BL instructions to these labels because it
needs to perform a branch to a far away location. */
if (name[0] == '.')
/* The compiler may generate BL instructions to local labels because
it needs to perform a branch to a far away location. These labels
do not have a corresponding ".real_start_of" label. We check
both for S_IS_LOCAL and for a leading dot, to give a way to bypass
the ".real_start_of" convention for nonlocal branches. */
if (S_IS_LOCAL (symbolP) || name[0] == '.')
return symbolP;
real_start = malloc (strlen (name) + strlen (STUB_NAME) + 1);
sprintf (real_start, "%s%s", STUB_NAME, name);
real_start = ACONCAT ((STUB_NAME, name, NULL));
new_target = symbol_find (real_start);
if (new_target == NULL)
@@ -1431,8 +1431,6 @@ find_real_start (symbolS * symbolP)
new_target = symbolP;
}
free (real_start);
return new_target;
}
@@ -10513,7 +10511,8 @@ md_apply_fix (fixS * fixP,
#define SEXT24(x) ((((x) & 0xffffff) ^ (~ 0x7fffff)) + 0x800000)
#ifdef OBJ_ELF
value = fixP->fx_offset;
if (!fixP->fx_done)
value = fixP->fx_offset;
#endif
/* We are going to store value (shifted right by two) in the
@@ -10583,7 +10582,8 @@ md_apply_fix (fixS * fixP,
newval = md_chars_to_number (buf, INSN_SIZE);
#ifdef OBJ_ELF
value = fixP->fx_offset;
if (!fixP->fx_done)
value = fixP->fx_offset;
#endif
hbit = (value >> 1) & 1;
value = (value >> 2) & 0x00ffffff;
@@ -10742,7 +10742,8 @@ md_apply_fix (fixS * fixP,
if (diff & 0x400000)
diff |= ~0x3fffff;
#ifdef OBJ_ELF
value = fixP->fx_offset;
if (!fixP->fx_done)
value = fixP->fx_offset;
#endif
value += diff;
@@ -11353,13 +11354,6 @@ arm_force_relocation (struct fix * fixp)
if (fixp->fx_r_type == BFD_RELOC_RVA)
return 1;
#endif
#ifdef OBJ_ELF
if (fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BRANCH
|| fixp->fx_r_type == BFD_RELOC_ARM_PCREL_BLX
|| fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BLX
|| fixp->fx_r_type == BFD_RELOC_THUMB_PCREL_BRANCH23)
return 1;
#endif
/* Resolve these relocations even if the symbol is extern or weak. */
if (fixp->fx_r_type == BFD_RELOC_ARM_IMMEDIATE