All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] Add support for the D programming language
@ 2019-09-29 16:55 Eric Le Bihan
  2019-09-29 16:56 ` [Buildroot] [PATCH 1/2] toolchain: add support for D language Eric Le Bihan
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Eric Le Bihan @ 2019-09-29 16:55 UTC (permalink / raw)
  To: buildroot

This small series add supports for the D programming language, available in
GCC since version 9.1.

Eric Le Bihan (2):
  toolchain: add support for D language
  package/gcc: add support for D language

 package/gcc/Config.in.host         | 10 ++++++++++
 package/gcc/gcc-final/gcc-final.mk |  5 +++++
 toolchain/Config.in                |  3 +++
 3 files changed, 18 insertions(+)

--
2.21.0

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 1/2] toolchain: add support for D language
  2019-09-29 16:55 [Buildroot] [PATCH 0/2] Add support for the D programming language Eric Le Bihan
@ 2019-09-29 16:56 ` Eric Le Bihan
  2019-09-29 16:56 ` [Buildroot] [PATCH 2/2] package/gcc: " Eric Le Bihan
  2019-09-30 21:03 ` [Buildroot] [PATCH 0/2] Add support for the D programming language Thomas Petazzoni
  2 siblings, 0 replies; 13+ messages in thread
From: Eric Le Bihan @ 2019-09-29 16:56 UTC (permalink / raw)
  To: buildroot

Since version 9.1, GCC provides support for the D programming language [1].

So add an option to indicate the selected toolchain supports this
language.

[1] https://dlang.org/

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 toolchain/Config.in | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 3bc3b1b4b0..c9aa95985f 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -171,6 +171,9 @@ config BR2_ENABLE_LOCALE
 config BR2_INSTALL_LIBSTDCPP
 	bool
 
+config BR2_TOOLCHAIN_HAS_DLANG
+	bool
+
 config BR2_TOOLCHAIN_HAS_FORTRAN
 	bool
 
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-09-29 16:55 [Buildroot] [PATCH 0/2] Add support for the D programming language Eric Le Bihan
  2019-09-29 16:56 ` [Buildroot] [PATCH 1/2] toolchain: add support for D language Eric Le Bihan
@ 2019-09-29 16:56 ` Eric Le Bihan
  2019-09-30 21:04   ` Thomas Petazzoni
  2019-09-30 21:03 ` [Buildroot] [PATCH 0/2] Add support for the D programming language Thomas Petazzoni
  2 siblings, 1 reply; 13+ messages in thread
From: Eric Le Bihan @ 2019-09-29 16:56 UTC (permalink / raw)
  To: buildroot

Since version 9.1, GCC provides support for the D programming language [1].

So add a Kconfig entry to enable support for it.

[1] https://dlang.org/

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/gcc/Config.in.host         | 10 ++++++++++
 package/gcc/gcc-final/gcc-final.mk |  5 +++++
 2 files changed, 15 insertions(+)

diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index fc0333d08f..1e772dc0f2 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -121,6 +121,16 @@ config BR2_TOOLCHAIN_BUILDROOT_FORTRAN
 	  Fortran language and you want Fortran libraries to be
 	  installed on your target system.
 
+config BR2_TOOLCHAIN_BUILDROOT_DLANG
+	bool "Enable D language support"
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	select BR2_TOOLCHAIN_HAS_DLANG
+	help
+	  Enable this option if you want your toolchain to support the
+	  D language and you want D libraries to be installed on your
+	  target system.
+
 config BR2_GCC_ENABLE_LTO
 	bool "Enable compiler link-time-optimization support"
 	select BR2_BINUTILS_ENABLE_LTO
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index f478fde0d7..79c88a5d60 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -55,6 +55,7 @@ endef
 # Languages supported by the cross-compiler
 GCC_FINAL_CROSS_LANGUAGES-y = c
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_INSTALL_LIBSTDCPP) += c++
+GCC_FINAL_CROSS_LANGUAGES-$(BR2_TOOLCHAIN_BUILDROOT_DLANG) += d
 GCC_FINAL_CROSS_LANGUAGES-$(BR2_TOOLCHAIN_BUILDROOT_FORTRAN) += fortran
 GCC_FINAL_CROSS_LANGUAGES = $(subst $(space),$(comma),$(GCC_FINAL_CROSS_LANGUAGES-y))
 
