switch-coreboot/include
Carl-Daniel Hailfinger 48fe3ab5ef Current v3 code has a big problem: Shared functions.
Calling non-PIC code from PIC code needs an ABI wrapper and we don't
provide one. Our trick with function pointers is exceedingly fragile:
- it depends on gcc not being clever enough
- it forces us to compile all initram source files in one go
- parallelizing initram compilation breaks the code
- compiling one initram source file at a time breaks the code
- enabling higher optimizations breaks the code
- enabling -fwhole-program breaks the code
- declaring the function pointers const breaks the code
- it's an undocumented side effect of gcc which will go away
- we need excessively ugly shared function wrappers
- the shared function wrappers had more than their fair share of bugs
- almost nobody understands the wrappers completely
- Segher warns against them: "So why do you think this should work?
You're telling it to link PIC to non-PIC. Did you read the manual? It's
just not allowed. It cannot ever work."

Kill the SHARED wrappers and use a real ABI wrapper.
The wrapper code is autogenerated on demand.
Any function compiled into stage0 is now shared by default, yet the size
and code generation of stage0/1/2 code are unchanged. Initram code size
does decrease quite a bit and the difficulty of creating shared
functions is now zero.

The patch includes extensive documentation about the inner workings of
the new wrappers and the reasons why they look like this.

Build and boot tested on qemu.
Build tested on all targets.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

Ron says:
Wow. we've need this fix for a long time.

Acked-by: Ronald G. Minnich <rminnich@gmail.com>


git-svn-id: svn://coreboot.org/repository/coreboot-v3@775 f3766cd6-281f-0410-b1cd-43a5c92072e9
2008-08-16 00:10:25 +00:00
..
arch/x86 Introduce a generic global variable storage mechanism and switch the 2008-08-14 09:25:58 +00:00
device Here we start to see the good design of 3. In v2, there were pci ops in 2008-08-13 02:41:29 +00:00
console.h Introduce a generic global variable storage mechanism and switch the 2008-08-14 09:25:58 +00:00
elf.h Now version 3: LinuxBIOS -> coreboot rename. 2008-01-27 18:54:57 +00:00
elf_boot.h Use the same naming convention and placement for "include guards" in 2007-05-21 06:48:47 +00:00
ip_checksum.h Now version 3: LinuxBIOS -> coreboot rename. 2008-01-27 18:54:57 +00:00
isa-dma.h Now version 3: LinuxBIOS -> coreboot rename. 2008-01-27 18:54:57 +00:00
keyboard.h Now version 3: LinuxBIOS -> coreboot rename. 2008-01-27 18:54:57 +00:00
lar.h Print name of compression algorithm in addition to the corresponding 2008-02-18 00:48:25 +00:00
lib.h Make some things (die, mem*, resourcemap code, option code) SHARED. 2008-08-12 03:39:39 +00:00
mc146818rtc.h Make some things (die, mem*, resourcemap code, option code) SHARED. 2008-08-12 03:39:39 +00:00
post_code.h A lot of the v3 header files require other header files to be #included 2008-02-19 00:34:32 +00:00
shared.h Current v3 code has a big problem: Shared functions. 2008-08-16 00:10:25 +00:00
spd.h A lot of the v3 header files require other header files to be #included 2008-02-19 00:34:32 +00:00
spinlock.h Remove superfluous checks for boolean CONFIG_* variables where we tested 2008-02-14 22:34:40 +00:00
string.h Make some things (die, mem*, resourcemap code, option code) SHARED. 2008-08-12 03:39:39 +00:00
tables.h Implements console and serial lbtable records compatible to cbv2 as of r3396 2008-06-29 06:43:01 +00:00
uart8250.h Use the same naming convention and placement for "include guards" in 2007-05-21 06:48:47 +00:00