]> xenbits.xensource.com Git - xen.git/commitdiff
xen/compiler: introduce a define for weak symbols
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 31 Jul 2018 08:23:37 +0000 (10:23 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 31 Jul 2018 08:23:37 +0000 (10:23 +0200)
And replace the open-coded versions already in tree. No functional
change.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reivewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
xen/include/xen/compiler.h
xen/include/xen/livepatch_payload.h

index a7e05681c9217409d37aba4f3d82c3628bf8b587..ff6c0f5cdd18fdde1305a53c108304d1bf70e6c2 100644 (file)
@@ -18,6 +18,8 @@
 
 #define __packed      __attribute__((__packed__))
 
+#define __weak        __attribute__((__weak__))
+
 #if (!defined(__clang__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5))
 #define unreachable() do {} while (1)
 #else
index 8f38cc2c60ee575d618c08a72ef3fcabf5c6e4db..4a1a96d054ed48180ba5f9bcf36eac508540f8e3 100644 (file)
@@ -24,7 +24,7 @@ typedef void livepatch_unloadcall_t(void);
  * executed in series by the livepatch infrastructure at patch load time.
  */
 #define LIVEPATCH_LOAD_HOOK(_fn) \
-    livepatch_loadcall_t *__attribute__((weak)) \
+    livepatch_loadcall_t *__weak \
         const livepatch_load_data_##_fn __section(".livepatch.hooks.load") = _fn;
 
 /*
@@ -33,7 +33,7 @@ typedef void livepatch_unloadcall_t(void);
  * Same as LOAD hook with s/load/unload/
  */
 #define LIVEPATCH_UNLOAD_HOOK(_fn) \
-     livepatch_unloadcall_t *__attribute__((weak)) \
+     livepatch_unloadcall_t *__weak \
         const livepatch_unload_data_##_fn __section(".livepatch.hooks.unload") = _fn;
 
 #endif /* __XEN_LIVEPATCH_PAYLOAD_H__ */