* 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

@ -1,3 +1,13 @@
2005-06-13 Zack Weinberg <zack@codesourcery.com>
* 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.
2005-06-10 Alan Modra <amodra@bigpond.net.au> 2005-06-10 Alan Modra <amodra@bigpond.net.au>
* config/tc-hppa.c (pa_block): Allocate just one byte for the * config/tc-hppa.c (pa_block): Allocate just one byte for the

View file

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

View file

@ -127,7 +127,7 @@ struct fix;
#define OPTIONAL_REGISTER_PREFIX '%' #define OPTIONAL_REGISTER_PREFIX '%'
#define LOCAL_LABEL(name) (name[0] == '.' && (name[1] == 'L')) #define LOCAL_LABEL(name) (name[0] == '.' && name[1] == 'L')
#define LOCAL_LABELS_FB 1 #define LOCAL_LABELS_FB 1
/* This expression evaluates to true if the relocation is for a local /* This expression evaluates to true if the relocation is for a local
@ -168,7 +168,6 @@ struct fix;
# define md_elf_section_change_hook() arm_elf_change_section () # define md_elf_section_change_hook() arm_elf_change_section ()
# define md_elf_section_type(str, len) arm_elf_section_type (str, len) # define md_elf_section_type(str, len) arm_elf_section_type (str, len)
# define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_" # define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
# define LOCAL_LABEL_PREFIX '.'
# define TC_SEGMENT_INFO_TYPE struct arm_segment_info_type # define TC_SEGMENT_INFO_TYPE struct arm_segment_info_type
enum mstate enum mstate

View file

@ -1,3 +1,8 @@
2005-06-13 Zack Weinberg <zack@codesourcery.com>
* gas/arm/thumb.s: Only branch to labels defined in this file.
* gas/arm/thumb.d, gas/arm/thumb32.d: Adjust expected output.
2005-06-01 Maciej W. Rozycki <macro@linux-mips.org> 2005-06-01 Maciej W. Rozycki <macro@linux-mips.org>
* gas/mips/ldstla-32-1.l: Update to handle leading zeroes. * gas/mips/ldstla-32-1.l: Update to handle leading zeroes.

View file

@ -119,68 +119,41 @@ Disassembly of section \.text:
0+0de <[^>]+> 2f68 cmp r7, #104 0+0de <[^>]+> 2f68 cmp r7, #104
0+0e0 <[^>]+> 46c0 nop \(mov r8, r8\) 0+0e0 <[^>]+> 46c0 nop \(mov r8, r8\)
0+0e2 <[^>]+> 46c0 nop \(mov r8, r8\) 0+0e2 <[^>]+> 46c0 nop \(mov r8, r8\)
0+0e4 <[^>]+> ea000037 b 0+0e4 <[^>]+> 0+0e4 <[^>]+> eafffffe b 0+0e4 <[^>]+>
e4: R_ARM_PC24 \.text 0+0e8 <[^>]+> ea000011 b 0+134 <[^>]+>
0+0e8 <[^>]+> eafffffe b 0+000 <[^>]+> 0+0ec <[^>]+> ebfffffc bl 0+0e4 <[^>]+>
e8: R_ARM_PC24 \.wombat 0+0f0 <[^>]+> eb00000f bl 0+134 <[^>]+>
0+0ec <[^>]+> eb000037 bl 0+0e4 <[^>]+>
ec: R_ARM_PC24 \.text
0+0f0 <[^>]+> ebfffffe bl 0+000 <[^>]+>
f0: R_ARM_PC24 \.wombat
0+0f4 <[^>]+> e12fff10 bx r0 0+0f4 <[^>]+> e12fff10 bx r0
0+0f8 <[^>]+> ef123456 swi 0x00123456 0+0f8 <[^>]+> ef123456 swi 0x00123456
0+0fc <[^>]+> a004 add r0, pc, #16 \(adr r0,0+110 <[^>]+>\) 0+0fc <[^>]+> a004 add r0, pc, #16 \(adr r0,0+110 <[^>]+>\)
0+0fe <[^>]+> e77f b.n 0+000 <[^>]+> 0+0fe <[^>]+> e77f b.n 0+000 <[^>]+>
0+100 <[^>]+> e7fe b.n 0+000 <[^>]+> 0+100 <[^>]+> e018 b.n 0+134 <[^>]+>
100: R_ARM_THM_JUMP11 \.wombat 0+102 <[^>]+> f7ff ff7d bl 0+000 <[^>]+>
0+102 <[^>]+> f7ff fffe bl 0+000 <[^>]+> 0+106 <[^>]+> f000 f815 bl 0+134 <[^>]+>
102: R_ARM_THM_CALL \.text
0+106 <[^>]+> f7ff fffe bl 0+000 <[^>]+>
106: R_ARM_THM_CALL \.wombat
0+10a <[^>]+> 4700 bx r0 0+10a <[^>]+> 4700 bx r0
0+10c <[^>]+> dfff swi 255 0+10c <[^>]+> dfff swi 255
\.\.\. \.\.\.
0+110 <[^>]+> d0fe beq.n 0+000 <[^>]+> 0+110 <[^>]+> d010 beq.n 0+134 <[^>]+>
110: R_ARM_THM_JUMP8 \.wombat 0+112 <[^>]+> d10f bne.n 0+134 <[^>]+>
0+112 <[^>]+> d1fe bne.n 0+000 <[^>]+> 0+114 <[^>]+> d20e bcs.n 0+134 <[^>]+>
112: R_ARM_THM_JUMP8 \.wombat 0+116 <[^>]+> d30d bcc.n 0+134 <[^>]+>
0+114 <[^>]+> d2fe bcs.n 0+000 <[^>]+> 0+118 <[^>]+> d40c bmi.n 0+134 <[^>]+>
114: R_ARM_THM_JUMP8 \.wombat 0+11a <[^>]+> d50b bpl.n 0+134 <[^>]+>
0+116 <[^>]+> d3fe bcc.n 0+000 <[^>]+> 0+11c <[^>]+> d60a bvs.n 0+134 <[^>]+>
116: R_ARM_THM_JUMP8 \.wombat 0+11e <[^>]+> d709 bvc.n 0+134 <[^>]+>
0+118 <[^>]+> d4fe bmi.n 0+000 <[^>]+> 0+120 <[^>]+> d808 bhi.n 0+134 <[^>]+>
118: R_ARM_THM_JUMP8 \.wombat 0+122 <[^>]+> d907 bls.n 0+134 <[^>]+>
0+11a <[^>]+> d5fe bpl.n 0+000 <[^>]+> 0+124 <[^>]+> da06 bge.n 0+134 <[^>]+>
11a: R_ARM_THM_JUMP8 \.wombat 0+126 <[^>]+> dc05 bgt.n 0+134 <[^>]+>
0+11c <[^>]+> d6fe bvs.n 0+000 <[^>]+> 0+128 <[^>]+> db04 blt.n 0+134 <[^>]+>
11c: R_ARM_THM_JUMP8 \.wombat 0+12a <[^>]+> dc03 bgt.n 0+134 <[^>]+>
0+11e <[^>]+> d7fe bvc.n 0+000 <[^>]+> 0+12c <[^>]+> dd02 ble.n 0+134 <[^>]+>
11e: R_ARM_THM_JUMP8 \.wombat 0+12e <[^>]+> d801 bhi.n 0+134 <[^>]+>
0+120 <[^>]+> d8fe bhi.n 0+000 <[^>]+> 0+130 <[^>]+> d300 bcc.n 0+134 <[^>]+>
120: R_ARM_THM_JUMP8 \.wombat 0+132 <[^>]+> d3ff bcc.n 0+134 <[^>]+>
0+122 <[^>]+> d9fe bls.n 0+000 <[^>]+> 0+134 <[^>]+> f000 fc00 bl 0+938 <[^>]+>
122: R_ARM_THM_JUMP8 \.wombat
0+124 <[^>]+> dafe bge.n 0+000 <[^>]+>
124: R_ARM_THM_JUMP8 \.wombat
0+126 <[^>]+> dcfe bgt.n 0+000 <[^>]+>
126: R_ARM_THM_JUMP8 \.wombat
0+128 <[^>]+> dbfe blt.n 0+000 <[^>]+>
128: R_ARM_THM_JUMP8 \.wombat
0+12a <[^>]+> dcfe bgt.n 0+000 <[^>]+>
12a: R_ARM_THM_JUMP8 \.wombat
0+12c <[^>]+> ddfe ble.n 0+000 <[^>]+>
12c: R_ARM_THM_JUMP8 \.wombat
0+12e <[^>]+> d8fe bhi.n 0+000 <[^>]+>
12e: R_ARM_THM_JUMP8 \.wombat
0+130 <[^>]+> d3fe bcc.n 0+000 <[^>]+>
130: R_ARM_THM_JUMP8 \.wombat
0+132 <[^>]+> d3fe bcc.n 0+000 <[^>]+>
132: R_ARM_THM_JUMP8 \.wombat
0+134 <[^>]+> f000 fc9a bl 0+938 <[^>]+>
134: R_ARM_THM_CALL \.text
\.\.\. \.\.\.
0+938 <[^>]+> f000 f898 bl 0+134 <[^>]+> 0+938 <[^>]+> f7ff fbfc bl 0+134 <[^>]+>
938: R_ARM_THM_CALL \.text
0+93c <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+944 <[^>]+>\) 0+93c <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+944 <[^>]+>\)
0+93e <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+944 <[^>]+>\) 0+93e <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+944 <[^>]+>\)
0+940 <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+948 <[^>]+>\) 0+940 <[^>]+> 4801 ldr r0, \[pc, #4\] \(0+948 <[^>]+>\)

View file

@ -145,9 +145,9 @@ near:
.arm .arm
.localbar: .localbar:
b .localbar b .localbar
b .wombat b .back
bl .localbar bl .localbar
bl .wombat bl .back
bx r0 bx r0
swi 0x123456 swi 0x123456
@ -159,33 +159,33 @@ morethumb:
adr r0, forwardonly adr r0, forwardonly
b .foo b .foo
b .wombat b .back
bl .foo bl .foo
bl .wombat bl .back
bx r0 bx r0
swi 0xff swi 0xff
.align 0 .align 0
forwardonly: forwardonly:
beq .wombat beq .back
bne .wombat bne .back
bcs .wombat bcs .back
bcc .wombat bcc .back
bmi .wombat bmi .back
bpl .wombat bpl .back
bvs .wombat bvs .back
bvc .wombat bvc .back
bhi .wombat bhi .back
bls .wombat bls .back
bge .wombat bge .back
bgt .wombat bgt .back
blt .wombat blt .back
bgt .wombat bgt .back
ble .wombat ble .back
bhi .wombat bhi .back
blo .wombat blo .back
bul .wombat bul .back
.back: .back:
bl .local bl .local

View file

@ -295,14 +295,10 @@ Disassembly of section .text:
0+3cc <[^>]+> f340 800c ble\.w 0+3e8 <[^>]+> 0+3cc <[^>]+> f340 800c ble\.w 0+3e8 <[^>]+>
0+3d0 <[^>]+> f7ff bfae b\.w 0+330 <[^>]+> 0+3d0 <[^>]+> f7ff bfae b\.w 0+330 <[^>]+>
0+3d4 <[^>]+> f000 b808 b\.w 0+3e8 <[^>]+> 0+3d4 <[^>]+> f000 b808 b\.w 0+3e8 <[^>]+>
0+3d8 <[^>]+> f000 f996 bl 0+330 <[^>]+> 0+3d8 <[^>]+> f7ff ffaa bl 0+330 <[^>]+>
3d8: R_ARM_THM_CALL \.text 0+3dc <[^>]+> f000 f804 bl 0+3e8 <[^>]+>
0+3dc <[^>]+> f000 f9f2 bl 0+3e8 <[^>]+> 0+3e0 <[^>]+> f7ff efa6 blx 0+330 <[^>]+>
3dc: R_ARM_THM_CALL \.text 0+3e4 <[^>]+> f000 e800 blx 0+3e8 <[^>]+>
0+3e0 <[^>]+> f000 e996 blx 0+330 <[^>]+>
3e0: R_ARM_THM_XPC22 \.text
0+3e4 <[^>]+> f000 e9f2 blx 0+3e8 <[^>]+>
3e4: R_ARM_THM_XPC22 \.text
0+3e8 <[^>]+> 4748 bx r9 0+3e8 <[^>]+> 4748 bx r9
0+3ea <[^>]+> 4780 blx r0 0+3ea <[^>]+> 4780 blx r0
0+3ec <[^>]+> 47c8 blx r9 0+3ec <[^>]+> 47c8 blx r9