FW: GCC ARM Cross Linker Problem
Richard Earnshaw
Richard.Earnshaw@arm.com
Tue Aug 29 14:23:00 GMT 2006
The following works fine for me:
sym.s:
.global tfunc
.type tfunc %function
.equ tfunc, 0x1235
main.c:
extern void tfunc(void);
int main()
{
tfunc();
return 0;
}
arm-elf-as sym.s -o sym.o
arm-elf-gcc main.c sym.o -o main.exe
arm-elf-objdump -xd main.exe
...
00008224 <main>:
8224: e1a0c00d mov ip, sp
8228: e92dd800 stmdb sp!, {fp, ip, lr, pc}
822c: e24cb004 sub fp, ip, #4 ; 0x4
8230: eb0007f8 bl a218 <__tfunc_from_arm>
8234: e3a03000 mov r3, #0 ; 0x0
8238: e1a00003 mov r0, r3
823c: e89da800 ldmia sp, {fp, sp, pc}
...
0000a218 <__tfunc_from_arm>:
a218: e59fc000 ldr ip, [pc, #0] ; a220
<__tfunc_from_arm
+0x8>
a21c: e12fff1c bx ip
a220: 00001235 andeq r1, r0, r5, lsr r2
...
Notice that __tfunc_from_arm loads the value 0x1235 into a register and
issues a bx instruction, which will then correctly switch to Thumb
state.
R.
On Tue, 2006-08-29 at 14:47, Kanwal Preet Singh CHANANA wrote:
> Hi Vinayak,
> Kindly refer to below mail. I am already using this following method but it is not working.
>
> Regards,
> Kanwal
>
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Vinayak Bhalkar
> Sent: Tuesday, August 29, 2006 5:42 PM
> To: kanwalpreet.singh@st.com
> Cc: gcc-help@gcc.gnu.org; crossgcc@sources.redhat.com
> Subject: Re: FW: GCC ARM Cross Linker Problem
>
>
>
> Try following-
>
> MaskInterrupt = 0x00c008f9;
>
> Regards,
> vinayak
>
> --- kanwalpreet.singh@st.com wrote:
>
> From: Kanwal Preet Singh CHANANA <kanwalpreet.singh@st.com>
> To: <gcc-help@gcc.gnu.org>, <crossgcc@sources.redhat.com>
> Subject: FW: GCC ARM Cross Linker Problem
> Date: Tue, 29 Aug 2006 14:59:35 +0530
>
> Hi all,
>
> I am able to compile & Link my source files with a workaround mentioned below:
>
> The absolute symbols defined in symbols.o are
>
> 0x000002a8 D CurTask
> 0x00c008f8 T MaskInterrupt
> Where Curtask is data located in RoM & MaskInterrupt is function in Thumb Mode.
>
> I used following definations in Linker Script
>
> pCurTask = 0x000002a8;
> MaskInterrupt = 0x00c008f8;
>
> With this I am able to link & built Image.axf file. But when running on target,the image crashes at a point when it jumps to MaskInterrupt(shown above) . The reason is that the Linker assumes MaskInterrupt function to be in ARM mode.When it jumps there, it expects 4 byte ARM instruction but the code at this location has 2 Byte Thumb Instruction.
>
> The Thumb Interwork option is enabled in Build options.
>
> Can anyone suggest me a method to Link above symbols in a way so that GCC-ARMv4.0.3 knows whether the symbols is Data or Thumb Function or ARM function? If there is a way, then Image will run correctly on Target. Also if anyone needs any help on Project porting from ADS to GCC-ARM,then I can help him out.
>
> Please suggest a wayout to fix the above problem.
> Regards,
> Kanwal
>
>
>
>
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On Behalf Of Kanwal Preet Singh CHANANA
> Sent: Monday, August 21, 2006 3:48 PM
> To: gcc-help@gcc.gnu.org
> Subject: GCC ARM Cross Linker Problem
>
>
> Hi all,
>
> I am porting my project from ADS from ARM to GCC ARM Tool chain. I am able to compile my source files but fail to link. I have a symbols file (symbols.o) with absolute symbols addresses in format
> Symboladdress SymbolType Symbolname e.g
>
> 0x000002a8 D CurTask
> 0x00c008f8 T MaskInterrupt
>
> These symbols are located in ROM( code built with ADS) & project image will be in flash. When I use this same file during build with ARM ADS, it works fine but with GCC ARM tool chain,I get following error message
>
> "./symbols.o: file not recognized: File format not recognized"
>
> Can anybody please tell me the solution to this error? Can I link objects built with ADS with GCC ARM ?
>
> Regards,
> Kanwal
>
>
>
> _____________________________________________________________
> Get your free web-based e-mail account from http://www.Math.net Your online tourguide of Mathematics, with books, links, news, message boards, and much more!
>
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
--
Richard Earnshaw Email: Richard.Earnshaw@arm.com
ARM Ltd Phone: +44 1223 400569 (Direct + VoiceMail)
110 Fulbourn Road Switchboard: +44 1223 400400
Cherry Hinton Fax: +44 1223 400410
Cambridge CB1 9NJ Web: http://www.arm.com/
UK
-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list