diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2010-01-03 18:33:00 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2010-01-03 18:33:00 -0500 |
commit | 7c1b18655e6a450b5f1270a956c7146f821a2c23 (patch) | |
tree | db1c8dd00708ea798f882aaaad07b9daeb2a4e47 /src/types.h | |
parent | f9b25d306b66bbafdbf9656103b41fbb83836d03 (diff) | |
download | seabios-7c1b18655e6a450b5f1270a956c7146f821a2c23.tar.gz |
Reduce #ifs by weeding out some cross-chunk function definitions.
Reduce the need for placing #if guards around functions that are
marked as VISIBLE in another code chunk by declaring the functions as
"weak" when they are not needed.
It's still necessary to ensure that no C code references the data from
a different chunk (or an -fwhole-program compile might try to keep a
local reference).
Diffstat (limited to 'src/types.h')
-rw-r--r-- | src/types.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/types.h b/src/types.h index 7b87b867..5da299d9 100644 --- a/src/types.h +++ b/src/types.h @@ -44,9 +44,9 @@ extern void __force_link_error__only_in_16bit(void) __noreturn; // Notes a function as externally visible in the 16bit code chunk. # define VISIBLE16 __VISIBLE // Notes a function as externally visible in the 32bit flat code chunk. -# define VISIBLE32FLAT __section(".discard.func32flat." UNIQSEC) noinline +# define VISIBLE32FLAT __section(".discard.func32flat." UNIQSEC) noinline __weak // Notes a function as externally visible in the 32bit segmented code chunk. -# define VISIBLE32SEG __section(".discard.func32seg." UNIQSEC) noinline +# define VISIBLE32SEG __section(".discard.func32seg." UNIQSEC) noinline __weak // Designate a variable as (only) visible to 16bit code. # define VAR16 __section(".data16." UNIQSEC) // Designate a variable as visible to 16bit, 32bit, and assembler code. @@ -68,8 +68,8 @@ extern void __force_link_error__only_in_16bit(void) __noreturn; # define ASSERT32SEG() __force_link_error__only_in_32bit_segmented() # define ASSERT32FLAT() __force_link_error__only_in_32bit_flat() #elif MODESEGMENT == 1 -# define VISIBLE16 __section(".discard.func16." UNIQSEC) noinline -# define VISIBLE32FLAT __section(".discard.func32flat." UNIQSEC) noinline +# define VISIBLE16 __section(".discard.func16." UNIQSEC) noinline __weak +# define VISIBLE32FLAT __section(".discard.func32flat." UNIQSEC) noinline __weak # define VISIBLE32SEG __VISIBLE # define VAR16 __section(".discard.var16." UNIQSEC) # define VAR16VISIBLE VAR16 __VISIBLE __weak @@ -83,9 +83,9 @@ extern void __force_link_error__only_in_16bit(void) __noreturn; # define ASSERT32SEG() do { } while (0) # define ASSERT32FLAT() __force_link_error__only_in_32bit_flat() #else -# define VISIBLE16 __section(".discard.func16." UNIQSEC) noinline +# define VISIBLE16 __section(".discard.func16." UNIQSEC) noinline __weak # define VISIBLE32FLAT __VISIBLE -# define VISIBLE32SEG __section(".discard.func32seg." UNIQSEC) noinline +# define VISIBLE32SEG __section(".discard.func32seg." UNIQSEC) noinline __weak # define VAR16 __section(".discard.var16." UNIQSEC) # define VAR16VISIBLE VAR16 __VISIBLE __weak # define VAR16EXPORT VAR16VISIBLE |