[coreboot] [RFC] Error out on implicit declarations

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Mon Dec 22 14:47:57 CET 2008


On 18.12.2008 19:33, Myles Watson wrote:
> On Thu, Dec 18, 2008 at 11:08 AM, Marc Jones <marcj303 at gmail.com> wrote:
>   
>> On Thu, Dec 18, 2008 at 10:22 AM, Myles Watson <mylesgw at gmail.com> wrote:
>>     
>>> On Thu, Dec 18, 2008 at 7:52 AM, Jordan Crouse <jordan at cosmicpenguin.net
>>>
>>> wrote:
>>>       
>>>> Myles Watson wrote:
>>>>         
>>>>> On Thu, Dec 18, 2008 at 3:18 AM, Carl-Daniel Hailfinger <
>>>>> c-d.hailfinger.devel.2006 at gmx.net> wrote:
>>>>>
>>>>>           
>>>>>> Bao, Zheng found a bug which killed SATA booting on my board.
>>>>>>
>>>>>> This happened because we do not error out on implicit function
>>>>>> declarations. The linker has no way of checking whether the implicitly
>>>>>> assumed function signature is identical to the real signature, so
>>>>>> mismatches can occur and these mismatches are practically impossible
>>>>>> to debug because the code looks completely correct.
>>>>>>
>>>>>> Adding -Werror-implicit-function-declaration to our CFLAGS would solve
>>>>>> this problem nicely, but a lot of files in the tree need to be fixed.
>>>>>>
>>>>>>             
>>>>> I think this is a great idea.  Isn't the correct order to fix all the
>>>>> warnings, then make it an error?
>>>>>           
>>>> Yeah - the unfortunate thing about changes like this is that you end up
>>>> being responsible for fixing the errors.. :)
>>>>         
>>>       
>>>> Carl-Daniel - if you post a list of offending files, we'll all help
>>>> clear them up.  Dumping the log through grep "implicit 
>>>> declaration of function" should suffice.
>>>>         
> I'm attaching a patch which I thought was trivial, but breaks things all
> over the place.  I'm not sure how this will need to be done.  It looks like
> a problem with romcc vs. CAR.
>   

Try this patch. It passes abuild.

Regards,
Carl-Daniel

Fix implicit declarations of pci_read_config8 and pci_write_config8 in
the following files:
src/mainboard/intel/jarrell/reset.c
src/mainboard/supermicro/x6dai_g/reset.c
src/mainboard/supermicro/x6dhe_g2/reset.c
src/mainboard/supermicro/x6dhe_g/reset.c
src/mainboard/supermicro/x6dhr_ig2/reset.c
src/mainboard/supermicro/x6dhr_ig/reset.c

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

Index: LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dai_g/reset.c
===================================================================
--- LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dai_g/reset.c	(Revision 3829)
+++ LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dai_g/reset.c	(Arbeitskopie)
@@ -3,6 +3,8 @@
 #include <device/pci_ids.h>
 #ifndef __ROMCC__
 #include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ops.h>
 #define PCI_ID(VENDOR_ID, DEVICE_ID) \
 	((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
 #define PCI_DEV_INVALID 0
Index: LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhe_g/reset.c
===================================================================
--- LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhe_g/reset.c	(Revision 3829)
+++ LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhe_g/reset.c	(Arbeitskopie)
@@ -3,6 +3,8 @@
 #include <device/pci_ids.h>
 #ifndef __ROMCC__
 #include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ops.h>
 #define PCI_ID(VENDOR_ID, DEVICE_ID) \
 	((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
 #define PCI_DEV_INVALID 0
Index: LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhe_g2/reset.c
===================================================================
--- LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhe_g2/reset.c	(Revision 3829)
+++ LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhe_g2/reset.c	(Arbeitskopie)
@@ -3,6 +3,8 @@
 #include <device/pci_ids.h>
 #ifndef __ROMCC__
 #include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ops.h>
 #define PCI_ID(VENDOR_ID, DEVICE_ID) \
 	((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
 #define PCI_DEV_INVALID 0
Index: LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhr_ig/reset.c
===================================================================
--- LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhr_ig/reset.c	(Revision 3829)
+++ LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhr_ig/reset.c	(Arbeitskopie)
@@ -3,6 +3,8 @@
 #include <device/pci_ids.h>
 #ifndef __ROMCC__
 #include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ops.h>
 #define PCI_ID(VENDOR_ID, DEVICE_ID) \
 	((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
 #define PCI_DEV_INVALID 0
Index: LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhr_ig2/reset.c
===================================================================
--- LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhr_ig2/reset.c	(Revision 3829)
+++ LinuxBIOSv2-implicit_declarations/src/mainboard/supermicro/x6dhr_ig2/reset.c	(Arbeitskopie)
@@ -3,6 +3,8 @@
 #include <device/pci_ids.h>
 #ifndef __ROMCC__
 #include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ops.h>
 #define PCI_ID(VENDOR_ID, DEVICE_ID) \
 	((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
 #define PCI_DEV_INVALID 0
Index: LinuxBIOSv2-implicit_declarations/src/mainboard/intel/jarrell/reset.c
===================================================================
--- LinuxBIOSv2-implicit_declarations/src/mainboard/intel/jarrell/reset.c	(Revision 3829)
+++ LinuxBIOSv2-implicit_declarations/src/mainboard/intel/jarrell/reset.c	(Arbeitskopie)
@@ -3,6 +3,8 @@
 #include <device/pci_ids.h>
 #ifndef __ROMCC__
 #include <device/device.h>
+#include <device/pci.h>
+#include <device/pci_ops.h>
 #define PCI_ID(VENDOR_ID, DEVICE_ID) \
 	((((DEVICE_ID) & 0xFFFF) << 16) | ((VENDOR_ID) & 0xFFFF))
 #define PCI_DEV_INVALID 0


-- 
http://www.hailfinger.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: linuxbios_implicit_declarations_mainboard_pci_readwrite_config8.diff
Type: text/x-patch
Size: 3669 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20081222/c1ab0c16/attachment.diff>


More information about the coreboot mailing list