avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Add builtins in avr target.


From: Anatoly Sokolov
Subject: Re: [avr-gcc-list] Add builtins in avr target.
Date: Sat, 26 Apr 2008 20:52:07 +0400

Hi.

> __builtin_return_address is extremely useful for target error reporting. 
> e.g. a function can be called(or trapped)  to report error in another 
> part of program. This allows such routines to determine the address of 
> the caller without using naked asm functions.
> 
> You are correct, that return address will only give 16bit pointer. But 
> that covers most uses.
> 
> It would seem easier to implement than create documents and disable all 
> current and future testcases that use it. That would seem to be 
> confirmed by the fact that  bug reports  have been outstanding since 2005.
> 
> Of course, Eric and other AVR users may disagree.
> 

Word or byte address return  "__builtin_return_address"? 
I consider that, it will be better that it returned the word address.

For those architectures where it cannot return the correct address, the  
"__builtin_return_address" should be disabled.

+static void avr_init_builtins (void);

+#undef TARGET_INIT_BUILTINS
+#define TARGET_INIT_BUILTINS avr_init_builtins


+void
+avr_init_builtins  (void)
+{
+  if (AVR_HAVE_EIJMP_EICALL)  // if "__builtin_return_address" return word 
address.
+    {
+      disable_builtin_function ("return_address");
+    }
+}


Anatoly.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]