@@ -172,6 +173,10 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 HOST_GCC_FINAL_USR_LIBS += libstdc++
 endif
 
+ifeq ($(BR2_TOOLCHAIN_BUILDROOT_DLANG),y)
+HOST_GCC_FINAL_USR_LIBS += libgdruntime libgphobos
+endif
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT_FORTRAN),y)
 HOST_GCC_FINAL_USR_LIBS += libgfortran
 # fortran needs quadmath on x86 and x86_64
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 0/2] Add support for the D programming language
  2019-09-29 16:55 [Buildroot] [PATCH 0/2] Add support for the D programming language Eric Le Bihan
  2019-09-29 16:56 ` [Buildroot] [PATCH 1/2] toolchain: add support for D language Eric Le Bihan
  2019-09-29 16:56 ` [Buildroot] [PATCH 2/2] package/gcc: " Eric Le Bihan
@ 2019-09-30 21:03 ` Thomas Petazzoni
  2019-10-01  6:03   ` Eric Le Bihan
  2 siblings, 1 reply; 13+ messages in thread
From: Thomas Petazzoni @ 2019-09-30 21:03 UTC (permalink / raw)
  To: buildroot

Hello Eric,

On Sun, 29 Sep 2019 18:55:59 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> This small series add supports for the D programming language, available in
> GCC since version 9.1.
> 
> Eric Le Bihan (2):
>   toolchain: add support for D language
>   package/gcc: add support for D language

Could you also add support for supporting an external toolchain that provides the D language ? It's mainly a matter of:

 - tweaking the external toolchain code to copy the right libraries

 - adding a blind Config.in option to indicate that the external
   toolchain provides D language support

 - adding a visible Config.in options in the custom external toolchain
   package to ask the user if the toolchain provides D language support

 - a check to verify that if the user has declared the toolchain as
   supporting the D language, it is really supported

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-09-29 16:56 ` [Buildroot] [PATCH 2/2] package/gcc: " Eric Le Bihan
@ 2019-09-30 21:04   ` Thomas Petazzoni
  2019-10-01  5:56     ` Eric Le Bihan
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Petazzoni @ 2019-09-30 21:04 UTC (permalink / raw)
  To: buildroot

Hello Eric,

On Sun, 29 Sep 2019 18:56:01 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> +config BR2_TOOLCHAIN_BUILDROOT_DLANG
> +	bool "Enable D language support"
> +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
> +	depends on BR2_TOOLCHAIN_USES_GLIBC

Could you explain why glibc is necessary as a dependency here ?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-09-30 21:04   ` Thomas Petazzoni
@ 2019-10-01  5:56     ` Eric Le Bihan
  2019-10-01  6:56       ` Thomas Petazzoni
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Le Bihan @ 2019-10-01  5:56 UTC (permalink / raw)
  To: buildroot

Hi!
On 2019-09-30 23:04, Thomas Petazzoni wrote:
> Hello Eric,
>
> On Sun, 29 Sep 2019 18:56:01 +0200
> Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:
>
> > +config BR2_TOOLCHAIN_BUILDROOT_DLANG
> > +	bool "Enable D language support"
> > +	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
> > +	depends on BR2_TOOLCHAIN_USES_GLIBC
>
> Could you explain why glibc is necessary as a dependency here ?

The D programming language needs a runtime, named libgphobos. When
building a toolchain with uclibc-ng as libc, for qemu_aarch64_virt, the
following error occurs:

