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

Re: [Minios-devel] [UNIKRAFT PATCH v3 5/7] include/essentials: Provide __constructor macro



Reviewed-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>

Simon Kuenzer <simon.kuenzer@xxxxxxxxx> writes:

> Provide a constructor attribure macro for marking a
> function symbol as constructor. The linker/compiler
> is going to populate a function pointer of it to
> the init_array section of the binary.
>
> Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
> ---
>  include/uk/essentials.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/include/uk/essentials.h b/include/uk/essentials.h
> index f6cc6ea..3d1b705 100644
> --- a/include/uk/essentials.h
> +++ b/include/uk/essentials.h
> @@ -73,6 +73,19 @@ extern "C" {
>  #ifndef __align
>  #define __align(bytes)         __attribute__((aligned(bytes)))
>  #endif
> +
> +/**
> + * Mark a function as constructor
> + * The compiler/linker will populate a function pointer
> + * (sorted by priority) to the init_array section
> + *
> + * @param lvl
> + *   Priority level (101 (earliest)...onwards (latest))
> + */
> +#ifndef __constructor
> +#define __constructor(lvl) __attribute__ ((constructor (lvl)))
> +#endif
> +
>  #else
>  /* TO BE DEFINED */
>  #endif /* __GNUC__ */
> -- 
> 2.7.4
>
>
> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/minios-devel

-- 
Yuri Volchkov
Software Specialist

NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.