This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re, interworking problem


On Tue, 2005-02-22 at 10:09, aram bharathi wrote:
> 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);
> }
> 

Your testcase is ill-formed.  If you turn the optimizer on, then you
might not get what you expect (a has an undefined initial value). 
However, that's not important here...

> 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

You are trying to link in the ARM version of the library.  If you are
invoking the linker using gcc, then add -mthumb again.  It will then
select the Thumb libraries for you.

If you are invoking ld by hand, then you will need to adjust your
library specifications to find the Thumb start-up code and libraries. 
Most likely this will mean inserting /thumb/ before each final filename
in the library list:

/home/../arm-elf/lib/thumb/libc.a

R.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]