```
libtool: compile:  /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/build/./gcc/gdc -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/build/./gcc/ -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/bin/ -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/lib/ -isystem /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/include -isystem /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/sys-include -fPIC -O2 -g -nostdinc -I ../../../../libphobos/libdruntime -I . -c ../../../../libphobos/libdruntime/core/internal/abort.d -fversion=Shared -o core/internal/.libs/abort.o
/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/libphobos/libdruntime/core/sys/posix/sys/types.d:1134:39: error: undefined identifier '__SIZEOF_PTHREAD_ATTR_T'
 1134 |         byte[__SIZEOF_PTHREAD_ATTR_T] __size;
      |                                       ^
```

I haven't dug into uclibc-ng code to find out the cause of the error.
Hence the restriction to a glibc-based toolchain.

Regards,

--
ELB

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 0/2] Add support for the D programming language
  2019-09-30 21:03 ` [Buildroot] [PATCH 0/2] Add support for the D programming language Thomas Petazzoni
@ 2019-10-01  6:03   ` Eric Le Bihan
  2019-10-01  6:56     ` Thomas Petazzoni
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Le Bihan @ 2019-10-01  6:03 UTC (permalink / raw)
  To: buildroot

On 2019-09-30 23:03, Thomas Petazzoni wrote:
> Hello Eric,
>
> On Sun, 29 Sep 2019 18:55:59 +0200
> Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:
>
> > This small series add supports for the D programming language, available in
> > GCC since version 9.1.
> >
> > Eric Le Bihan (2):
> >   toolchain: add support for D language
> >   package/gcc: add support for D language
>
> Could you also add support for supporting an external toolchain that provides the D language ? It's mainly a matter of:
>
>  - tweaking the external toolchain code to copy the right libraries
>
>  - adding a blind Config.in option to indicate that the external
>    toolchain provides D language support
>
>  - adding a visible Config.in options in the custom external toolchain
>    package to ask the user if the toolchain provides D language support
>
>  - a check to verify that if the user has declared the toolchain as
>    supporting the D language, it is really supported

Given that traditional external toolchain providers do not ship
D-capable toolchains yet, I'll try using a toolchain generated with
crosstool-ng.

Regards,

--
ELB

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-10-01  5:56     ` Eric Le Bihan
@ 2019-10-01  6:56       ` Thomas Petazzoni
  2019-10-06 15:12         ` Eric Le Bihan
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Petazzoni @ 2019-10-01  6:56 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 1 Oct 2019 07:56:14 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> The D programming language needs a runtime, named libgphobos. When
> building a toolchain with uclibc-ng as libc, for qemu_aarch64_virt, the
> following error occurs:
> 
> ```
> libtool: compile:  /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/build/./gcc/gdc -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/build/./gcc/ -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/bin/ -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/lib/ -isystem /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/include -isystem /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/sys-include -fPIC -O2 -g -nostdinc -I ../../../../libphobos/libdruntime -I . -c ../../../../libphobos/libdruntime/core/internal/abort.d -fversion=Shared -o core/internal/.libs/abort.o
> /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/libphobos/libdruntime/core/sys/posix/sys/types.d:1134:39: error: undefined identifier '__SIZEOF_PTHREAD_ATTR_T'
>  1134 |         byte[__SIZEOF_PTHREAD_ATTR_T] __size;

This is off because __SIZEOF_PTHREAD_ATTR_T is defined by uClibc-ng,
for example for AArch64:

libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/bits/pthreadtypes.h:#define __SIZEOF_PTHREAD_ATTR_T        64
libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/bits/pthreadtypes.h:  char __size[__SIZEOF_PTHREAD_ATTR_T];

Perhaps there's an include missing in gcc ?

However, musl does not define __SIZEOF_PTHREAD_ATTR_T.

> I haven't dug into uclibc-ng code to find out the cause of the error.
> Hence the restriction to a glibc-based toolchain.

Fair enough, but it should be explained with a short comment above the
dependency.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 0/2] Add support for the D programming language
  2019-10-01  6:03   ` Eric Le Bihan
