Hi Phil,
It appears that binutils-2.9.1.0.19a is very unhealthy when it comes to
inter-section relocations... I'm surprised anyone's got a working kernel
with this.
Take the following code:
.text
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
1: strbt r0, [r1], #0
2:
.section .fixup,"ax"
.align 2
3: mvn r0, #0
b 2b
.previous
.section __ex_table,"a"
.align 3
.long 1b, 3b
.previous
ldmea fp, {fp, sp, pc}
(eg, uaccess functions from Linux), and when you assemble this:
arm-linux-as -o test-sect.o test-sect.s
arm-linux-objdump --disassemble --reloc test-sect.o
you get:
test-sect.o: file format elf32-arm
Disassembly of section .text:
00000000 <.text>:
0: e1a0c00d mov ip, sp
4: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8: e24cb004 sub fp, ip, #4
c: e4e10000 strbt r0, [r1]
10: e91ba800 ldmdb fp, {fp, sp, pc}
Disassembly of section .fixup:
00000000 <.fixup>:
0: e3e00000 mvn r0, #0
4: eafffffe b 0x4
4: R_ARM_PC24 .text
Which is wrong, since if the fixup of the R_ARM_PC24 relocation is done
as specified, it will go wrong - like:
arm-linux-ld -o test-sect test-sect.o
arm-linux-objdump --disassemble --reloc test-sect
test-sect: file format elf32-arm
Disassembly of section .text:
02000074 <.text>:
2000074: e1a0c00d mov ip, sp
2000078: e92dd800 stmdb sp!, {fp, ip, lr, pc}
200007c: e24cb004 sub fp, ip, #4
2000080: e4e10000 strbt r0, [r1]
2000084: e91ba800 ldmdb fp, {fp, sp, pc}
Disassembly of section .fixup:
02000088 <.fixup>:
2000088: e3e00000 mvn r0, #0
200008c: eafffff8 b 2000074 <__start___ex_table-0x1c>
which is definitely what I didn't ask in the assembler.
With my tools:
../GAS/binutils-2.8/gas/as.new -o test-sect.o test-sect.s
../GAS/binutils-2.8/binutils/objdump --disassemble --reloc test-sect.o
test-sect.o: file format elf32-arm
Disassembly of section .text:
00000000 <.text>:
0: 0d c0 a0 e1 e1a0c00d mov ip, sp
4: 00 d8 2d e9 e92dd800 stmdb sp!, {fp, ip, lr, pc}
8: 04 b0 4c e2 e24cb004 sub fp, ip, #4
c: 00 00 e1 e4 e4e10000 strbt r0, [r1]
10: 00 a8 1b e9 e91ba800 ldmdb fp, {fp, sp, pc}
Disassembly of section .fixup:
00000000 <.fixup>:
0: 00 00 e0 e3 e3e00000 mvn r0, #0
4: 02 00 00 ea ea000002 b 14
4: R_ARM_PC26 .text
../GAS/binutils-2.8/ld/ld.new -o test-sect test-sect.o
../GAS/binutils-2.8/binutils/objdump --disassemble --reloc test-sect
test-sect: file format elf32-arm
Disassembly of section .text:
00008074 <.text>:
8074: 0d c0 a0 e1 e1a0c00d mov ip, sp
8078: 00 d8 2d e9 e92dd800 stmdb sp!, {fp, ip, lr, pc}
807c: 04 b0 4c e2 e24cb004 sub fp, ip, #4
8080: 00 00 e1 e4 e4e10000 strbt r0, [r1]
8084: 00 a8 1b e9 e91ba800 ldmdb fp, {fp, sp, pc}
Disassembly of section .fixup:
00008088 <.fixup>:
8088: 00 00 e0 e3 e3e00000 mvn r0, #0
808c: fc ff ff ea eafffffc b 8084 <__start___ex_table-c>
Now, that's what I asked for! Notice the difference in .fixup in
the assembler output.
_____
|_____| ------------------------------------------------- ---+---+-
| | Russell King [EMAIL PROTECTED] --- ---
| | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |
unsubscribe: body of `unsubscribe linux-arm' to [EMAIL PROTECTED]