Re, interworking problem
aram bharathi
arambharathi@linuxmail.org
Tue Feb 22 16:49:00 GMT 2005
hi,
normally in thumb mode add instruction supports immediate
values in the range of 0-255( same source and destination register)
. i like to increase the range(for architecture analysis as
curriculam project). i have added this instruction in gcc.
i have written a c program as
main()
{
int a;
a=a+320;
printf("%d",a);
}
compiled this with option
arm-elf-gcc -mthumb new.c
gcc emits a file with this new add instruction.
......
mov r3, r7
sub r3, r3, #4
ldr r3, [r3]
addnew r3, r3, #320
str r3, [r2]
mov r2, r7
sub r2, r2, #12
......
after assembling this file with binutils as, it produces a a.out
file(ELF format) with $t mapping information and producing correct
header formation.
when i try to give this a.out file into ld it produces the error
/home/.../arm-elf-ld : /home/../arm-elf/lib/libc.a(printf.o)(printf):
warning : interworking not enabled
first occurance : /tmp/cc00zhyh.o : thumb call to arm
/tmp//cc00zhyh.o(.text+0x4e>: In function 'main'
new.c:internal error: dangerous error
but it produces one a.out file. the resultant a.out file should
have only thumb instructions(compiled with -mthumb option). but
only the main function have thumb instructions and thumb specific
header details. other sections have arm instructions(printf and
other standard functions).
the output header information and the output a.out file is attached
with this email.
thank you
----- Original Message -----
From: "Nick Clifton" <nickc@redhat.com>
To: "aram bharathi" <arambharathi@linuxmail.org>
Subject: Re: interworking problem
Date: Tue, 22 Feb 2005 09:21:40 +0000
>
> Hi Aram,
>
> > i have gone through the a.out file after this error.
> > that is producing full of arm instructions other than the main
> > function(which is compiled for -mthumb). where should i change
> > for this corresponding error.
>
> It is not clear what question you are asking here.
>
> Ian has pointed out that you should be compiling your program
> with the -mthumb-interwork switch specified on the gcc command
> line.
>
> > i have added one new add instruction in thumb mode. based on that
> > i have written one sample program to emit the corresponding new
> > instruction. gcc works fine. when i assemble the function it
> emits
> > correct opcode. but when i give the same function to the ld it
> > emits full of arm instructions instead of thumb instructions.
> > which routine checks for this corresponding change.
>
> Again this is not clear. Do you mean that when the linker is
> creating the executable that it is inserting some ARM-encoded
> instructions into the output, or that it is somehow magically
> transforming your THUMB-encoded instructions into ARM-encoded
> instructions ?
>
> Perhaps it would help if you could provide a *small* example
> program and the command lines you use to compile it, as well as
> description of what is wrong with the resulting executable.
>
> Cheers
> Nick
--
______________________________________________
Check out the latest SMS services @ http://www.linuxmail.org
This allows you to send and receive SMS through your mailbox.
Powered by Outblaze
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: header.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20050222/88314b3d/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: d.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20050222/88314b3d/attachment-0001.txt>
More information about the Binutils
mailing list