@ 2019-10-01  6:56     ` Thomas Petazzoni
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2019-10-01  6:56 UTC (permalink / raw)
  To: buildroot

On Tue, 1 Oct 2019 08:03:22 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> Given that traditional external toolchain providers do not ship
> D-capable toolchains yet, I'll try using a toolchain generated with
> crosstool-ng.

Well, you can also generate a toolchain with Buildroot, and then import
it as an external toolchain in Buildroot.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-10-01  6:56       ` Thomas Petazzoni
@ 2019-10-06 15:12         ` Eric Le Bihan
  2019-10-07  7:10           ` Thomas Petazzoni
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Le Bihan @ 2019-10-06 15:12 UTC (permalink / raw)
  To: buildroot

On 2019-10-01 08:56, Thomas Petazzoni wrote:
> Hello,
>
> On Tue, 1 Oct 2019 07:56:14 +0200
> Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:
>
> > The D programming language needs a runtime, named libgphobos. When
> > building a toolchain with uclibc-ng as libc, for qemu_aarch64_virt, the
> > following error occurs:
> >
> > ```
> > libtool: compile:  /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/build/./gcc/gdc -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/build/./gcc/ -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/bin/ -B/home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/lib/ -isystem /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/include -isystem /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/host/aarch64-buildroot-linux-uclibc/sys-include -fPIC -O2 -g -nostdinc -I ../../../../libphobos/libdruntime -I . -c ../../../../libphobos/libdruntime/core/internal/abort.d -fversion=Shared -o core/internal/.libs/abort.o
> > /home/eric/build/demo-dlang/qemu/aarch64/virt/uclibc/build/host-gcc-final-9.2.0/libphobos/libdruntime/core/sys/posix/sys/types.d:1134:39: error: undefined identifier '__SIZEOF_PTHREAD_ATTR_T'
> >  1134 |         byte[__SIZEOF_PTHREAD_ATTR_T] __size;
>
> This is off because __SIZEOF_PTHREAD_ATTR_T is defined by uClibc-ng,
> for example for AArch64:
>
> libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/bits/pthreadtypes.h:#define __SIZEOF_PTHREAD_ATTR_T        64
> libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/bits/pthreadtypes.h:  char __size[__SIZEOF_PTHREAD_ATTR_T];
>
> Perhaps there's an include missing in gcc ?
>
> However, musl does not define __SIZEOF_PTHREAD_ATTR_T.
>
> > I haven't dug into uclibc-ng code to find out the cause of the error.
> > Hence the restriction to a glibc-based toolchain.
>
> Fair enough, but it should be explained with a short comment above the
> dependency.

Looking at libphobos/libdruntime/core/sys/posix/sys/types.d turned out
to be very informative. It contains a list of definitions per C-runtime
mapped to architecture/OS. Bionic, uclibc and musl are supported but
only for a limited set of architectures. For some of them,
__SIZEOF_PTHREAD_ATTR_T and friends are redefined.

ARM is supported for uclibc, but Aarch64 is not (hence the build
failure). Adding the missing definitions from
libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/bits/pthreadtypes.h is
trivial, but then the build chokes on siginfo_t not being correct. So
deep work is required.

Even some combinations defined in types.d fail to build (e.g.
x86_64+musl or ARM/uclibc).

In the end, glibc turns out to be the only C-runtime covering most of
the architectures supported by Buildroot: x86_64, Aarch64, ARM,
MIPS{32,64}, PPC{,64}, RISCV32 and SPARC64.

In order to restrict the supported architectures, should
package/gcc/Config.in.host be updated to look like this?

```
config BR2_TOOLCHAIN_BUILDROOT_DLANG
	bool "Enable D language support"
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
	depends on BR2_TOOLCHAIN_USES_GLIBC
	depends on !BR2_arc
	depends on !BR2_csky
	depends on !BR2_m68k
	depends on !BR2_microblaze
	depends on !BR2_nds32
	depends on !BR2_nios2
	depends on !BR2_or1k
	depends on !BR2_sparc
	depends on !BR2_xtensa
```

Regards,

--
ELB

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-10-06 15:12         ` Eric Le Bihan
@ 2019-10-07  7:10           ` Thomas Petazzoni
  2019-10-07 21:09             ` Arnout Vandecappelle
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas Petazzoni @ 2019-10-07  7:10 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 6 Oct 2019 17:12:28 +0200
Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:

