diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-05-28 18:24:42 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-28 18:17:16 +0000 |
commit | 930f0fb171a189e83ac581181d2fa211b3c7338c (patch) | |
tree | b13174abbdec01c2f661701e900b8ec72af5e408 | |
parent | 91f79e5855bf48bfc82d99076aee3797d15fe9f0 (diff) | |
download | chrome-ec-930f0fb171a189e83ac581181d2fa211b3c7338c.tar.gz |
common: Define markers for weak symbols
This patch introduces macros to mark weak symbols. These macros are
used to annotate weak definitions, declarations, and overriding
definitions.
__override_proto: declarations
__override: definitions which take precedence
__overridable: default (weak) definitions
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:218982018,chromium.org/964060
BRANCH=none
TEST=buildall
Change-Id: I44cec41e0523e285db19a890d084b52337f64a9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633911
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
(cherry picked from commit a5c17b44c506979a56cf7ebcaf03ef86f406a3c4)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3508420
-rw-r--r-- | include/common.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h index 65c4082d53..fc9e46c56e 100644 --- a/include/common.h +++ b/include/common.h @@ -232,6 +232,33 @@ enum ec_error_list { #endif /* + * Weak symbol markers + * + * These macros are used to annotate weak definitions, their declarations, and + * overriding definitions. + * + * __override_proto: declarations + * __override: definitions which take precedence + * __overridable: default (weak) definitions + * + * For example, in foo.h: + * __override_proto void foo(void); + * + * and in foo.c: + * __overridable void foo(void) { + * ... + * } + * + * and in board.c: + * __override void foo(void) { + * ... + * } + */ +#define __override_proto +#define __override +#define __overridable __attribute__((weak)) + +/* * Mark functions that collide with stdlib so they can be hidden when linking * against libraries that require stdlib. HIDE_EC_STDLIB should be defined * before including common.h from code that links to cstdlib. |