[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/6727] Thumb interworking code zero when another section is posit
From: |
adsouzp at netscape dot net |
Subject: |
[Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text |
Date: |
30 Jul 2008 11:43:10 -0000 |
------- Additional Comments From adsouzp at netscape dot net 2008-07-30 11:43
-------
since Michael Fischer of Yagarto was persistent, we have found another bug
in the generated Interworking code when GC is enabled and -Ttext is
positioned before -Tdata on the LD command line.
the problem is in binutils-2.18.50, the latest snapshot released from GNU.
pls see below for details in all relevant releases.
>now I have made some test with 2.18.50 and here are my results.
>[...]
>Please can you take a look at it?
>
i was able to build binutils-2.18.50 yesterday and used arm-elf-ld on the
test program t3.
its good that you checked with me again. i have found one more problem
with binutils-2.18.50. the Interworking code that is generated is not correct,
or, at least, it is positioned incorrectly. see below for details.
PROCEDURE FOR REPRODUCING ERROR
ZERO INTERWORKING CODE USING binutils-2.17
with binutils-2.17 you can see that Thumb interworking code is positioned
AFTER our code. also, with 2.17, the interworking code is ZERO.
Command Line
$ arm-elf-ld -v
GNU ld version 2.17
$ make
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
FirstAsm.o FirstAsm.s
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
SecondAsm.o SecondAsm.s
arm-elf-gcc -O0 -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -mthumb -c -o
ThirdC.o ThirdC.c
arm-elf-ld --gc-sections --entry=_istart --defsym ResetHandler=0x400c0000 -Tdata
0x20000000 -Ttext 0x20000080 -o FinalProgram.elf FirstAsm.o SecondAsm.o
ThirdC.o
arm-elf-objdump -S FinalProgram.elf > FinalProgram.lst
arm-elf-objdump --all FinalProgram.elf > FinalProgram.sym
$
Interworking Code
20000080 <_istart>:
[...]
20000088 <_af>:
[...]
20000098 <f>:
[...]
200000b8 <___af_from_thumb>:
200000b8: 0000 lsls r0, r0, #0
...
200000bc <___af_change_to_arm>:
200000bc: 00000000 andeq r0, r0, r0
200000c0 <__f_from_arm>:
...
CORRECTLY POSITIONED INTERWORKING CODE USING binutils-2.17
if, in the command line for arm-elf-ld, we position -Ttext BEFORE other
command line options, interworking code is correctly positioned and
not ZERO.
Command Line
$ arm-elf-ld -v
GNU ld version 2.17
$ make
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
FirstAsm.o FirstAsm.s
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
SecondAsm.o SecondAsm.s
arm-elf-gcc -O0 -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -mthumb -c -o
ThirdC.o ThirdC.c
arm-elf-ld --gc-sections --entry=_istart --defsym ResetHandler=0x400c0000 -Ttext
0x20000080 -Tdata 0x20000000 -o FinalProgram.elf FirstAsm.o SecondAsm.o ThirdC.o
arm-elf-objdump -S FinalProgram.elf > FinalProgram.lst
arm-elf-objdump --all FinalProgram.elf > FinalProgram.sym
$
Interworking Code
20000080 <_istart>:
[...]
20000088 <_af>:
[...]
20000098 <f>:
[...]
200000b8 <___af_from_thumb>:
200000b8: 4778 bx pc
200000ba: 46c0 nop (mov r8, r8)
200000bc <___af_change_to_arm>:
200000bc: eafffff1 b 20000088 <_af>
200000c0 <__f_from_arm>:
200000c0: e59fc000 ldr ip, [pc, #0] ; 200000c8 <__f_from_arm+0x8>
200000c4: e12fff1c bx ip
200000c8: 20000099 mulcs r0, r9, r0
ZERO INTERWORKING CODE USING binutils-2.18
here, if -Ttext is positioned before -Tdata on the command line and if GC is
enabled (bug6727), again Thumb interworking code is zero. the same problem
that exists with binutils-2.17 also remains in binutils-2.18.
Command Line
$ arm-elf-ld -v
GNU ld (GNU Binutils) 2.18
$ make
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
FirstAsm.o FirstAsm.s
Assembler messages:
option `-mno-fpu' is deprecated: use either -mfpu=softfpa or -mfpu=softvfp
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
SecondAsm.o SecondAsm.s
Assembler messages:
option `-mno-fpu' is deprecated: use either -mfpu=softfpa or -mfpu=softvfp
arm-elf-gcc -O0 -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -mthumb -c -o
ThirdC.o ThirdC.c
arm-elf-ld --gc-sections --entry=_istart --defsym ResetHandler=0x400c0000 -Tdata
0x20000000 -Ttext 0x20000080 -o FinalProgram.elf FirstAsm.o SecondAsm.o ThirdC.o
arm-elf-objdump -S FinalProgram.elf > FinalProgram.lst
arm-elf-objdump --all FinalProgram.elf > FinalProgram.sym
$
Interworking Code
20000080 <_istart>:
[...]
20000088 <_af>:
[...]
20000098 <f>:
[...]
200000b8 <___af_from_thumb>:
200000b8: 0000 lsls r0, r0, #0
...
200000bc <___af_change_to_arm>:
200000bc: 00000000 andeq r0, r0, r0
200000c0 <__f_from_arm>:
...
INCORRECTLY POSITIONED INTERWORKING CODE USING binutils-2.18.50
with binutils-2.18.50, the latest snapshot release, if -Ttext is positioned
AFTER
-Tdata, Interworking code is generated, but not positioned correctly.
Command Line
$ arm-elf-ld -v
GNU ld (GNU Binutils) 2.18.50.20080729
$ make
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
FirstAsm.o FirstAsm.s
Assembler messages:
option `-mno-fpu' is deprecated: use either -mfpu=softfpa or -mfpu=softvfp
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
SecondAsm.o SecondAsm.s
Assembler messages:
option `-mno-fpu' is deprecated: use either -mfpu=softfpa or -mfpu=softvfp
arm-elf-gcc -O0 -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -mthumb -c -o
ThirdC.o ThirdC.c
arm-elf-ld --gc-sections --entry=_istart --defsym ResetHandler=0x400c0000 -Tdata
0x20000000 -Ttext 0x20000080 -o FinalProgram.elf FirstAsm.o SecondAsm.o ThirdC.o
arm-elf-objdump -S FinalProgram.elf > FinalProgram.lst
arm-elf-objdump --all FinalProgram.elf > FinalProgram.sym
$
Interworking Code
20000080 <___af_from_thumb>:
[...]
20000098 <_istart>:
[...]
200000a0 <_af>:
[...]
200000b0 <f>:
[...]
200000d0 <__f_from_arm>:
...
CORRECTLY POSITIONED INTERWORKING CODE USING binutils-2.18.50
with binutils-2.18.50, if -Ttext is positioned BEFORE -Tdata, Interworking code
is generated correctly but positioned wrongly.
Command Line
$ arm-elf-ld -v
GNU ld (GNU Binutils) 2.18.50.20080729
$ make
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
FirstAsm.o FirstAsm.s
Assembler messages:
option `-mno-fpu' is deprecated: use either -mfpu=softfpa or -mfpu=softvfp
arm-elf-as -mno-fpu -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -EL -o
SecondAsm.o SecondAsm.s
Assembler messages:
option `-mno-fpu' is deprecated: use either -mfpu=softfpa or -mfpu=softvfp
arm-elf-gcc -O0 -march=armv4t -mcpu=arm7tdmi -mthumb-interwork -mthumb -c -o
ThirdC.o ThirdC.c
arm-elf-ld --gc-sections --entry=_istart --defsym ResetHandler=0x400c0000 -Ttext
0x20000080 -Tdata 0x20000000 -o FinalProgram.elf FirstAsm.o SecondAsm.o ThirdC.o
arm-elf-objdump -S FinalProgram.elf > FinalProgram.lst
arm-elf-objdump --all FinalProgram.elf > FinalProgram.sym
$
Interworking Code
20000080 <___af_from_thumb>:
20000080: b540 push {r6, lr}
20000082: 4e03 ldr r6, [pc, #12] (20000090
<___af_from_thumb+0x10>)
20000084: 46fe mov lr, pc
20000086: 4730 bx r6
20000088: e8bd4040 pop {r6, lr}
2000008c: e12fff1e bx lr
20000090: 200000a0 .word 0x200000a0
20000094: 00000000 .word 0x00000000
[...]
20000098 <_istart>:
[...]
200000a0 <_af>:
[...]
200000b0 <f>:
[...]
200000d0 <__f_from_arm>:
200000d0: e59fc000 ldr ip, [pc, #0] ; 200000d8 <__f_from_arm+0x8>
200000d4: e12fff1c bx ip
200000d8: 200000b1 .word 0x200000b1
CONCLUSION
the problem in bug6727 is not fixed in binutils-2.18 or binutils-2.18.50 also.
i will update the bug with this information.
Aaron
--
http://sourceware.org/bugzilla/show_bug.cgi?id=6727
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, (continued)
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, adsouzp at netscape dot net, 2008/07/14
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, adsouzp at netscape dot net, 2008/07/17
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, nickc at redhat dot com, 2008/07/21
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, adsouzp at netscape dot net, 2008/07/23
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, adsouzp at netscape dot net, 2008/07/23
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, adsouzp at netscape dot net, 2008/07/23
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, nickc at redhat dot com, 2008/07/23
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text, adsouzp at netscape dot net, 2008/07/30
- [Bug ld/6727] Thumb interworking code zero when another section is positioned before positioning .text,
adsouzp at netscape dot net <=