> Looking at libphobos/libdruntime/core/sys/posix/sys/types.d turned out
> to be very informative. It contains a list of definitions per C-runtime
> mapped to architecture/OS. Bionic, uclibc and musl are supported but
> only for a limited set of architectures. For some of them,
> __SIZEOF_PTHREAD_ATTR_T and friends are redefined.
> 
> ARM is supported for uclibc, but Aarch64 is not (hence the build
> failure). Adding the missing definitions from
> libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/bits/pthreadtypes.h is
> trivial, but then the build chokes on siginfo_t not being correct. So
> deep work is required.
> 
> Even some combinations defined in types.d fail to build (e.g.
> x86_64+musl or ARM/uclibc).
> 
> In the end, glibc turns out to be the only C-runtime covering most of
> the architectures supported by Buildroot: x86_64, Aarch64, ARM,
> MIPS{32,64}, PPC{,64}, RISCV32 and SPARC64.

OK.

> In order to restrict the supported architectures, should
> package/gcc/Config.in.host be updated to look like this?
> 
> ```
> config BR2_TOOLCHAIN_BUILDROOT_DLANG
> 	bool "Enable D language support"
> 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
> 	depends on BR2_TOOLCHAIN_USES_GLIBC
> 	depends on !BR2_arc
> 	depends on !BR2_csky
> 	depends on !BR2_m68k
> 	depends on !BR2_microblaze
> 	depends on !BR2_nds32
> 	depends on !BR2_nios2
> 	depends on !BR2_or1k
> 	depends on !BR2_sparc
> 	depends on !BR2_xtensa

I'd rather use some positive logic. In toolchain/Config.in, maybe
something like this:

config BR2_TOOLCHAIN_CAN_SUPPORT_DLANG
	bool
	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
	depends on BR2_TOLCHAIN_USES_GLIBC
	default y if BR2_arm
	default y if BR2_x86_64
	default y if ...

and then re-use that for both the internal and external toolchain cases.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-10-07  7:10           ` Thomas Petazzoni
@ 2019-10-07 21:09             ` Arnout Vandecappelle
  2019-10-07 21:16               ` Thomas Petazzoni
  0 siblings, 1 reply; 13+ messages in thread
From: Arnout Vandecappelle @ 2019-10-07 21:09 UTC (permalink / raw)
  To: buildroot



