diff mbox

[4/7] compiler: add macro for GCC weak symbols

Message ID 1344614655-2195-5-git-send-email-aliguori@us.ibm.com
State New
Headers show

Commit Message

Anthony Liguori Aug. 10, 2012, 4:04 p.m. UTC
This lets us provide a default implementation of a symbol which targets can
override.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 compiler.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

Peter Maydell Aug. 12, 2012, 9:30 p.m. UTC | #1
On 10 August 2012 17:04, Anthony Liguori <aliguori@us.ibm.com> wrote:
> This lets us provide a default implementation of a symbol which targets can
> override.
>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

I'm sure you'll be thrilled to hear that this doesn't seem to break MacOS
builds :-)

-- PMM
Anthony Liguori Aug. 13, 2012, 1:44 p.m. UTC | #2
Peter Maydell <peter.maydell@linaro.org> writes:

> On 10 August 2012 17:04, Anthony Liguori <aliguori@us.ibm.com> wrote:
>> This lets us provide a default implementation of a symbol which targets can
>> override.
>>
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> I'm sure you'll be thrilled to hear that this doesn't seem to break MacOS
> builds :-)

Thank you for testing it.  I neglected to mention that I did a fair bit
of investigation before hand and was able to confirm that all platforms
we care about (Windows, Linux/Unix, OS X) and all compilers we care
about (GCC, LLVM) support weak symbols.

There may be different attribute names across compilers--it wasn't very
clear to me, but they definitely all have the feature in some form.

Regards,

Anthony Liguori

>
> -- PMM
diff mbox

Patch

diff --git a/compiler.h b/compiler.h
index 736e770..f76921e 100644
--- a/compiler.h
+++ b/compiler.h
@@ -45,6 +45,7 @@ 
 #  define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
 #  define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
 # endif
+#define GCC_WEAK __attribute__((weak))
 #else
 #define GCC_ATTR /**/
 #define GCC_FMT_ATTR(n, m)