diff mbox

api: odp_hints.h add ODP_WEAK_SYMBOL

Message ID 1416339640-11996-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 962b5c9c8c19ab7a77b360792f492ff907142ae7
Headers show

Commit Message

Mike Holmes Nov. 18, 2014, 7:40 p.m. UTC
Several ODP APIs require that the application is able to replace them with
a more appropriate definition. By defining an ODP function as weak the linker
is able to replace the definition with the one supplied by the application.

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 platform/linux-generic/include/api/odp_hints.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mike Holmes Nov. 20, 2014, 6:41 p.m. UTC | #1
ping - this is blocking  ODP_ABORT and ODP_ERR and friends moving forward.

On 18 November 2014 14:40, Mike Holmes <mike.holmes@linaro.org> wrote:

> Several ODP APIs require that the application is able to replace them with
> a more appropriate definition. By defining an ODP function as weak the
> linker
> is able to replace the definition with the one supplied by the application.
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>  platform/linux-generic/include/api/odp_hints.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/platform/linux-generic/include/api/odp_hints.h
> b/platform/linux-generic/include/api/odp_hints.h
> index bc6d720..7f04886 100644
> --- a/platform/linux-generic/include/api/odp_hints.h
> +++ b/platform/linux-generic/include/api/odp_hints.h
> @@ -25,6 +25,11 @@ extern "C" {
>
>  #ifdef __GNUC__
>
> +/** Define a weak symbol
> + * This is primarily useful in defining library functions that can be
> + * overridden in user code.
> + */
> +#define ODP_WEAK_SYMBOL __attribute__((__weak__))
>
>  /**
>   * Hot code section
> @@ -68,6 +73,7 @@ extern "C" {
>
>  #else
>
> +#define ODP_WEAK_SYMBOL
>  #define ODP_HOT_CODE
>  #define ODP_COLD_CODE
>  #define odp_likely(x)
> --
> 2.1.0
>
>
Bill Fischofer Nov. 20, 2014, 6:45 p.m. UTC | #2
On Tue, Nov 18, 2014 at 1:40 PM, Mike Holmes <mike.holmes@linaro.org> wrote:

> Several ODP APIs require that the application is able to replace them with
> a more appropriate definition. By defining an ODP function as weak the
> linker
> is able to replace the definition with the one supplied by the application.
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>

Reviewed-by:  Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  platform/linux-generic/include/api/odp_hints.h | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/platform/linux-generic/include/api/odp_hints.h
> b/platform/linux-generic/include/api/odp_hints.h
> index bc6d720..7f04886 100644
> --- a/platform/linux-generic/include/api/odp_hints.h
> +++ b/platform/linux-generic/include/api/odp_hints.h
> @@ -25,6 +25,11 @@ extern "C" {
>
>  #ifdef __GNUC__
>
> +/** Define a weak symbol
> + * This is primarily useful in defining library functions that can be
> + * overridden in user code.
> + */
> +#define ODP_WEAK_SYMBOL __attribute__((__weak__))
>
>  /**
>   * Hot code section
> @@ -68,6 +73,7 @@ extern "C" {
>
>  #else
>
> +#define ODP_WEAK_SYMBOL
>  #define ODP_HOT_CODE
>  #define ODP_COLD_CODE
>  #define odp_likely(x)
> --
> 2.1.0
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
diff mbox

Patch

diff --git a/platform/linux-generic/include/api/odp_hints.h b/platform/linux-generic/include/api/odp_hints.h
index bc6d720..7f04886 100644
--- a/platform/linux-generic/include/api/odp_hints.h
+++ b/platform/linux-generic/include/api/odp_hints.h
@@ -25,6 +25,11 @@  extern "C" {
 
 #ifdef __GNUC__
 
+/** Define a weak symbol
+ * This is primarily useful in defining library functions that can be
+ * overridden in user code.
+ */
+#define ODP_WEAK_SYMBOL __attribute__((__weak__))
 
 /**
  * Hot code section
@@ -68,6 +73,7 @@  extern "C" {
 
 #else
 
+#define ODP_WEAK_SYMBOL
 #define ODP_HOT_CODE
 #define ODP_COLD_CODE
 #define odp_likely(x)