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).
-#if MODE16 == 0 && MODESEGMENT == 1
void VISIBLE32SEG
handle_apm32(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_apm);
handle_1553(regs);
}
void VISIBLE32SEG
handle_apm32(struct bregs *regs)
{
debug_enter(regs, DEBUG_HDL_apm);
handle_1553(regs);
}
* 32bit interface
****************************************************************/
* 32bit interface
****************************************************************/
-#if MODE16 == 0 && MODESEGMENT == 1
// Entry point for 32bit pci bios functions.
void VISIBLE32SEG
handle_pcibios32(struct bregs *regs)
// Entry point for 32bit pci bios functions.
void VISIBLE32SEG
handle_pcibios32(struct bregs *regs)
debug_enter(regs, DEBUG_HDL_pcibios32);
handle_1ab1(regs);
}
debug_enter(regs, DEBUG_HDL_pcibios32);
handle_1ab1(regs);
}
struct bios32_s {
u32 signature;
struct bios32_s {
u32 signature;
panic("Unimplemented shutdown status: %02x\n", status);
}
panic("Unimplemented shutdown status: %02x\n", status);
}
void VISIBLE32FLAT
s3_resume(void)
{
void VISIBLE32FLAT
s3_resume(void)
{
// 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.
// 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.
// 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.
// 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.
# define ASSERT32SEG() __force_link_error__only_in_32bit_segmented()
# define ASSERT32FLAT() __force_link_error__only_in_32bit_flat()
#elif MODESEGMENT == 1
# 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
# define VISIBLE32SEG __VISIBLE
# define VAR16 __section(".discard.var16." UNIQSEC)
# define VAR16VISIBLE VAR16 __VISIBLE __weak
# define ASSERT32SEG() do { } while (0)
# define ASSERT32FLAT() __force_link_error__only_in_32bit_flat()
#else
# 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 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
# define VAR16 __section(".discard.var16." UNIQSEC)
# define VAR16VISIBLE VAR16 __VISIBLE __weak
# define VAR16EXPORT VAR16VISIBLE