mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Peter Mamonov <pmamonov@gmail.com>,
	s.hauer@pengutronix.de, antonynpavlov@gmail.com
Cc: barebox@lists.infradead.org
Subject: Re: RFC: types conflicts
Date: Wed, 8 Jul 2020 10:02:00 +0200	[thread overview]
Message-ID: <c50f7807-9bfa-bc70-d771-f798422760e1@pengutronix.de> (raw)
In-Reply-To: <20200707135608.31901-1-pmamonov@gmail.com>

Hello Peter,

On 7/7/20 3:56 PM, Peter Mamonov wrote:
> Hello,
> 
> I tried to build MicroPython using barebox toolchain and found a number of
> conflicts between barebox and compiler headers. Below you will find the patch
> which demostrates some of them. In this particular example the problem arises
> due to simultaneous inclusion of some compiler headers along with barebox
> version of `strings.h`, which in turn includes barebox analogs of those headers
> from `include/linux`. I belive there should be a segregation between headers in
> `include` and in `include/linux`, i.e. headers from `include/` should not
> reference <linux/*.h> headers. Yet I understand this is somewhat problematic.
> What do you think?

barebox code shouldn't make use of any compiler headers at all, except for <stdarg.h>.
The only exception are arch/sandbox/os and scripts/, which reference libc headers.
Everything else should comes out of barebox' include/ directory.

If you have foreign code that you want to port into barebox, either modify it
to use barebox headers or change the include order when building it to use _local_
versions of the headers it requires.


> 
> Regards,
> Peter
> 
> ---
>  commands/Makefile         |  1 +
>  commands/types_conflict.c | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>  create mode 100644 commands/types_conflict.c
> 
> diff --git a/commands/Makefile b/commands/Makefile
> index 817fc36e96..4e0cf34560 100644
> --- a/commands/Makefile
> +++ b/commands/Makefile
> @@ -1,3 +1,4 @@
> +obj-y				+= types_conflict.o
>  obj-$(CONFIG_STDDEV)		+= stddev.o
>  obj-$(CONFIG_CMD_DIGEST)	+= digest.o
>  obj-$(CONFIG_COMPILE_HASH)	+= hashsum.o
> diff --git a/commands/types_conflict.c b/commands/types_conflict.c
> new file mode 100644
> index 0000000000..70fee8d6f4
> --- /dev/null
> +++ b/commands/types_conflict.c
> @@ -0,0 +1,12 @@
> +#include <stdbool.h>
> +#include <stdint.h>
> +#include <stddef.h>
> +
> +#include <string.h>

barebox (except sandbox) is meant to be compiled with freestanding C implementations
that aren't required to provide a <string.h>. So no barebox code should depend on
compiler-provided <string.h>.

> +
> +int test(void);
> +
> +int test()
> +{
> +	return 0;
> +}
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2020-07-08  8:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 13:56 Peter Mamonov
2020-07-08  8:02 ` Ahmad Fatoum [this message]
2020-07-08 21:02   ` Peter Mamonov
2021-04-19  7:58     ` Ahmad Fatoum
2021-04-20 21:47       ` Peter Mamonov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c50f7807-9bfa-bc70-d771-f798422760e1@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=pmamonov@gmail.com \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox