compiler.h: add __weak macro

Instead of writing out '__attribute__((weak))' use a shorter form.

Change-Id: If418a1d55052780077febd2d8f2089021f414b91
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/25767
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
This commit is contained in:
Aaron Durbin
2018-04-21 14:45:32 -06:00
parent 38fd6685e9
commit 6403167d29
137 changed files with 408 additions and 277 deletions

View File

@@ -17,6 +17,7 @@
#include <bootmode.h>
#include <bootstate.h>
#include <cbmem.h>
#include <compiler.h>
#include <rules.h>
#include <string.h>
#include <vb2_api.h>
@@ -141,18 +142,18 @@ int vboot_recovery_mode_enabled(void)
return !!vboot_check_recovery_request();
}
int __attribute__((weak)) clear_recovery_mode_switch(void)
int __weak clear_recovery_mode_switch(void)
{
// Weak implementation. Nothing to do.
return 0;
}
void __attribute__((weak)) log_recovery_mode_switch(void)
void __weak log_recovery_mode_switch(void)
{
// Weak implementation. Nothing to do.
}
int __attribute__((weak)) get_recovery_mode_retrain_switch(void)
int __weak get_recovery_mode_retrain_switch(void)
{
return 0;
}
@@ -175,12 +176,12 @@ int vboot_developer_mode_enabled(void)
* TODO: Create flash protection interface which implements get_write_protect_state.
* get_recovery_mode_switch should be implemented as default function.
*/
int __attribute__((weak)) get_write_protect_state(void)
int __weak get_write_protect_state(void)
{
return 0;
}
int __attribute__((weak)) get_recovery_mode_switch(void)
int __weak get_recovery_mode_switch(void)
{
return 0;
}

View File

@@ -16,6 +16,7 @@
#include <boot/coreboot_tables.h>
#include <boot_device.h>
#include <cbmem.h>
#include <compiler.h>
#include <console/cbmem_console.h>
#include <console/console.h>
#include <fmap.h>
@@ -101,7 +102,7 @@ int vboot_handoff_get_recovery_reason(void)
}
/* ============================ VBOOT REBOOT ============================== */
void __attribute__((weak)) vboot_platform_prepare_reboot(void)
void __weak vboot_platform_prepare_reboot(void)
{
}

View File

@@ -17,6 +17,7 @@
#include <arch/exception.h>
#include <assert.h>
#include <bootmode.h>
#include <compiler.h>
#include <console/console.h>
#include <console/vtxprintf.h>
#include <delay.h>
@@ -95,21 +96,21 @@ int vb2ex_read_resource(struct vb2_context *ctx,
}
/* No-op stubs that can be overridden by SoCs with hardware crypto support. */
__attribute__((weak))
__weak
int vb2ex_hwcrypto_digest_init(enum vb2_hash_algorithm hash_alg,
uint32_t data_size)
{
return VB2_ERROR_EX_HWCRYPTO_UNSUPPORTED;
}
__attribute__((weak))
__weak
int vb2ex_hwcrypto_digest_extend(const uint8_t *buf, uint32_t size)
{
BUG(); /* Should never get called if init() returned an error. */
return VB2_ERROR_UNKNOWN;
}
__attribute__((weak))
__weak
int vb2ex_hwcrypto_digest_finalize(uint8_t *digest, uint32_t digest_size)
{
BUG(); /* Should never get called if init() returned an error. */

View File

@@ -15,11 +15,12 @@
#include <arch/exception.h>
#include <arch/hlt.h>
#include <compiler.h>
#include <console/console.h>
#include <program_loading.h>
#include <security/vboot/vboot_common.h>
void __attribute__((weak)) verstage_mainboard_init(void)
void __weak verstage_mainboard_init(void)
{
/* Default empty implementation. */
}