[coreboot] [PATCH] v3: prepare stage2 for -fwhole-program

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Wed Aug 27 02:59:33 CEST 2008

gcc -fwhole-program needs to mark any function which is used outside the
current compilation unit to be marked as externally_visible. We have
EXPORT_SYMBOL exactly for that purpose.

This applies to the following symbols used by x86emu and/or vm86:
- pci_read_config8
- pci_read_config16
- pci_read_config32
- pci_write_config8
- pci_write_config16
- pci_write_config32
- dev_find_pci_device
- dev_find_slot
It also applies to the main entry point of stage2:
- stage2

With this patch, I can use -fwohle-program for stage2 without any
problems. For standard compilation, this is a noop.

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

Index: corebootv3-makefilerewrite-fwholeprogram/include/device/pci_ops.h
--- corebootv3-makefilerewrite-fwholeprogram/include/device/pci_ops.h	(Revision 824)
+++ corebootv3-makefilerewrite-fwholeprogram/include/device/pci_ops.h	(Arbeitskopie)
@@ -24,11 +24,17 @@
 #include <shared.h>
 u8 pci_read_config8(struct device * dev, unsigned where);
 u16 pci_read_config16(struct device * dev, unsigned where);
 u32 pci_read_config32(struct device * dev, unsigned where);
 void pci_write_config8(struct device * dev, unsigned where, u8 val);
 void pci_write_config16(struct device * dev, unsigned where, u16 val);
 void pci_write_config32(struct device * dev, unsigned where, u32 val);
 u8 pci_conf1_read_config8(u32 bdf, int where);
Index: corebootv3-makefilerewrite-fwholeprogram/include/device/device.h
--- corebootv3-makefilerewrite-fwholeprogram/include/device/device.h	(Revision 824)
+++ corebootv3-makefilerewrite-fwholeprogram/include/device/device.h	(Arbeitskopie)
@@ -24,6 +24,7 @@
 #include <types.h>
 #include <device/resource.h>
 #include <device/path.h>
+#include <shared.h>
  * Create a 32-bit value from four characters. This is better
@@ -268,8 +269,10 @@
 struct device * alloc_find_dev(struct bus *parent, struct device_path *path, struct device_id *id);
 struct device * dev_find_device (struct device_id *devid, struct device * from);
 struct device *dev_find_pci_device(u16 vendor, u16 device, struct device *from);
 struct device * dev_find_class (unsigned int class, struct device * from);
 struct device * dev_find_slot (unsigned int bus, unsigned int devfn);
 struct device * dev_find_slot_on_smbus (unsigned int bus, unsigned int addr);
 void default_device_constructor(struct device *dev, struct device_operations *constructor);
Index: corebootv3-makefilerewrite-fwholeprogram/lib/stage2.c
--- corebootv3-makefilerewrite-fwholeprogram/lib/stage2.c	(Revision 824)
+++ corebootv3-makefilerewrite-fwholeprogram/lib/stage2.c	(Arbeitskopie)
@@ -93,3 +93,4 @@
 	return 0;


More information about the coreboot mailing list