This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: GCC-3.4.0 on FRV architecture BUG report


> zhanrk wrote:
> > /*
> >  * BUG ?!
> >  * It should be "call 00000110 <puts>"
> >  */
> >  288:	fe 3f ff 5e 	call 0 <flush_input>
> 
> Not necessarily.  There is probably a relocation for this address that
> will insert the address of the puts function.  Try using "objdump -x"
> and look at the list of relocations.  There should be one for the
> address 0x288 that contains the value of puts.
> 
> Reading disassembled assembler output can be confusing if you don't know
> how assemblers and linkers work.  Try looking at the compiler -S output.
>  Also, this does not prove a compiler problem, as this could be an
> assembler bug.  That is another reason to look at the compiler -S output.
> -- 
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
> 
> 
hi, Jim. thanks a lot for your answer.
And I have follow your advice, which proves that it is a gas BUG.

I use the following command to generate the assembly output:

     frv-elf-gcc -S -nostdinc -I /root/openboot/include -Wall -fomit-frame-pointer
-fno-builtin -mcpu=fr400 -mno-vliw-branch stdio.c -o stdio.S



assembly result:



.text

	.p2align 4

	.globl printf

	.type	printf, @function

printf:

	addi sp,#-56,sp

	sti fp, @(sp,16)

	addi sp,#16,fp

	movsg lr, gr5

	sti gr5, @(fp,8)

	stdi gr8, @(fp,16)

	stdi gr10, @(fp,24)

	stdi gr12, @(fp,32)

	# blockage

	sti gr8, @(fp,-4)

	sethi #hi(printbuffer), gr8

	setlo #lo(printbuffer), gr8

	setlos #0, gr9

	setlos #512, gr10

	call memset

	addi fp,#40,gr4

	addi gr4,#-20,gr4

	sti gr4, @(fp,-8)

	sethi #hi(printbuffer), gr8

	setlo #lo(printbuffer), gr8

	ldi @(fp,-4), gr9

	ldi @(fp,-8), gr10

	call vsprintf

	mov gr8, gr4

	sthi gr4, @(fp,-10)

	sethi #hi(printbuffer), gr8

	setlo #lo(printbuffer), gr8



/*

 * It is correct.

 */

	call puts



	ldi @(fp,8), gr5

	ld @(fp,gr0), fp

	addi sp,#56,sp

	jmpl @(gr5,gr0)

========================================================

真情回馈 超值优惠 VIP邮箱买一送四 买三送十二!       http://vip.163.com

中国最大的免费邮箱在等你 25兆空间4兆附件!      http://mail.163.com

点击网易泡泡惊喜无限 全免费手机短信任你发!       http://popo.163.com

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