[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] Add "-nostdinc" to gcc when HAVE_LIBC is not enabled



On Wed, Dec 13, 2017 at 09:34:15AM +0100, Samuel Thibault wrote:
> Huang Shijie, on mer. 13 déc. 2017 03:26:12 +0000, wrote:
> > On Tue, Dec 12, 2017 at 10:55:31AM +0100, Samuel Thibault wrote:
> > > Huang Shijie, on mar. 12 déc. 2017 09:50:20 +0000, wrote:
> > > >     I am trying to add the DTC to the mini-os by coping its code to 
> > > > minios.
> > > >
> > > >     I added the "-nostdinc" to gcc when the HAVE_LIBC
> > > >     is not enabled, and I copied the headers from the FreeBSD code.
> > > >
> > > >     (Of course, I copied many headers from the FreeBSD code, such as 
> > > > stddef.h, stdarg.h..)
> > > >
> > > >     It is a big patch for the mini-os. So is this a good idea, or a bad 
> > > > idea?
> > >
> > > These should be provided by the compiler, not libc. You need to add the
> > > compiler header search path along -nostdinc.
> > okay.
> > But the gcc compiler header is GPL v2,
>
> I'm not saying to copy the gcc headers, but just add the search path
> with -I.

I have dropped the "-nostdinc" option now, the following is what I did:

  1.) Use a patch to copy the libfdt to mini-os.

        ---
         Makefile                     |   15 +
         lib/libfdt/Makefile.libfdt   |   11 +
         lib/libfdt/TODO              |    3 +
         lib/libfdt/fdt.c             |  251 ++++++
         lib/libfdt/fdt.h             |  111 +++
         lib/libfdt/fdt_addresses.c   |   96 +++
         lib/libfdt/fdt_empty_tree.c  |   83 ++
         lib/libfdt/fdt_overlay.c     |  861 +++++++++++++++++++
         lib/libfdt/fdt_ro.c          |  703 ++++++++++++++++
         lib/libfdt/fdt_rw.c          |  505 +++++++++++
         lib/libfdt/fdt_strerror.c    |  102 +++
         lib/libfdt/fdt_sw.c          |  300 +++++++
         lib/libfdt/fdt_wip.c         |  139 ++++
         lib/libfdt/libfdt.h          | 1899 
++++++++++++++++++++++++++++++++++++++++++
         lib/libfdt/libfdt_env.h      |  139 ++++
         lib/libfdt/libfdt_internal.h |   95 +++
         lib/libfdt/version.lds       |   71 ++
        ---

  2.) Use a patch to fix the build issue for libfdt.
      The patch is like this:

       ------------------------- patch begin -----------------------------------
        We will meet the compilor error when the HAVE_LIBC is not enabled:
          --------------------------------------------------------------------
        In file included from /usr/include/aarch64-linux-gnu/sys/select.h:45:0,
                         from /usr/include/aarch64-linux-gnu/sys/types.h:219,
                         from /usr/include/stdlib.h:314,
                         from lib/libfdt/libfdt_env.h:57,
                         from lib/libfdt/fdt.c:51:
        /usr/include/aarch64-linux-gnu/bits/time.h:30:8: error: redefinition of 
‘struct timeval’
         struct timeval
                ^
        In file included from /root/mini-os/include/time.h:49:0,
                         from /usr/include/aarch64-linux-gnu/sys/types.h:132,
                         from /usr/include/stdlib.h:314,
                         from lib/libfdt/libfdt_env.h:57,
                         from lib/libfdt/fdt.c:51:
        /root/mini-os/include/sys/time.h:35:8: note: originally defined here
         struct timeval {
                ^
        minios.mk:68: recipe for target '/root/mini-os/lib/libfdt/fdt.o' failed
        make: *** [/root/mini-os/lib/libfdt/fdt.o] Error 1
          --------------------------------------------------------------------

        This patch changes the libfdt_env.h, and fix the compiler error.

        Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
        ---
         lib/libfdt/libfdt_env.h | 4 ++++
         1 file changed, 4 insertions(+)

        diff --git a/lib/libfdt/libfdt_env.h b/lib/libfdt/libfdt_env.h
        index bd24746..a78d01f 100644
        --- a/lib/libfdt/libfdt_env.h
        +++ b/lib/libfdt/libfdt_env.h
        @@ -54,7 +54,11 @@

         #include <stddef.h>
         #include <stdint.h>
        +
        +#ifdef HAVE_LIBC
         #include <stdlib.h>
        +#endif
        +
         #include <string.h>

         #ifdef __CHECKER__
        --
       ------------------------- patch end  -----------------------------------

 If there is any issue, please tell me. Thanks.

Thanks
Huang Shijie
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.