gcc 4.4.0 arm/thumb interwork _from_arm bad stub generation
Miguel Angel
miguelangel@ajo.es
Mon Jun 15 11:55:00 GMT 2009
The problem is fixed now.
For reference: I was using 2.19.1, after updating to 2.19.51 the ARM
interworking link bugs disappeared.
Greetings,
Miguel Angel.
2009/6/14 Miguel Angel <miguelangel@ajo.es>:
> I've tried to setup a special section for .glue_7 and .glue_7t in the
> linker script, and they got moved, but still broken.
>
> I could see that the _from_arm and _from_elf stubs and their code are
> generated in the bfd library, and the code
> seems correct, but for some reason like 1/2 of the stubs have
> invalid/broken opcodes (with the correct size).
>
> That suggest me that they're being overwritten before being written to
> .elf in disk.
>
> Any hint about how to debug this?
>
> Thanks Again,
> Miguel Angel.
>
> PD: I've seen that the "thunk" / "noreturn" it's from the decompiler i
> used to check the .elf output
>
> 2009/6/13 Miguel Angel <miguelangel@ajo.es>:
>> Hello, I hope I'm writting to the right list,
>>
>> I'm having a problem with gcc 4.4.0 cross compiler from IA32 to
>> ARM7TDMI in embedded
>> environments (newlib) with ARM/THUMB interworking.
>>
>> Everything has worked fine in my tests until I tried to make use
>> of the libc, after
>> doing that, some parts of the "_from_arm" generated stubs for
>> interworking got broken/
>> overwritten/ ?? at linking time. Also the function attributes change
>> from "thunk" to "noreturn".
>>
>> But it doesn't happen to all of the _from_arm stubs, only some of them.
>>
>> If you have any hints about where to look to solve this it or whom
>> to ask , that would be great.
>>
>> Thanks in advance,
>> Miguel Angel
>>
>> Correctly generated (from main.elf)
>>
>> .text:00003CA4 ; =============== S U B R O U T I N E
>> =======================================
>> .text:00003CA4
>> .text:00003CA4 ; Attributes: thunk
>> .text:00003CA4
>> .text:00003CA4 __memcpy_from_arm ;
>> CODE XREF: HandleClassRequest+38 p
>> .text:00003CA4 00 C0 9F E5 LDR R12, =(memcpy+1)
>> .text:00003CA8 1C FF 2F E1 BX R12
>> .text:00003CA8 ;
>> ---------------------------------------------------------------------------
>> .text:00003CAC 25 3C 00 00 off_3CAC DCD memcpy+1 ;
>> DATA XREF: __memcpy_from_arm r
>> .text:00003CAC ; End of function __memcpy_from_arm
>> .text:00003CAC
>> .text:00003CB0
>> .text:00003CB0 ; =============== S U B R O U T I N E
>> =======================================
>> .text:00003CB0
>> .text:00003CB0 ; Attributes: thunk
>> .text:00003CB0
>> .text:00003CB0 ____umodsi3_from_arm ;
>> CODE XREF: print_integer:loc_383C p
>> .text:00003CB0 00 C0 9F E5 LDR R12, =(__umodsi3+1)
>> .text:00003CB4 1C FF 2F E1 BX R12
>> .text:00003CB4 ;
>> ---------------------------------------------------------------------------
>> .text:00003CB8 59 3B 00 00 off_3CB8 DCD __umodsi3+1 ;
>> DATA XREF: ____umodsi3_from_arm r
>> .text:00003CB8 ; End of function ____umodsi3_from_arm
>> .text:00003CB8
>> .text:00003CBC
>> .text:00003CBC ; =============== S U B R O U T I N E
>> =======================================
>> .text:00003CBC
>> .text:00003CBC ; Attributes: thunk
>> .text:00003CBC
>> .text:00003CBC ____udivsi3_from_arm ;
>> CODE XREF: print_integer+AC p
>> .text:00003CBC 00 C0 9F E5 LDR R12, =(__udivsi3+1)
>> .text:00003CC0 1C FF 2F E1 BX R12
>> .text:00003CC0 ;
>> ---------------------------------------------------------------------------
>> .text:00003CC4 CD 3A 00 00 off_3CC4 DCD __udivsi3+1 ;
>> DATA XREF: ____udivsi3_from_arm r
>> .text:00003CC4 ; End of function ____udivsi3_from_arm
>> .text:00003CC4
>>
>>
>> Incorrectly generated (from main.elf)
>> .text:0000514C ; =============== S U B R O U T I N E
>> =======================================
>> .text:0000514C
>> .text:0000514C ; Attributes: noreturn
>> .text:0000514C
>> .text:0000514C __memcpy_from_arm ;
>> CODE XREF: HandleClassRequest+38 p
>> .text:0000514C 07 00 A0 01 MOVEQ R0, R7
>> .text:00005150 0A 20 A0 03 MOVEQ R2, #0xA
>> .text:00005154 01 30 A0 03 MOVEQ R3, #1
>> .text:00005154 ; End of function __memcpy_from_arm
>> .text:00005154
>> .text:00005158
>> .text:00005158 ; =============== S U B R O U T I N E
>> =======================================
>> .text:00005158
>> .text:00005158 ; Attributes: noreturn
>> .text:00005158
>> .text:00005158 ____umodsi3_from_arm ;
>> CODE XREF: print_integer:loc_4CE4 p
>> .text:00005158 15 00 00 0A BEQ 0x51B4
>> .text:0000515C 78 00 53 E3 CMP R3, #0x78
>> .text:00005160 04 10 96 04 LDREQ R1, [R6],#4
>> .text:00005160 ; End of function ____umodsi3_from_arm
>> .text:00005160
>> .text:00005164
>> .text:00005164 ; =============== S U B R O U T I N E
>> =======================================
>> .text:00005164
>> .text:00005164 ; Attributes: noreturn
>> .text:00005164
>> .text:00005164 ____udivsi3_from_arm ;
>> CODE XREF: print_integer+AC p
>> .text:00005164 07 00 A0 01 MOVEQ R0, R7
>> .text:00005168 10 20 A0 03 MOVEQ R2, #0x10
>> .text:0000516C 0F 00 00 0A BEQ 0x51B0
>> .text:0000516C ; End of function ____udivsi3_from_arm
>>
>>
>> --
>> Miguel Angel Ajo Pelayo
>> http://www.nbee.es
>> +34 91 120 1798
>> +34 636 52 25 69
>> skype: ajoajoajo
>>
>> --
>> Miguel Angel Ajo Pelayo
>> http://www.nbee.es
>> +34 91 120 1798
>> +34 636 52 25 69
>> skype: ajoajoajo
>>
>
>
>
> --
> Miguel Angel Ajo Pelayo
> http://www.nbee.es
> +34 91 120 1798
> +34 636 52 25 69
> skype: ajoajoajo
>
--
Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 91 120 1798
+34 636 52 25 69
skype: ajoajoajo
More information about the Gcc-help
mailing list