<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 15, 2013 at 4:22 PM, Gedare Bloom <span dir="ltr"><<a href="mailto:gedare@rtems.org" target="_blank">gedare@rtems.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Are there compiler function attributes that can limit code generation<br>

when stubs are used?<br>
<div><div class="h5"><br></div></div></blockquote><div>I searched for GCC functions attributes and found that there are some function attributes that may be used for that purpose but not sure about that. These attributes are :</div>
<div><br></div><div><font color="#000000" face="monospace" size="3">cold : </font></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium">The </span><code style="color:rgb(0,0,0)">cold</code><span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium"> attribute on functions is used to inform the compiler that the function is unlikely to be executed. The function is optimized for size rather than speed and on many targets it is placed into special subsection of the text section so all cold functions appears close together improving code locality of non-cold parts of program. </span><font color="#000000" face="monospace" size="3"><br>
</font></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium"><br></span></div><div><font color="#000000" face="monospace" size="3">optimize:</font></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium">The </span><code style="color:rgb(0,0,0)">optimize</code><span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium"> attribute is used to specify that a function is to be compiled with different optimization options than specified on the command line.</span><font color="#000000" face="monospace" size="3"><br>
</font></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium"><br></span></div><div><span style="color:rgb(0,0,0);font-family:monospace;font-size:medium">unused :</span></div><div>
<span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium">This attribute, attached to a function, means that the function is meant to be possibly unused. GCC does not produce a warning for this function.</span><span style="color:rgb(0,0,0);font-family:monospace;font-size:medium"><br>
</span></div><div><span style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium"><br></span></div><div><span style="color:rgb(0,0,0);font-family:monospace;font-size:medium"> for more details check [1]</span></div>
<div>[1] <a href="http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html">http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html</a><span style="color:rgb(0,0,0);font-family:monospace;font-size:medium"><br></span></div>
<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5">
On Sat, Jul 13, 2013 at 7:05 PM, Hesham AL-Matary<br>
<<a href="mailto:heshamelmatary@gmail.com">heshamelmatary@gmail.com</a>> wrote:<br>
> From: Hesham ALmatary <<a href="mailto:heshamelmatary@gmail.com">heshamelmatary@gmail.com</a>><br>
><br>
> ---<br>
>  c/src/lib/libcpu/shared/include/mm.h              | 23 +++++++++++++++++++++++<br>
>  c/src/lib/libcpu/shared/src/no_memorymanagement.c | 17 +++++++++++++++++<br>
>  2 files changed, 40 insertions(+)<br>
>  create mode 100644 c/src/lib/libcpu/shared/include/mm.h<br>
>  create mode 100644 c/src/lib/libcpu/shared/src/no_memorymanagement.c<br>
><br>
> diff --git a/c/src/lib/libcpu/shared/include/mm.h b/c/src/lib/libcpu/shared/include/mm.h<br>
> new file mode 100644<br>
> index 0000000..02903f1<br>
> --- /dev/null<br>
> +++ b/c/src/lib/libcpu/shared/include/mm.h<br>
> @@ -0,0 +1,23 @@<br>
> +/*<br>
> + * Copyright (c) 2013 Gedare Bloom.<br>
> + *<br>
> + * The license and distribution terms for this file may be<br>
> + * found in the file LICENSE in this distribution or at<br>
> + * <a href="http://www.rtems.com/license/LICENSE" target="_blank">http://www.rtems.com/license/LICENSE</a>.<br>
> + */<br>
> +<br>
> +#ifndef __LIBCPU_MM_H<br>
> +#define __LIBCPU_MM_H<br>
> +<br>
> +#include <rtems/score/mm.h><br>
> +<br>
> +#ifdef __cplusplus<br>
> +extern "C" {<br>
> +#endif<br>
> +<br>
> +void _CPU_Memory_management_Initialize(void);<br>
> +<br>
> +#ifdef __cplusplus<br>
> +}<br>
> +#endif<br>
> +#endif<br>
> diff --git a/c/src/lib/libcpu/shared/src/no_memorymanagement.c b/c/src/lib/libcpu/shared/src/no_memorymanagement.c<br>
> new file mode 100644<br>
> index 0000000..2e3f528<br>
> --- /dev/null<br>
> +++ b/c/src/lib/libcpu/shared/src/no_memorymanagement.c<br>
> @@ -0,0 +1,17 @@<br>
> +/*<br>
> + * Copyright (c) 2013 Hesham AL-Matary<br>
> + * Copyright (c) 2013 Gedare Bloom.<br>
> + *<br>
> + * The license and distribution terms for this file may be<br>
> + * found in the file LICENSE in this distribution or at<br>
> + * <a href="http://www.rtems.com/license/LICENSE" target="_blank">http://www.rtems.com/license/LICENSE</a>.<br>
> + */<br>
> +<br>
> +#include <rtems.h><br>
> +#include <libcpu/mm.h><br>
> +<br>
> +void _CPU_Memory_management_Initialize( void ) { }<br>
> +<br>
> +void _CPU_Memory_management_Install_entry( Memory_management_Entry *mpe, uint32_t flags ) { }<br>
> +<br>
> +void _CPU_Memory_management_Uninstall_entry( Memory_management_Entry *mpe ) { }<br>
> --<br>
> 1.8.3.1<br>
><br>
</div></div>> _______________________________________________<br>
> rtems-devel mailing list<br>
> <a href="mailto:rtems-devel@rtems.org">rtems-devel@rtems.org</a><br>
> <a href="http://www.rtems.org/mailman/listinfo/rtems-devel" target="_blank">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br>
</blockquote></div><br></div></div>