Question about genassym, locore.s and 0-sized arrays (showstopper for an icc compiled kernel)

From: Alexander Leidinger <Alexander_at_Leidinger.net>
Date: Thu, 4 Sep 2003 18:04:48 +0200
Hi,

I'm in the process of building our kernel with Intels C Compiler (icc).
So far we are able to build a working UP and SMP kernel (not completely
automated). Most of it works just fine (NFS-client is known to not
work).

At the moment I discussing an issue with Intel regarding 0-sized arrays.
gcc seems to be violating the standard and produces code with an array
size of "0", whereas icc produces code where an 0-sized array has the
size "1". This results in different nm output of genassym.o:

gcc generated:
---snip---
00000000 C BC32SELsign
00000050 C BC32SELw0
00000000 C BC32SELw1
00000000 C BC32SELw2
00000000 C BC32SELw3
---snip---

icc generated:
---snip---
00000001 C BC32SELsign
00000050 C BC32SELw0
00000001 C BC32SELw1
00000001 C BC32SELw2
00000001 C BC32SELw3
---snip---

Thus the output of genassym.sh with a icc generated genassym.o is wrong:
---snip---
#define	BC32SEL	-0x1000100010050
#define	BI_ENDCOMMON	-0x100010001000c
#define	BI_ESYMTAB	-0x1000100010044
#define	BI_KERNELNAME	-0x1000100010004
#define	BI_KERNEND	-0x1000100010048
#define	BI_NFS_DISKLESS	-0x1000100010008
#define	BI_SIZE	-0x1000100010030
---snip---

With a gcc generated genassym.o it looks like:
---snip---
#define	BC32SEL	0x50
#define	BI_ENDCOMMON	0xc
#define	BI_ESYMTAB	0x44
#define	BI_KERNELNAME	0x4
#define	BI_KERNEND	0x48
#define	BI_NFS_DISKLESS	0x8
#define	BI_SIZE	0x30
---snip---

At least the generated defines are used in locore.s, but is this the
only consumer of this "feature"? What I need to know is:
 - Do we really depend on 0-sized arrays in the code or is it just a
   genassym.sh issue?
 - If we depend on it: how hard would it be to rewrite it to not depend
   on 0-sized arrays (and does someone volunteer to rewrite it)? It
   would be nice if someone could point me to the source if it isn't
   an easy task, my contact _at_Intel is willing to convince the
   developers to change icc, but he has to "present a persuasive argument
   to development to pursue a solution".
 - If it is a genassym.sh issue: would someone with enough glue please
   provide me with a patch for genassym.sh which either uses a switch
   to understand the icc generated file or is able to detect it on it's
   own (I'm able to provide the output of nm and/or the object file)?
   Or at least describes what needs to be done, so I can try do do it
   myself after refreshing my awk knowledge?

Bye,
Alexander.

-- 
Failure is not an option. It comes bundled with your Microsoft product.

http://www.Leidinger.net                       Alexander _at_ Leidinger.net
  GPG fingerprint = C518 BC70 E67F 143F BE91  3365 79E2 9C60 B006 3FE7
Received on Thu Sep 04 2003 - 07:03:24 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:21 UTC