2005-12-12 Paul Brook <paul@codesourcery.com>

bfd/
	* bfd-in2.h: Regenerate.
	* elf32-arm.c (elf32_arm_reloc_map): Add BFD_RELOC_ARM_PCREL_CALL and
	BFD_RELOC_ARM_PCREL_JUMP.
	(check_use_blx): New function.
	(bfd_elf32_arm_process_before_allocation): Don't allocate glue if
	using BLX.
	(elf32_arm_final_link_relocate): Perform bl<->blx conversion for
	R_ARM_CALL and R_ARM_THM.
	(elf32_arm_get_eabi_attr_int): New function.
	(elf32_arm_size_dynamic_sections): Call check_use_blx.
	* libbfd.h: Regenerate.
	* reloc.c: Add BFD_RELOC_ARM_PCREL_CALL and BFD_RELOC_ARM_PCREL_JUMP.
gas/
	* config/tc-arm.c (do_branch): Generate EABI branch relocations.
	(do_bl): New function.
	(do_blx): Generate BFD_RELOC_ARM_PCREL_CALL relocation.
	(do_t_blx): Generate BFD_RELOC_THUMB_PCREL_BRANCH23.
	(insns): Use do_bl.
	(md_pcrel_from_section): Add BFD_RELOC_ARM_PCREL_CALL and
	BFD_RELOC_ARM_PCREL_JUMP.
	(md_apply_fix): Merge BFD_RELOC_ARM_PCREL_BRANCH and
	BFD_RELOC_ARM_PCREL_BLX cases.  Handle BFD_RELOC_ARM_PCREL_CALL and
	BFD_RELOC_ARM_PCREL_JUMP.
	(tc_gen_reloc): Handle BFD_RELOC_ARM_PCREL_CALL and
	BFD_RELOC_ARM_PCREL_JUMP.
	gas/testsuite/
	* gas/arm/pic.d: Allow R_ARM_CALL relocations.
include/elf/
	* arm.h (elf32_arm_get_eabi_attr_int): Add prototype.
ld/testsuite/
	* ld-arm/arm-call.d: New test.
	* ld-arm/arm-call1.s: New file.
	* ld-arm/arm-call1.s: New file.
	* ld-arm/arm-elf.exp: Add arm-call and mixed-app-v5.
	* ld-arm/arm.ld: Add .glue_7 and .ARM.attribues.
	* ld-arm/mixed-app-v5.d: New file.
	* ld-arm/mixed-app.r: Tweak expected output.
This commit is contained in:
Paul Brook
2005-12-12 17:03:40 +00:00
parent 4970f871a7
commit 39b41c9ca8
18 changed files with 377 additions and 55 deletions

View File

@@ -1,3 +1,13 @@
2005-12-12 Paul Brook <paul@codesourcery.com>
* ld-arm/arm-call.d: New test.
* ld-arm/arm-call1.s: New file.
* ld-arm/arm-call1.s: New file.
* ld-arm/arm-elf.exp: Add arm-call and mixed-app-v5.
* ld-arm/arm.ld: Add .glue_7 and .ARM.attribues.
* ld-arm/mixed-app-v5.d: New file.
* ld-arm/mixed-app.r: Tweak expected output.
2005-11-18 Alan Modra <amodra@bigpond.net.au>
* ld-powerpc/symtocbase.d: Adjust for alignment change.

View File