On 07/10/2019 09:10, Thomas Petazzoni wrote:
> Hello,
> 
> On Sun, 6 Oct 2019 17:12:28 +0200
> Eric Le Bihan <eric.le.bihan.dev@free.fr> wrote:
> 
>> Looking at libphobos/libdruntime/core/sys/posix/sys/types.d turned out
>> to be very informative. It contains a list of definitions per C-runtime
>> mapped to architecture/OS. Bionic, uclibc and musl are supported but
>> only for a limited set of architectures. For some of them,
>> __SIZEOF_PTHREAD_ATTR_T and friends are redefined.
>>
>> ARM is supported for uclibc, but Aarch64 is not (hence the build
>> failure). Adding the missing definitions from
>> libpthread/nptl/sysdeps/unix/sysv/linux/aarch64/bits/pthreadtypes.h is
>> trivial, but then the build chokes on siginfo_t not being correct. So
>> deep work is required.
>>
>> Even some combinations defined in types.d fail to build (e.g.
>> x86_64+musl or ARM/uclibc).
>>
>> In the end, glibc turns out to be the only C-runtime covering most of
>> the architectures supported by Buildroot: x86_64, Aarch64, ARM,
>> MIPS{32,64}, PPC{,64}, RISCV32 and SPARC64.
> 
> OK.
> 
>> In order to restrict the supported architectures, should
>> package/gcc/Config.in.host be updated to look like this?
>>
>> ```
>> config BR2_TOOLCHAIN_BUILDROOT_DLANG
>> 	bool "Enable D language support"
>> 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
>> 	depends on BR2_TOOLCHAIN_USES_GLIBC
>> 	depends on !BR2_arc
>> 	depends on !BR2_csky
>> 	depends on !BR2_m68k
>> 	depends on !BR2_microblaze
>> 	depends on !BR2_nds32
>> 	depends on !BR2_nios2
>> 	depends on !BR2_or1k
>> 	depends on !BR2_sparc
>> 	depends on !BR2_xtensa
> 
> I'd rather use some positive logic. In toolchain/Config.in, maybe
> something like this:
> 
> config BR2_TOOLCHAIN_CAN_SUPPORT_DLANG
> 	bool
> 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
> 	depends on BR2_TOLCHAIN_USES_GLIBC
> 	default y if BR2_arm
> 	default y if BR2_x86_64
> 	default y if ...
> 
> and then re-use that for both the internal and external toolchain cases.

 Nack that. An external toolchain may use a gcc branch that does support
additional architectures or a different libc or a gcc version < 9. So for the
external toolchain, there should just be a BR2_TOOLCHAIN_EXTERNAL_CUSTOM_DLANG
that is user-settable (and verified with a compiler test).

 Also, there should be a hidden BR2_TOOLCHAIN_HAS_DLANG option that gets
selected by BR2_TOOLCHAIN_BUILDROOT_DLANG and
BR2_TOOLCHAIN_EXTERNAL_CUSTOM_DLANG (and possibly by other external toolchains
in the future).


 Regards,
 Arnout


> 
> Thanks!
> 
> Thomas
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Buildroot] [PATCH 2/2] package/gcc: add support for D language
  2019-10-07 21:09             ` Arnout Vandecappelle
@ 2019-10-07 21:16               ` Thomas Petazzoni
  0 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2019-10-07 21:16 UTC (permalink / raw)
  To: buildroot

On Mon, 7 Oct 2019 23:09:28 +0200
Arnout Vandecappelle <arnout@mind.be> wrote:

> > config BR2_TOOLCHAIN_CAN_SUPPORT_DLANG
> > 	bool
> > 	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
> > 	depends on BR2_TOLCHAIN_USES_GLIBC
> > 	default y if BR2_arm
> > 	default y if BR2_x86_64
> > 	default y if ...
> > 
> > and then re-use that for both the internal and external toolchain cases.  
> 
>  Nack that. An external toolchain may use a gcc branch that does support
> additional architectures or a different libc or a gcc version < 9. So for the
> external toolchain, there should just be a BR2_TOOLCHAIN_EXTERNAL_CUSTOM_DLANG
> that is user-settable (and verified with a compiler test).

That's true. I thought about that when writing my reply, but didn't see
a good solution to handle that.

>  Also, there should be a hidden BR2_TOOLCHAIN_HAS_DLANG option that gets
> selected by BR2_TOOLCHAIN_BUILDROOT_DLANG and
> BR2_TOOLCHAIN_EXTERNAL_CUSTOM_DLANG (and possibly by other external toolchains
> in the future).

This is exactly what I suggested in my initial reply to Eric's patches.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-10-07 21:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-29 16:55 [Buildroot] [PATCH 0/2] Add support for the D programming language Eric Le Bihan
2019-09-29 16:56 ` [Buildroot] [PATCH 1/2] toolchain: add support for D language Eric Le Bihan
2019-09-29 16:56 ` [Buildroot] [PATCH 2/2] package/gcc: " Eric Le Bihan
2019-09-30 21:04   ` Thomas Petazzoni
2019-10-01  5:56     ` Eric Le Bihan
2019-10-01  6:56       ` Thomas Petazzoni
2019-10-06 15:12         ` Eric Le Bihan
2019-10-07  7:10           ` Thomas Petazzoni
2019-10-07 21:09             ` Arnout Vandecappelle
2019-10-07 21:16               ` Thomas Petazzoni
2019-09-30 21:03 ` [Buildroot] [PATCH 0/2] Add support for the D programming language Thomas Petazzoni
2019-10-01  6:03   ` Eric Le Bihan
2019-10-01  6:56     ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.