puzzled - old release works, newer doesn't
Danny Backx
danny.backx@scarlet.be
Tue Apr 11 23:06:00 GMT 2006
Hi,
I'm trying to build a toolchain to compile apps for Windows CE (I have a
Mio PDA) from my Linux PC.
I am able to do so with some software based on old versions of gcc,
binutils, and newlib; but I'd like to upgrade to newer versions and then
start extending the development environment.
The trouble is that my upgrade doesn't work.
The old environment is based on gcc 3.4.2, gas 2.13.2, binutils 2.15.
(Yes there's a mixup there.) The new environment is using gcc 4.1 and
binutils 2.16. In all versions, the target platform is "arm-wince-pe".
The person who created this distribution explains the mixup by saying
that the GAS from 2.13 works, whereas the one in newer binutils doesn't.
My personal experience with the 2.16 release appears to confirm that.
Attached are a small test program, a script to manipulate it with, and
some of the results. The branch instructions appear different, but I
have to admit I know too little about how gas and ld cooperate so I may
be missing the point there.
Can anyone help in sorting out what the problem is?
To state the obvious : hello1.exe as created by the script works,
hello2.exe crashes my PDA.
Thanks,
Danny
--
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello.c
Type: text/x-csrc
Size: 436 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060411/6a6ac623/attachment.bin>
-------------- next part --------------
.file "hello.c"
.section .rdata
.align 0
LC0:
.ascii "/storage card/devel/log.txt\000"
.align 0
LC1:
.ascii "w\000"
.align 0
LC2:
.ascii "Hello\r\n\000"
.text
.align 0
.global _WinMain
_WinMain:
@ args = 0, pretend = 0, frame = 20
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
sub sp, sp, #20
str r0, [fp, #-16]
str r1, [fp, #-20]
str r2, [fp, #-24]
str r3, [fp, #-28]
ldr r0, L2
ldr r1, L2+4
bl _fopen
mov r3, r0
str r3, [fp, #-32]
ldr r0, [fp, #-32]
ldr r1, L2+8
bl _fprintf
ldr r0, [fp, #-32]
bl _fclose
mov r0, #0
bl _exit
L3:
.align 0
L2:
.word LC0
.word LC1
.word LC2
.align 0
.global _main
_main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
bl ___gccmain
mov r0, #0
mov r1, #0
mov r2, #0
mov r3, #0
bl _WinMain
mov r0, r3
ldmfd sp, {fp, sp, pc}
.comm _hinstance, 4 @ 4
.comm ___EH_FRAME_BEGIN__, 12 @ 10
-------------- next part --------------
hello1.o: file format pe-arm-little
hello1.o
architecture: xscale, flags 0x00000039:
HAS_RELOC, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000
Characteristics 0x4c04
line numbers stripped
Time/Date Thu Jan 1 01:00:00 1970
ImageBase 00000000
SectionAlignment 00000000
FileAlignment 00000000
MajorOSystemVersion 0
MinorOSystemVersion 0
MajorImageVersion 0
MinorImageVersion 0
MajorSubsystemVersion 0
MinorSubsystemVersion 0
Win32Version 00000000
SizeOfImage 00000000
SizeOfHeaders 00000000
CheckSum 00000000
Subsystem 00000000 (unspecified)
DllCharacteristics 00000000
SizeOfStackReserve 00000000
SizeOfStackCommit 00000000
SizeOfHeapReserve 00000000
SizeOfHeapCommit 00000000
LoaderFlags 00000000
NumberOfRvaAndSizes 00000000
The Data Directory
Entry 0 00000000 00000000 Export Directory [.edata (or where ever we found it)]
Entry 1 00000000 00000000 Import Directory [parts of .idata]
Entry 2 00000000 00000000 Resource Directory [.rsrc]
Entry 3 00000000 00000000 Exception Directory [.pdata]
Entry 4 00000000 00000000 Security Directory
Entry 5 00000000 00000000 Base Relocation Directory [.reloc]
Entry 6 00000000 00000000 Debug Directory
Entry 7 00000000 00000000 Description Directory
Entry 8 00000000 00000000 Special Directory
Entry 9 00000000 00000000 Thread Storage Directory [.tls]
Entry a 00000000 00000000 Load Configuration Directory
Entry b 00000000 00000000 Bound Import Directory
Entry c 00000000 00000000 Import Address Table Directory
Entry d 00000000 00000000 Delay Import Directory
Entry e 00000000 00000000 Reserved
Entry f 00000000 00000000 Reserved
private flags = 820: [APCS-32] [floats passed in integer registers] [absolute position] [interworking not supported]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000088 00000000 00000000 000000b4 2**2
CONTENTS, RELOC
1 .data 00000000 00000000 00000000 00000000 2**2
2 .bss 00000000 00000000 00000000 00000000 2**2
ALLOC
3 .rdata 00000028 00000000 00000000 0000013c 2**2
CONTENTS, ALLOC, LOAD, DATA
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 hello.c
File
[ 2](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 LC0
[ 3](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x0000001c LC1
[ 4](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000020 LC2
[ 5](sec 1)(fl 0x00)(ty 0)(scl 6) (nx 0) 0x00000050 L2
[ 6](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text
AUX scnlen 0x88 nreloc 8 nlnno 0
[ 8](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 10](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 12](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .rdata
AUX scnlen 0x28 nreloc 0 nlnno 0
[ 14](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _WinMain
[ 15](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x0000005c _main
[ 16](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000004 _hinstance
[ 17](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x0000000c ___EH_FRAME_BEGIN__
[ 18](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _fopen
[ 19](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _fprintf
[ 20](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _fclose
[ 21](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _exit
[ 22](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 ___gccmain
Contents of section .text:
0000 0dc0a0e1 00d82de9 04b04ce2 14d04de2 ......-...L...M.
0010 10000be5 14100be5 18200be5 1c300be5 ......... ...0..
0020 28009fe5 28109fe5 feffffeb 0030a0e1 (...(........0..
0030 20300be5 20001be5 18109fe5 feffffeb 0.. ...........
0040 20001be5 feffffeb 0000a0e3 feffffeb ...............
0050 00000000 1c000000 20000000 0dc0a0e1 ........ .......
0060 00d82de9 04b04ce2 feffffeb 0000a0e3 ..-...L.........
0070 0010a0e3 0020a0e3 0030a0e3 dfffffeb ..... ...0......
0080 0300a0e1 00a89de8 ........
Contents of section .rdata:
0000 2f73746f 72616765 20636172 642f6465 /storage card/de
0010 76656c2f 6c6f672e 74787400 77000000 vel/log.txt.w...
0020 48656c6c 6f0d0a00 Hello...
Disassembly of section .text:
00000000 <_WinMain>:
0: e1a0c00d mov ip, sp
4: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8: e24cb004 sub fp, ip, #4 ; 0x4
c: e24dd014 sub sp, sp, #20 ; 0x14
10: e50b0010 str r0, [fp, #-16]
14: e50b1014 str r1, [fp, #-20]
18: e50b2018 str r2, [fp, #-24]
1c: e50b301c str r3, [fp, #-28]
20: e59f0028 ldr r0, [pc, #40] ; 50 <L2>
24: e59f1028 ldr r1, [pc, #40] ; 54 <L2+0x4>
28: ebfffffe bl 28 <_WinMain+0x28>
28: ARM_26 _fopen
2c: e1a03000 mov r3, r0
30: e50b3020 str r3, [fp, #-32]
34: e51b0020 ldr r0, [fp, #-32]
38: e59f1018 ldr r1, [pc, #24] ; 58 <L2+0x8>
3c: ebfffffe bl 3c <_WinMain+0x3c>
3c: ARM_26 _fprintf
40: e51b0020 ldr r0, [fp, #-32]
44: ebfffffe bl 44 <_WinMain+0x44>
44: ARM_26 _fclose
48: e3a00000 mov r0, #0 ; 0x0
4c: ebfffffe bl 4c <_WinMain+0x4c>
4c: ARM_26 _exit
00000050 <L2>:
50: 00000000 andeq r0, r0, r0
50: ARM_32 LC0
54: 0000001c andeq r0, r0, ip, lsl r0
54: ARM_32 LC1+0xffffffe4
58: 00000020 andeq r0, r0, r0, lsr #32
58: ARM_32 LC2+0xffffffe0
0000005c <_main>:
5c: e1a0c00d mov ip, sp
60: e92dd800 stmdb sp!, {fp, ip, lr, pc}
64: e24cb004 sub fp, ip, #4 ; 0x4
68: ebfffffe bl 68 <_main+0xc>
68: ARM_26 ___gccmain
6c: e3a00000 mov r0, #0 ; 0x0
70: e3a01000 mov r1, #0 ; 0x0
74: e3a02000 mov r2, #0 ; 0x0
78: e3a03000 mov r3, #0 ; 0x0
7c: ebffffdf bl 0 <_WinMain>
80: e1a00003 mov r0, r3
84: e89da800 ldmia sp, {fp, sp, pc}
Disassembly of section .rdata:
00000000 <LC0>:
0: 6f74732f swivs 0x0074732f
4: 65676172 strvsb r6, [r7, #-370]!
8: 72616320 rsbvc r6, r1, #-2147483648 ; 0x80000000
c: 65642f64 strvsb r2, [r4, #-3940]!
10: 2f6c6576 swics 0x006c6576
14: 2e676f6c cdpcs 15, 6, cr6, cr7, cr12, {3}
18: 00747874 rsbeqs r7, r4, r4, ror r8
0000001c <LC1>:
1c: 00000077 andeq r0, r0, r7, ror r0
00000020 <LC2>:
20: 6c6c6548 cfstr64vs mvdx6, [ip], #-288
24: 000a0d6f andeq r0, sl, pc, ror #26
hello.c:
typedef void void;
void _WinMain /* 0x0 */;
void _main /* 0x5c */;
void _hinstance /* 0x4 */;
void ___EH_FRAME_BEGIN__ /* 0xc */;
void _fopen /* 0x0 */;
void _fprintf /* 0x0 */;
void _fclose /* 0x0 */;
void _exit /* 0x0 */;
void ___gccmain /* 0x0 */;
-------------- next part --------------
hello2.o: file format pe-arm-little
hello2.o
architecture: xscale, flags 0x00000039:
HAS_RELOC, HAS_DEBUG, HAS_SYMS, HAS_LOCALS
start address 0x00000000
Characteristics 0x4d04
line numbers stripped
32 bit words
Time/Date Thu Jan 1 01:00:00 1970
ImageBase 00000000
SectionAlignment 00000000
FileAlignment 00000000
MajorOSystemVersion 0
MinorOSystemVersion 0
MajorImageVersion 0
MinorImageVersion 0
MajorSubsystemVersion 0
MinorSubsystemVersion 0
Win32Version 00000000
SizeOfImage 00000000
SizeOfHeaders 00000000
CheckSum 00000000
Subsystem 00000000 (unspecified)
DllCharacteristics 00000000
SizeOfStackReserve 00000000
SizeOfStackCommit 00000000
SizeOfHeapReserve 00000000
SizeOfHeapCommit 00000000
LoaderFlags 00000000
NumberOfRvaAndSizes 00000000
The Data Directory
Entry 0 00000000 00000000 Export Directory [.edata (or where ever we found it)]
Entry 1 00000000 00000000 Import Directory [parts of .idata]
Entry 2 00000000 00000000 Resource Directory [.rsrc]
Entry 3 00000000 00000000 Exception Directory [.pdata]
Entry 4 00000000 00000000 Security Directory
Entry 5 00000000 00000000 Base Relocation Directory [.reloc]
Entry 6 00000000 00000000 Debug Directory
Entry 7 00000000 00000000 Description Directory
Entry 8 00000000 00000000 Special Directory
Entry 9 00000000 00000000 Thread Storage Directory [.tls]
Entry a 00000000 00000000 Load Configuration Directory
Entry b 00000000 00000000 Bound Import Directory
Entry c 00000000 00000000 Import Address Table Directory
Entry d 00000000 00000000 Delay Import Directory
Entry e 00000000 00000000 Reserved
Entry f 00000000 00000000 Reserved
private flags = 820: [APCS-32] [floats passed in integer registers] [absolute position] [interworking not supported]
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00000088 00000000 00000000 000000b4 2**2
CONTENTS, ALLOC, LOAD, RELOC, CODE
1 .data 00000000 00000000 00000000 00000000 2**2
ALLOC, LOAD, DATA
2 .bss 00000000 00000000 00000000 00000000 2**2
ALLOC
3 .rdata 00000028 00000000 00000000 0000013c 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 hello.c
File
[ 2](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000000 LC0
[ 3](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x0000001c LC1
[ 4](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 0) 0x00000020 LC2
[ 5](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text
AUX scnlen 0x88 nreloc 9 nlnno 0
[ 7](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 9](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 11](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .rdata
AUX scnlen 0x28 nreloc 0 nlnno 0
[ 13](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _WinMain
[ 14](sec 1)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x0000005c _main
[ 15](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000004 _hinstance
[ 16](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x0000000c ___EH_FRAME_BEGIN__
[ 17](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _fopen
[ 18](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _fprintf
[ 19](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _fclose
[ 20](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _exit
[ 21](sec 0)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 ___gccmain
Contents of section .text:
0000 0dc0a0e1 00d82de9 04b04ce2 14d04de2 ......-...L...M.
0010 10000be5 14100be5 18200be5 1c300be5 ......... ...0..
0020 28009fe5 28109fe5 000000eb 0030a0e1 (...(........0..
0030 20300be5 20001be5 18109fe5 000000eb 0.. ...........
0040 20001be5 000000eb 0000a0e3 000000eb ...............
0050 00000000 00000000 00000000 0dc0a0e1 ................
0060 00d82de9 04b04ce2 000000eb 0000a0e3 ..-...L.........
0070 0010a0e3 0020a0e3 0030a0e3 dfffffeb ..... ...0......
0080 0300a0e1 00a89de8 ........
Contents of section .rdata:
0000 2f73746f 72616765 20636172 642f6465 /storage card/de
0010 76656c2f 6c6f672e 74787400 77000000 vel/log.txt.w...
0020 48656c6c 6f0d0a00 Hello...
Disassembly of section .text:
00000000 <_WinMain>:
0: e1a0c00d mov ip, sp
4: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8: e24cb004 sub fp, ip, #4 ; 0x4
c: e24dd014 sub sp, sp, #20 ; 0x14
10: e50b0010 str r0, [fp, #-16]
14: e50b1014 str r1, [fp, #-20]
18: e50b2018 str r2, [fp, #-24]
1c: e50b301c str r3, [fp, #-28]
20: e59f0028 ldr r0, [pc, #40] ; 50 <_WinMain+0x50>
24: e59f1028 ldr r1, [pc, #40] ; 54 <_WinMain+0x54>
28: eb000000 bl 30 <_WinMain+0x30>
28: ARM_26 _fopen
2c: e1a03000 mov r3, r0
30: e50b3020 str r3, [fp, #-32]
34: e51b0020 ldr r0, [fp, #-32]
38: e59f1018 ldr r1, [pc, #24] ; 58 <_WinMain+0x58>
3c: eb000000 bl 44 <_WinMain+0x44>
3c: ARM_26 _fprintf
40: e51b0020 ldr r0, [fp, #-32]
44: eb000000 bl 4c <_WinMain+0x4c>
44: ARM_26 _fclose
48: e3a00000 mov r0, #0 ; 0x0
4c: eb000000 bl 54 <_WinMain+0x54>
4c: ARM_26 _exit
...
50: ARM_32 LC0
54: ARM_32 LC1+0xffffffe4
58: ARM_32 LC2+0xffffffe0
0000005c <_main>:
5c: e1a0c00d mov ip, sp
60: e92dd800 stmdb sp!, {fp, ip, lr, pc}
64: e24cb004 sub fp, ip, #4 ; 0x4
68: eb000000 bl 70 <_main+0x14>
68: ARM_26 ___gccmain
6c: e3a00000 mov r0, #0 ; 0x0
70: e3a01000 mov r1, #0 ; 0x0
74: e3a02000 mov r2, #0 ; 0x0
78: e3a03000 mov r3, #0 ; 0x0
7c: ebffffdf bl 0 <_WinMain>
7c: ARM_26D _WinMain
80: e1a00003 mov r0, r3
84: e89da800 ldmia sp, {fp, sp, pc}
Disassembly of section .rdata:
00000000 <LC0>:
0: 6f74732f swivs 0x0074732f
4: 65676172 strvsb r6, [r7, #-370]!
8: 72616320 rsbvc r6, r1, #-2147483648 ; 0x80000000
c: 65642f64 strvsb r2, [r4, #-3940]!
10: 2f6c6576 swics 0x006c6576
14: 2e676f6c cdpcs 15, 6, cr6, cr7, cr12, {3}
18: 00747874 rsbeqs r7, r4, r4, ror r8
0000001c <LC1>:
1c: 00000077 andeq r0, r0, r7, ror r0
00000020 <LC2>:
20: 6c6c6548 cfstr64vs mvdx6, [ip], #-288
24: 000a0d6f andeq r0, sl, pc, ror #26
hello.c:
typedef void void;
void _WinMain /* 0x0 */;
void _main /* 0x5c */;
void _hinstance /* 0x4 */;
void ___EH_FRAME_BEGIN__ /* 0xc */;
void _fopen /* 0x0 */;
void _fprintf /* 0x0 */;
void _fclose /* 0x0 */;
void _exit /* 0x0 */;
void ___gccmain /* 0x0 */;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t2
Type: application/x-shellscript
Size: 4851 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060411/6a6ac623/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
URL: <https://sourceware.org/pipermail/binutils/attachments/20060411/6a6ac623/attachment.sig>
More information about the Binutils
mailing list