@@ -0,0 +1,58 @@
.*: file format.*
Disassembly of section .text:
00008000 <_start>:
8000: eb00000d bl 803c <arm>
8004: fa00000d blx 8040 <t1>
8008: fb00000c blx 8042 <t2>
800c: fb00000d blx 804a <t5>
8010: fa00000a blx 8040 <t1>
8014: fb000009 blx 8042 <t2>
8018: ea00000f b 805c <__t1_from_arm>
801c: ea000011 b 8068 <__t2_from_arm>
8020: 1b00000d blne 805c <__t1_from_arm>
8024: 1b00000f blne 8068 <__t2_from_arm>
8028: 1b000003 blne 803c <arm>
802c: eb000002 bl 803c <arm>
8030: faffffff blx 8034 <thumblocal>
00008034 <thumblocal>:
8034: 4770 bx lr
00008036 <t3>:
8036: 4770 bx lr
00008038 <t4>:
8038: 4770 bx lr
803a: 46c0 nop \(mov r8, r8\)
0000803c <arm>:
803c: e12fff1e bx lr
00008040 <t1>:
8040: 4770 bx lr
00008042 <t2>:
8042: f7ff fff8 bl 8036 <t3>
8046: f7ff fff7 bl 8038 <t4>
0000804a <t5>:
804a: f000 f801 bl 8050 <local_thumb>
804e: 46c0 nop \(mov r8, r8\)
00008050 <local_thumb>:
8050: f7ff fff1 bl 8036 <t3>
8054: f7ff efd4 blx 8000 <_start>
8058: f7ff efd2 blx 8000 <_start>
0000805c <__t1_from_arm>:
805c: e59fc000 ldr ip, \[pc, #0\] ; 8064 <__t1_from_arm\+0x8>
8060: e12fff1c bx ip
8064: 00008041 andeq r8, r0, r1, asr #32
00008068 <__t2_from_arm>:
8068: e59fc000 ldr ip, \[pc, #0\] ; 8070 <__t2_from_arm\+0x8>
806c: e12fff1c bx ip
8070: 00008043 andeq r8, r0, r3, asr #32

View File

@@ -0,0 +1,30 @@
# Test R_ARM_CALL and R_ARM_JUMP24 relocations and interworking
.text
.arch armv5t
.global _start
_start:
bl arm
bl t1
bl t2
bl t5
blx t1
blx t2
b t1
b t2
blne t1
blne t2
blne arm
blx arm
blx thumblocal
.thumb
thumblocal:
bx lr
.global t3
.thumb_func
t3:
bx lr
.global t4
.thumb_func
t4:
bx lr
nop

View File

@@ -0,0 +1,24 @@
.text
.arch armv5t
.global arm
.global t1
.global t2
.global t5
arm:
bx lr
.thumb
.thumb_func
t1:
bx lr
.thumb_func
t2:
bl t3
bl t4
.thumb_func
t5:
bl local_thumb
nop
local_thumb:
blx t3
bl _start
blx _start

View File

@@ -57,6 +57,11 @@ set armelftests {
{{objdump -fdw mixed-app.d} {objdump -Rw mixed-app.r}
{readelf -Ds mixed-app.sym}}
"mixed-app"}
{"Mixed ARM/Thumb arch5 dynamic application" "tmpdir/mixed-lib.so -T arm-dyn.ld --use-blx" ""
{mixed-app.s}
{{objdump -fdw mixed-app-v5.d} {objdump -Rw mixed-app.r}
{readelf -Ds mixed-app.sym}}
"mixed-app-v5"}
{"target1-abs" "-static --target1-abs -T arm.ld" "" {arm-target1.s}
{{objdump -s arm-target1-abs.d}}
"arm-target1-abs"}
@@ -75,6 +80,9 @@ set armelftests {
{"arm-rel31" "-static -T arm.ld" "" {arm-rel31.s}
{{objdump -s arm-rel31.d}}
"arm-rel31"}
{"arm-call" "-static -T arm.ld" "-meabi=4" {arm-call1.s arm-call2.s}
{{objdump -d arm-call.d}}
"arm-call"}
{"TLS shared library" "-shared -T arm-lib.ld" "" {tls-lib.s}
{{objdump -fdw tls-lib.d} {objdump -Rw tls-lib.r}}
"tls-lib.so"}

View File

@@ -10,7 +10,9 @@ SECTIONS
*(.before)
*(.text)
*(.after)
*(.glue_7)
} =0
. = 0x9000;
.got : { *(.got) *(.got.plt)}
.ARM.attribues 0 : { *(.ARM.atttributes) }
}

View File

@@ -0,0 +1,56 @@
tmpdir/mixed-app-v5: file format elf32-(little|big)arm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x.*
Disassembly of section .plt:
.* <.plt>:
.*: e52de004 str lr, \[sp, #-4\]!
.*: e59fe004 ldr lr, \[pc, #4\] ; .* <_start-0x20>
.*: e08fe00e add lr, pc, lr
.*: e5bef008 ldr pc, \[lr, #8\]!
.*: .*
.*: e28fc6.* add ip, pc, #.* ; 0x.*
.*: e28cca.* add ip, ip, #.* ; 0x.*
.*: e5bcf.* ldr pc, \[ip, #.*\]!
.*: e28fc6.* add ip, pc, #.* ; 0x.*
.*: e28cca.* add ip, ip, #.* ; 0x.*
.*: e5bcf.* ldr pc, \[ip, #.*\]!
Disassembly of section .text:
.* <_start>:
.*: e1a0c00d mov ip, sp
.*: e92dd800 stmdb sp!, {fp, ip, lr, pc}
.*: eb000004 bl .* <app_func>
.*: e89d6800 ldmia sp, {fp, sp, lr}
.*: e12fff1e bx lr
.*: e1a00000 nop \(mov r0,r0\)
.*: e1a00000 nop \(mov r0,r0\)
.*: e1a00000 nop \(mov r0,r0\)
.* <app_func>:
.*: e1a0c00d mov ip, sp
.*: e92dd800 stmdb sp!, {fp, ip, lr, pc}
.*: ebfffff. bl .*
.*: e89d6800 ldmia sp, {fp, sp, lr}
.*: e12fff1e bx lr
.*: e1a00000 nop \(mov r0,r0\)
.*: e1a00000 nop \(mov r0,r0\)
.*: e1a00000 nop \(mov r0,r0\)
.* <app_func2>:
.*: e12fff1e bx lr
.*: e1a00000 nop \(mov r0,r0\)
.*: e1a00000 nop \(mov r0,r0\)
.*: e1a00000 nop \(mov r0,r0\)
.* <app_tfunc>:
.*: b500 push {lr}
.*: f7ff efc. blx .* <_start-0x..>
.*: bd00 pop {pc}
.*: 4770 bx lr
.*: 46c0 nop \(mov r8, r8\)
.*: 46c0 nop \(mov r8, r8\)
.*: 46c0 nop \(mov r8, r8\)

View File

@@ -1,5 +1,5 @@
tmpdir/mixed-app: file format elf32-(little|big)arm
tmpdir/mixed-app.*: file format elf32-(little|big)arm
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE