18bb6de15SAntonio Nino Diaz /* 2277713e0SManish V Badarkhe * Copyright (c) 2018-2025, Arm Limited and Contributors. All rights reserved. 38bb6de15SAntonio Nino Diaz * 48bb6de15SAntonio Nino Diaz * SPDX-License-Identifier: BSD-3-Clause 58bb6de15SAntonio Nino Diaz */ 68bb6de15SAntonio Nino Diaz 78bb6de15SAntonio Nino Diaz #ifndef CDEFS_H 88bb6de15SAntonio Nino Diaz #define CDEFS_H 98bb6de15SAntonio Nino Diaz 108bb6de15SAntonio Nino Diaz #define __dead2 __attribute__((__noreturn__)) 118bb6de15SAntonio Nino Diaz #define __deprecated __attribute__((__deprecated__)) 128bb6de15SAntonio Nino Diaz #define __packed __attribute__((__packed__)) 138bb6de15SAntonio Nino Diaz #define __used __attribute__((__used__)) 148bb6de15SAntonio Nino Diaz #define __unused __attribute__((__unused__)) 15351f9cd8SYann Gautier #define __maybe_unused __attribute__((__unused__)) 168bb6de15SAntonio Nino Diaz #define __aligned(x) __attribute__((__aligned__(x))) 178bb6de15SAntonio Nino Diaz #define __section(x) __attribute__((__section__(x))) 18023f1bedSAndre Przywara #define __fallthrough __attribute__((__fallthrough__)) 1953644fa8SBoyan Karatotev #define __noinline __attribute__((__noinline__)) 20*962958d3SRohit Mathew #define __pure __attribute__((__pure__)) 21d158d425SBoyan Karatotev #if ENABLE_PAUTH 22f8138056SBoyan Karatotev #define __no_pauth __attribute__((target("branch-protection=none"))) 23d158d425SBoyan Karatotev #else 24d158d425SBoyan Karatotev #define __no_pauth 25d158d425SBoyan Karatotev #endif 261dcc28cfSDaniel Boulby #if RECLAIM_INIT_CODE 271dcc28cfSDaniel Boulby /* 281dcc28cfSDaniel Boulby * Add each function to a section that is unique so the functions can still 2953644fa8SBoyan Karatotev * be garbage collected. 3053644fa8SBoyan Karatotev * 3153644fa8SBoyan Karatotev * NOTICE: for this to work, these functions will NOT be inlined. 3253644fa8SBoyan Karatotev * TODO: the noinline attribute can be removed if RECLAIM_INIT_CODE is made 3353644fa8SBoyan Karatotev * platform agnostic and called after bl31_main(). Then, top-level functions 3453644fa8SBoyan Karatotev * (those that can't be inlined like bl31_main()) can be annotated with __init 3553644fa8SBoyan Karatotev * and noinline can be removed. 361dcc28cfSDaniel Boulby */ 3753644fa8SBoyan Karatotev #define __init __section(".text.init." __FILE__ "." __XSTRING(__LINE__)) __noinline 381dcc28cfSDaniel Boulby #else 391dcc28cfSDaniel Boulby #define __init 401dcc28cfSDaniel Boulby #endif 418bb6de15SAntonio Nino Diaz 428bb6de15SAntonio Nino Diaz #define __printflike(fmtarg, firstvararg) \ 438bb6de15SAntonio Nino Diaz __attribute__((__format__ (__printf__, fmtarg, firstvararg))) 448bb6de15SAntonio Nino Diaz 458bb6de15SAntonio Nino Diaz #define __weak_reference(sym, alias) \ 468bb6de15SAntonio Nino Diaz __asm__(".weak alias"); \ 478bb6de15SAntonio Nino Diaz __asm__(".equ alias, sym") 488bb6de15SAntonio Nino Diaz 498bb6de15SAntonio Nino Diaz #define __STRING(x) #x 508bb6de15SAntonio Nino Diaz #define __XSTRING(x) __STRING(x) 518bb6de15SAntonio Nino Diaz 52277713e0SManish V Badarkhe #define __predict_true(exp) (exp) 53277713e0SManish V Badarkhe #define __predict_false(exp) (exp) 54277713e0SManish V Badarkhe 558bb6de15SAntonio Nino Diaz #endif /* CDEFS_H */ 56