This is the mail archive of the binutils@sourceware.org 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]

[M32C] : No error is reported when relocation gets overflowed.


Hi,

I have come across change in behavior of linker for following two 	
snapshots,	
i.e. binutils 2.17 snapshot dated 20061211 and 	
     binutils 2.17 snapshot dated 20070417	
     
Consider following code,	
///////////////////////////	
const int a1 = 100;	
const int b1 = 200;	
	
int main(void)	
{	
	int a;	
	a = a1 + b1;	
	return (a);	
}	
/*	
Linker Script:	
RODATA is placed in ROM and not in RAM.	
i.e.	
.rodata = 0xF0000	
*/	
///////////////////////////	

I tried building above code for "M16C".	
Using binutils dated 20061211, I get following linker errors,	

Errors:	
relocation truncated to fit: R_M32C_16 against symbol `a1' defined in 	
.rodata section	
relocation truncated to fit: R_M32C_16 against symbol `b1' defined in 	
.rodata section	

However, using binutils dated 20070417, I do not get any linker error.
The 	
code builds successfully.	
But the generated executable does not work as expected.	
The objdump shows following code (which is incorrect),	

_main    ENTER     #02H	

F03CA 73F21C04  MOV.W     041CH,R2	
F03CE 73F02004  MOV.W     0420H,R0	
F03D2 7321      MOV.W     R2,R1	
F03D4 A101      ADD.W     R0,R1	
F03D6 731BFE    MOV.W     R1,-2H[FB]	
F03D9 73B0FE    MOV.W     -2H[FB],R0	
F03DC 7DF2      EXITD     	

Please refer to following link,	
http://www.cygwin.com/ml/binutils/2007-01/msg00273.html	

I guess, the above behavior is because of the patch provided in link
above.	

It would be better to complain for overflowed relocations instead of 	
generating wrong code, which finally does not work.	

Please comment.	

Also, I would like to know, if this is done in order to fix or get some

workaround for 24 bit pointer issue in GCC for M16C targets.		

Regards,
Prafulla Thakare
KPIT Cummins InfoSystems Ltd.		
Pune, India

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
Free download of GNU based tool-chains for Renesas' SH, H8, R8C,	
M16C and M32C Series. The following site also offers free 	
technical support to its users. Visit http://www.kpitgnutools.com	
for details. Latest versions of KPIT GNU tools were released on 	
February 6,07		
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	


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