* [Buildroot] [PATCH 1/1] [1/1] package/uclibc: Enable compile in thumb mode when selected @ 2015-12-04 22:56 penman 2015-12-05 15:08 ` Arnout Vandecappelle 2015-12-14 1:28 ` [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option Paul Enman 0 siblings, 2 replies; 15+ messages in thread From: penman @ 2015-12-04 22:56 UTC (permalink / raw) To: buildroot Signed-off-by: penman <paul.enman@gmail.com> --- package/uclibc/uclibc.mk | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk index c62a40f..4f5c605 100644 --- a/package/uclibc/uclibc.mk +++ b/package/uclibc/uclibc.mk @@ -86,9 +86,15 @@ define UCLIBC_ARM_ABI_CONFIG $(call KCONFIG_ENABLE_OPT,CONFIG_ARM_EABI,$(@D)/.config) endef -# Thumb build is broken with threads, build in ARM mode -ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy) -UCLIBC_EXTRA_CFLAGS += -marm +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_ARM_INSTRUCTIONS_THUMB2),y) +define UCLIBC_ARM_THUMB_CONFIG + $(call KCONFIG_ENABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) +endef +else +define UCLIBC_ARM_THUMB_CONFIG + $(call KCONFIG_DISABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) +endef endif ifeq ($(BR2_UCLIBC_ARM_BX),y) @@ -373,6 +379,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS $(UCLIBC_ARC_TYPE_CONFIG) $(UCLIBC_ARC_PAGE_SIZE_CONFIG) $(UCLIBC_ARM_ABI_CONFIG) + $(UCLIBC_ARM_THUMB_CONFIG) $(UCLIBC_ARM_BX_CONFIG) $(UCLIBC_MIPS_ABI_CONFIG) $(UCLIBC_MIPS_ISA_CONFIG) -- 1.9.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH 1/1] [1/1] package/uclibc: Enable compile in thumb mode when selected 2015-12-04 22:56 [Buildroot] [PATCH 1/1] [1/1] package/uclibc: Enable compile in thumb mode when selected penman @ 2015-12-05 15:08 ` Arnout Vandecappelle 2015-12-08 19:34 ` Paul Enman 2015-12-14 1:28 ` [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option Paul Enman 1 sibling, 1 reply; 15+ messages in thread From: Arnout Vandecappelle @ 2015-12-05 15:08 UTC (permalink / raw) To: buildroot Hi penman, On 04-12-15 23:56, penman wrote: > Signed-off-by: penman <paul.enman@gmail.com> Please use your full real name in the Sob (I guess that's Paul Enman). > --- > package/uclibc/uclibc.mk | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk > index c62a40f..4f5c605 100644 > --- a/package/uclibc/uclibc.mk > +++ b/package/uclibc/uclibc.mk > @@ -86,9 +86,15 @@ define UCLIBC_ARM_ABI_CONFIG > $(call KCONFIG_ENABLE_OPT,CONFIG_ARM_EABI,$(@D)/.config) > endef > > -# Thumb build is broken with threads, build in ARM mode Can you explain what changed in the last two years since this fix was introduced in commit d244782ca? It might have been fixed in -ng, but 0.9.33.2 hasn't changed in a very long time so I guess it's still broken there. You'll need to add a condition on -NG. Or it could be gcc that has been fixed, but in that case please verify that it works with gcc-4.7 Regards, Arnout > -ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy) > -UCLIBC_EXTRA_CFLAGS += -marm > +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_ARM_INSTRUCTIONS_THUMB2),y) > +define UCLIBC_ARM_THUMB_CONFIG > + $(call KCONFIG_ENABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) > + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) > +endef > +else > +define UCLIBC_ARM_THUMB_CONFIG > + $(call KCONFIG_DISABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) > +endef > endif > > ifeq ($(BR2_UCLIBC_ARM_BX),y) > @@ -373,6 +379,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS > $(UCLIBC_ARC_TYPE_CONFIG) > $(UCLIBC_ARC_PAGE_SIZE_CONFIG) > $(UCLIBC_ARM_ABI_CONFIG) > + $(UCLIBC_ARM_THUMB_CONFIG) > $(UCLIBC_ARM_BX_CONFIG) > $(UCLIBC_MIPS_ABI_CONFIG) > $(UCLIBC_MIPS_ISA_CONFIG) > -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH 1/1] [1/1] package/uclibc: Enable compile in thumb mode when selected 2015-12-05 15:08 ` Arnout Vandecappelle @ 2015-12-08 19:34 ` Paul Enman 0 siblings, 0 replies; 15+ messages in thread From: Paul Enman @ 2015-12-08 19:34 UTC (permalink / raw) To: buildroot Hi Arnout, Thanks, I checked the old commit and tested with both uClibc-0.9.33 and uClibc-ng and older gcc; I was suprised to discover updated gcc versions resolve the issue (uclibc/arm: doesn't build in thumb(1) mode with threads). With this existing (v1) patch, for example: Config: arm926t, thumb1; builds only with gcc-4.9 or better Config: cortex-a5, thumb2; builds with all configuration options gcc-4.7 through gcc-5.x Config: cortex-m3, thumb1 or thumb2; builds with all configuration options gcc-4.7 though gcc-5.x Since uclibc has some unresolved cases building with older gcc using thumb1, I'll limit the scope and prepare a v2 patch that will pass the thumb config option to uclibc when using thumb2 instruction set and not interfere with the existing thumb1 workaround that relies on interworking between arm and thumb instructions. On Sat, Dec 5, 2015 at 9:08 AM, Arnout Vandecappelle <arnout@mind.be> wrote: > Hi penman, > > On 04-12-15 23:56, penman wrote: > > Signed-off-by: penman <paul.enman@gmail.com> > > Please use your full real name in the Sob (I guess that's Paul Enman). > > > --- > > package/uclibc/uclibc.mk | 13 ++++++++++--- > > 1 file changed, 10 insertions(+), 3 deletions(-) > > > > diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk > > index c62a40f..4f5c605 100644 > > --- a/package/uclibc/uclibc.mk > > +++ b/package/uclibc/uclibc.mk > > @@ -86,9 +86,15 @@ define UCLIBC_ARM_ABI_CONFIG > > $(call KCONFIG_ENABLE_OPT,CONFIG_ARM_EABI,$(@D)/.config) > > endef > > > > -# Thumb build is broken with threads, build in ARM mode > > Can you explain what changed in the last two years since this fix was > introduced in commit d244782ca? It might have been fixed in -ng, but > 0.9.33.2 > hasn't changed in a very long time so I guess it's still broken there. > You'll > need to add a condition on -NG. > > Or it could be gcc that has been fixed, but in that case please verify > that it > works with gcc-4.7 > > Regards, > Arnout > > > -ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy) > > -UCLIBC_EXTRA_CFLAGS += -marm > > +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_ARM_INSTRUCTIONS_THUMB2),y) > > +define UCLIBC_ARM_THUMB_CONFIG > > + $(call KCONFIG_ENABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) > > + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) > > +endef > > +else > > +define UCLIBC_ARM_THUMB_CONFIG > > + $(call KCONFIG_DISABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) > > +endef > > endif > > > > ifeq ($(BR2_UCLIBC_ARM_BX),y) > > @@ -373,6 +379,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS > > $(UCLIBC_ARC_TYPE_CONFIG) > > $(UCLIBC_ARC_PAGE_SIZE_CONFIG) > > $(UCLIBC_ARM_ABI_CONFIG) > > + $(UCLIBC_ARM_THUMB_CONFIG) > > $(UCLIBC_ARM_BX_CONFIG) > > $(UCLIBC_MIPS_ABI_CONFIG) > > $(UCLIBC_MIPS_ISA_CONFIG) > > > > > -- > Arnout Vandecappelle arnout at mind be > Senior Embedded Software Architect +32-16-286500 > Essensium/Mind http://www.mind.be > G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven > LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle > GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151208/b7827b23/attachment.html> ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-04 22:56 [Buildroot] [PATCH 1/1] [1/1] package/uclibc: Enable compile in thumb mode when selected penman 2015-12-05 15:08 ` Arnout Vandecappelle @ 2015-12-14 1:28 ` Paul Enman 2015-12-15 22:03 ` Thomas Petazzoni 1 sibling, 1 reply; 15+ messages in thread From: Paul Enman @ 2015-12-14 1:28 UTC (permalink / raw) To: buildroot From: penman <paul.enman@gmail.com> Signed-off-by: Paul Enman <paul.enman@gmail.com> --- When buildroot is configured to build uClibc with thumb, it uses a workaround for that relies on interworking between arm and thumb instructions and does not set the config file to enable compile in thumb mode. This patch enables buildroot to configure and compile uClibc in thumb mode. arch/Config.in.arm | 18 +++++++++--------- package/uclibc/uclibc.mk | 12 ++++++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/arch/Config.in.arm b/arch/Config.in.arm index 67ff384..2d318f2 100644 --- a/arch/Config.in.arm +++ b/arch/Config.in.arm @@ -374,6 +374,15 @@ config BR2_ARM_INSTRUCTIONS_ARM This option instructs the compiler to generate regular ARM instructions, that are all 32 bits wide. +config BR2_ARM_INSTRUCTIONS_THUMB2 + bool "Thumb2" + depends on BR2_ARM_CPU_HAS_THUMB2 + help + This option instructions the compiler to generate Thumb2 + instructions, which allows to mix 16 bits instructions and + 32 bits instructions. This generally provides a much smaller + compiled binary size. + config BR2_ARM_INSTRUCTIONS_THUMB bool "Thumb" depends on BR2_ARM_CPU_HAS_THUMB @@ -389,15 +398,6 @@ comment "Thumb1 is not compatible with VFP" depends on BR2_ARM_CPU_HAS_THUMB depends on !BR2_ARM_SOFT_FLOAT -config BR2_ARM_INSTRUCTIONS_THUMB2 - bool "Thumb2" - depends on BR2_ARM_CPU_HAS_THUMB2 - help - This option instructions the compiler to generate Thumb2 - instructions, which allows to mix 16 bits instructions and - 32 bits instructions. This generally provides a much smaller - compiled binary size. - endchoice config BR2_ARCH diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk index c62a40f..6685325 100644 --- a/package/uclibc/uclibc.mk +++ b/package/uclibc/uclibc.mk @@ -91,6 +91,17 @@ ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy) UCLIBC_EXTRA_CFLAGS += -marm endif +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB2),y) +define UCLIBC_ARM_THUMB_CONFIG + $(call KCONFIG_ENABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) +endef +else +define UCLIBC_ARM_THUMB_CONFIG + $(call KCONFIG_DISABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) +endef +endif + ifeq ($(BR2_UCLIBC_ARM_BX),y) define UCLIBC_ARM_BX_CONFIG $(call KCONFIG_ENABLE_OPT,USE_BX,$(@D)/.config) @@ -373,6 +384,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS $(UCLIBC_ARC_TYPE_CONFIG) $(UCLIBC_ARC_PAGE_SIZE_CONFIG) $(UCLIBC_ARM_ABI_CONFIG) + $(UCLIBC_ARM_THUMB_CONFIG) $(UCLIBC_ARM_BX_CONFIG) $(UCLIBC_MIPS_ABI_CONFIG) $(UCLIBC_MIPS_ISA_CONFIG) -- 1.9.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-14 1:28 ` [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option Paul Enman @ 2015-12-15 22:03 ` Thomas Petazzoni 2015-12-16 7:10 ` Waldemar Brodkorb ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Thomas Petazzoni @ 2015-12-15 22:03 UTC (permalink / raw) To: buildroot Paul, On Sun, 13 Dec 2015 19:28:40 -0600, Paul Enman wrote: > From: penman <paul.enman@gmail.com> This is still not good, it should be your full name here as well. > > Signed-off-by: Paul Enman <paul.enman@gmail.com> > --- > > When buildroot is configured to build uClibc with thumb, it uses a workaround > for that relies on interworking between arm and thumb instructions and does > not set the config file to enable compile in thumb mode. > > This patch enables buildroot to configure and compile uClibc in thumb mode. Why do you put all these explanations after the "---" sign? They should really be part of the commit log. > > arch/Config.in.arm | 18 +++++++++--------- > package/uclibc/uclibc.mk | 12 ++++++++++++ > 2 files changed, 21 insertions(+), 9 deletions(-) > > diff --git a/arch/Config.in.arm b/arch/Config.in.arm > index 67ff384..2d318f2 100644 > --- a/arch/Config.in.arm > +++ b/arch/Config.in.arm > @@ -374,6 +374,15 @@ config BR2_ARM_INSTRUCTIONS_ARM > This option instructs the compiler to generate regular ARM > instructions, that are all 32 bits wide. > > +config BR2_ARM_INSTRUCTIONS_THUMB2 > + bool "Thumb2" > + depends on BR2_ARM_CPU_HAS_THUMB2 > + help > + This option instructions the compiler to generate Thumb2 > + instructions, which allows to mix 16 bits instructions and > + 32 bits instructions. This generally provides a much smaller > + compiled binary size. > + > config BR2_ARM_INSTRUCTIONS_THUMB > bool "Thumb" > depends on BR2_ARM_CPU_HAS_THUMB > @@ -389,15 +398,6 @@ comment "Thumb1 is not compatible with VFP" > depends on BR2_ARM_CPU_HAS_THUMB > depends on !BR2_ARM_SOFT_FLOAT > > -config BR2_ARM_INSTRUCTIONS_THUMB2 > - bool "Thumb2" > - depends on BR2_ARM_CPU_HAS_THUMB2 > - help > - This option instructions the compiler to generate Thumb2 > - instructions, which allows to mix 16 bits instructions and > - 32 bits instructions. This generally provides a much smaller > - compiled binary size. I don't understand why you are re-ordering the options here. Why are you doing this? > +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB2),y) > +define UCLIBC_ARM_THUMB_CONFIG > + $(call KCONFIG_ENABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) According to the help text of this uClibc option: Say 'y' here to force building uClibc in thumb mode. Say 'n' to use your compiler's default mode. When you have BR2_ARM_INSTRUCTIONS_THUMB2, the compiler already produces Thumb2 code by default, because the compiler is built with --with-mode=thumb. So could you be more specific on which cases this patch is fixing by expanding the commit log? > + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) What is the relation between this and Thumb ? Also, note that there is already some Thumb-related stuff in uclibc.mk, which precisely forces to *not* use Thumb (1): # Thumb build is broken with threads, build in ARM mode ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy) UCLIBC_EXTRA_CFLAGS += -marm endif Thanks, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-15 22:03 ` Thomas Petazzoni @ 2015-12-16 7:10 ` Waldemar Brodkorb 2015-12-16 21:49 ` Arnout Vandecappelle 2015-12-16 22:08 ` Arnout Vandecappelle 2015-12-23 16:16 ` Paul Enman 2 siblings, 1 reply; 15+ messages in thread From: Waldemar Brodkorb @ 2015-12-16 7:10 UTC (permalink / raw) To: buildroot Hi, Thomas Petazzoni wrote, > Paul, > > > + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) > > What is the relation between this and Thumb ? The user context manipulation functions in uClibc are using non-thumb instructions and result in a compile failure. > Also, note that there is already some Thumb-related stuff in uclibc.mk, > which precisely forces to *not* use Thumb (1): > > # Thumb build is broken with threads, build in ARM mode > ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy) > UCLIBC_EXTRA_CFLAGS += -marm > endif This is no longer the case for uClibc-ng. There where fixes made, even in uClibc master to allow building thumb-only builds with threads enabled. I can just not recall, if Linuxthreads or NPTL must be used for that, or if both are working. May be Paul can check it? Paul, do you have a embedded system, where you test this? Is it a noMMU cortex-m3/cortex-m4 or some MMU system? best regards Waldemar ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-16 7:10 ` Waldemar Brodkorb @ 2015-12-16 21:49 ` Arnout Vandecappelle 2015-12-19 9:13 ` Waldemar Brodkorb 0 siblings, 1 reply; 15+ messages in thread From: Arnout Vandecappelle @ 2015-12-16 21:49 UTC (permalink / raw) To: buildroot On 16-12-15 08:10, Waldemar Brodkorb wrote: > Hi, > Thomas Petazzoni wrote, >> Paul, >> >>> + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) >> >> What is the relation between this and Thumb ? > > The user context manipulation functions in uClibc are using > non-thumb instructions and result in a compile failure. Some packages need context functions, that's why they are enabled in our default uClibc config. Cfr. d01aaa7 (by you, Waldemar). So if you do this, you'll need to make some packages depend on !THUMB. While they actually did work before this commit. Can't uClibc be fixed to enable interworking for the context functions so they will work even if the rest of the library is compiled in thumb mode? >> Also, note that there is already some Thumb-related stuff in uclibc.mk, >> which precisely forces to *not* use Thumb (1): But this patch is only concerned with thumb2, not thumb1. This patch will actually explicitly disable the COMPILE_IN_THUMB uClibc option for thumb1 (which is usually no difference with the current situation, since it is not enabled in the default config). So this looks OK to me. >> >> # Thumb build is broken with threads, build in ARM mode >> ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_TOOLCHAIN_HAS_THREADS),yy) >> UCLIBC_EXTRA_CFLAGS += -marm >> endif > > This is no longer the case for uClibc-ng. There where fixes made, > even in uClibc master to allow building thumb-only builds with > threads enabled. As I commented in v1 of this patch, as long as 0.9.33 is not killed, we can't do this. We could however add a condition on -ng. Regards, Arnout > I can just not recall, if Linuxthreads or NPTL must be used for > that, or if both are working. May be Paul can check it? > Paul, do you have a embedded system, where you test this? > Is it a noMMU cortex-m3/cortex-m4 or some MMU system? > > best regards > Waldemar > _______________________________________________ > buildroot mailing list > buildroot at busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot > -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-16 21:49 ` Arnout Vandecappelle @ 2015-12-19 9:13 ` Waldemar Brodkorb 2015-12-31 19:44 ` Paul Enman 0 siblings, 1 reply; 15+ messages in thread From: Waldemar Brodkorb @ 2015-12-19 9:13 UTC (permalink / raw) To: buildroot Hi Arnout, Arnout Vandecappelle wrote, > On 16-12-15 08:10, Waldemar Brodkorb wrote: > > Hi, > > Thomas Petazzoni wrote, > >> Paul, > >> > >>> + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) > >> > >> What is the relation between this and Thumb ? > > > > The user context manipulation functions in uClibc are using > > non-thumb instructions and result in a compile failure. > > Some packages need context functions, that's why they are enabled in our > default uClibc config. Cfr. d01aaa7 (by you, Waldemar). Yeah. But the context functions are deprecated and POSIX suggests not to use them. Unfortunately they are only implemented for arm/mips/x86/x86_64 in uClibc. Someone could port the implementation for other architectures from GNU libc. But then still all noMMU architectures would be missing. Furthermore the GNU libc implementation does not work for THUMB only builds. > So if you do this, you'll need to make some packages depend on !THUMB. While > they actually did work before this commit. They did work before for people trying to run thumb code on a ARM core which allows both modes. (arm and thumb) But without this patch people can not use it to do a thumb2-only build, which is a requirement to support ARM noMMU processors like Cortex-M3 and Cortex-M4. > Can't uClibc be fixed to enable interworking for the context functions so they > will work even if the rest of the library is compiled in thumb mode? I think the intention of this patch is to support thumb2 only builds. There is no interworking support for Cortex-M3/Cortex-M4. > As I commented in v1 of this patch, as long as 0.9.33 is not killed, we can't > do this. We could however add a condition on -ng. Then I would suggest to add a condition on -ng. I think there is some userbase for it, because I remember seeing the third person trying to get something similar committed. Best regards Waldemar ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-19 9:13 ` Waldemar Brodkorb @ 2015-12-31 19:44 ` Paul Enman 0 siblings, 0 replies; 15+ messages in thread From: Paul Enman @ 2015-12-31 19:44 UTC (permalink / raw) To: buildroot Hi Waldemar, On Sat, Dec 19, 2015 at 3:13 AM, Waldemar Brodkorb <wbx@openadk.org> wrote: > Hi Arnout, > Arnout Vandecappelle wrote, > > > On 16-12-15 08:10, Waldemar Brodkorb wrote: > > > Hi, > > > Thomas Petazzoni wrote, > > >> Paul, > > >> > > >>> + $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_CONTEXT_FUNCS,$(@D)/.config) > > >> > > >> What is the relation between this and Thumb ? > > > > > > The user context manipulation functions in uClibc are using > > > non-thumb instructions and result in a compile failure. > > > > Some packages need context functions, that's why they are enabled in our > > default uClibc config. Cfr. d01aaa7 (by you, Waldemar). > > Yeah. But the context functions are deprecated and POSIX suggests > not to use them. Unfortunately they are only implemented for > arm/mips/x86/x86_64 in uClibc. Someone could port the implementation > for other architectures from GNU libc. But then still all noMMU > architectures would be missing. Furthermore the GNU libc > implementation does not work for THUMB only builds. > > > So if you do this, you'll need to make some packages depend on !THUMB. > While > > they actually did work before this commit. > > They did work before for people trying to run thumb code on a ARM > core which allows both modes. (arm and thumb) > But without this patch people can not use it to do a thumb2-only > build, which is a requirement to support ARM noMMU processors like > Cortex-M3 and Cortex-M4. > > > Can't uClibc be fixed to enable interworking for the context functions > so they > > will work even if the rest of the library is compiled in thumb mode? > > I think the intention of this patch is to support thumb2 only > builds. There is no interworking support for Cortex-M3/Cortex-M4. > > Best regards > Waldemar > Thanks for your insight, if I understand this correctly, context functions are presently supported by toolchains using (e)glibc, musl and uClibc only for architectures arm(with interworking)/mips/x86/x86_64 instructions (and not thumb, thumb2, ARC, Xtensa, others)? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151231/57e320c3/attachment.html> ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-15 22:03 ` Thomas Petazzoni 2015-12-16 7:10 ` Waldemar Brodkorb @ 2015-12-16 22:08 ` Arnout Vandecappelle 2015-12-18 0:11 ` Paul Enman 2015-12-23 16:16 ` Paul Enman 2 siblings, 1 reply; 15+ messages in thread From: Arnout Vandecappelle @ 2015-12-16 22:08 UTC (permalink / raw) To: buildroot On 15-12-15 23:03, Thomas Petazzoni wrote: > Paul, > > On Sun, 13 Dec 2015 19:28:40 -0600, Paul Enman wrote: [snip] >> +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB2),y) >> +define UCLIBC_ARM_THUMB_CONFIG >> + $(call KCONFIG_ENABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) > > According to the help text of this uClibc option: > > Say 'y' here to force building uClibc in thumb mode. > Say 'n' to use your compiler's default mode. > > When you have BR2_ARM_INSTRUCTIONS_THUMB2, the compiler already > produces Thumb2 code by default, because the compiler is built with > --with-mode=thumb. And in fact, the only thing that this option does is add -mthumb to CFLAGS, which is indeed quite useless for our internal compiler. Or actually, it's not, because it also selects USE_BX and USE_LDREXSTREX. USE_BX is currently handled by BR2_UCLIBC_ARM_BX but this is a cleaner way I think. USE_LDREXSTREX is a better alternative to the SWP instruction so that's interesting as well. Hm, looking at the uClibc code, there's something I don't quite understand. USE_LDREXSTREX is selected by COMPILE_IN_THUMB_MODE, but in fact ldrex/strex are only available on ARMv6+, so won't this break down on ARMv5? Regards, Arnout > > So could you be more specific on which cases this patch is fixing by > expanding the commit log? [snip] -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-16 22:08 ` Arnout Vandecappelle @ 2015-12-18 0:11 ` Paul Enman 2015-12-18 21:55 ` Arnout Vandecappelle 2015-12-19 9:31 ` Waldemar Brodkorb 0 siblings, 2 replies; 15+ messages in thread From: Paul Enman @ 2015-12-18 0:11 UTC (permalink / raw) To: buildroot Hi All, Thanks for your feedback and insight. Buildroot does build a working Cortex-M (thumb instructions only) uClibc toolchain by touching up the uClibc(-ng) config file with Enable COMPILE_IN_THUMB_MODE and Disable UCLIBC_HAS_CONTEXT_FUNCS ARMv5 and thumb1 targets shouldn't be effected by this patch; I'll look into guarding packages that depend on (obsolescent?) context control functions and prepare an updated version for review. The toolchain compiles a bootable kernel and both Linuxthreads and NPTL build without error, however I am looking into why flthdr shows busybox bFLT flags are set to 0x2 (Has-PIC-GOT). On Wed, Dec 16, 2015 at 4:08 PM, Arnout Vandecappelle <arnout@mind.be> wrote: > On 15-12-15 23:03, Thomas Petazzoni wrote: > > Paul, > > > > On Sun, 13 Dec 2015 19:28:40 -0600, Paul Enman wrote: > [snip] > >> +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB2),y) > >> +define UCLIBC_ARM_THUMB_CONFIG > >> + $(call KCONFIG_ENABLE_OPT,COMPILE_IN_THUMB_MODE,$(@D)/.config) > > > > According to the help text of this uClibc option: > > > > Say 'y' here to force building uClibc in thumb mode. > > Say 'n' to use your compiler's default mode. > > > > When you have BR2_ARM_INSTRUCTIONS_THUMB2, the compiler already > > produces Thumb2 code by default, because the compiler is built with > > --with-mode=thumb. > > And in fact, the only thing that this option does is add -mthumb to > CFLAGS, > which is indeed quite useless for our internal compiler. > > Or actually, it's not, because it also selects USE_BX and USE_LDREXSTREX. > USE_BX is currently handled by BR2_UCLIBC_ARM_BX but this is a cleaner way > I > think. USE_LDREXSTREX is a better alternative to the SWP instruction so > that's > interesting as well. > > Hm, looking at the uClibc code, there's something I don't quite > understand. > USE_LDREXSTREX is selected by COMPILE_IN_THUMB_MODE, but in fact > ldrex/strex are > only available on ARMv6+, so won't this break down on ARMv5? > > > Regards, > Arnout > > > > > > So could you be more specific on which cases this patch is fixing by > > expanding the commit log? > > [snip] > > > > -- > Arnout Vandecappelle arnout at mind be > Senior Embedded Software Architect +32-16-286500 > Essensium/Mind http://www.mind.be > G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven > LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle > GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151217/5ba375da/attachment.html> ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-18 0:11 ` Paul Enman @ 2015-12-18 21:55 ` Arnout Vandecappelle 2015-12-19 9:35 ` Waldemar Brodkorb 2015-12-19 9:31 ` Waldemar Brodkorb 1 sibling, 1 reply; 15+ messages in thread From: Arnout Vandecappelle @ 2015-12-18 21:55 UTC (permalink / raw) To: buildroot Hi Paul, [Please don't top-post, but reply inline like I do below.] On 18-12-15 01:11, Paul Enman wrote: > Hi All, > Thanks for your feedback and insight. Buildroot does build a working Cortex-M > (thumb instructions only) uClibc toolchain by touching up the uClibc(-ng) config > file with > > Enable COMPILE_IN_THUMB_MODE > and > Disable UCLIBC_HAS_CONTEXT_FUNCS > > ARMv5 and thumb1 targets shouldn't be effected by this patch; I'll look into > guarding packages that depend on (obsolescent?) context control functions and > prepare an updated version for review. It will be quite hard to find such packages - especially longer term. There probably should be a thumb2 toolchain added to the autobuilders to cover this case. Also, finding a good explanation for the comment is going to be difficult... Something like "foo needs ARM instructions or a (e)glibc or musl toolchain". Regards, Arnout > The toolchain compiles a bootable kernel and both Linuxthreads and NPTL build > without error, however I am looking into why flthdr shows busybox bFLT flags are > set to 0x2 (Has-PIC-GOT). [snip] -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-18 21:55 ` Arnout Vandecappelle @ 2015-12-19 9:35 ` Waldemar Brodkorb 0 siblings, 0 replies; 15+ messages in thread From: Waldemar Brodkorb @ 2015-12-19 9:35 UTC (permalink / raw) To: buildroot Hi Arnout, Arnout Vandecappelle wrote, > Hi Paul, > > [Please don't top-post, but reply inline like I do below.] > > On 18-12-15 01:11, Paul Enman wrote: > > Hi All, > > Thanks for your feedback and insight. Buildroot does build a working Cortex-M > > (thumb instructions only) uClibc toolchain by touching up the uClibc(-ng) config > > file with > > > > Enable COMPILE_IN_THUMB_MODE > > and > > Disable UCLIBC_HAS_CONTEXT_FUNCS > > > > ARMv5 and thumb1 targets shouldn't be effected by this patch; I'll look into > > guarding packages that depend on (obsolescent?) context control functions and > > prepare an updated version for review. > > It will be quite hard to find such packages - especially longer term. There > probably should be a thumb2 toolchain added to the autobuilders to cover this case. > > Also, finding a good explanation for the comment is going to be difficult... > Something like "foo needs ARM instructions or a (e)glibc or musl toolchain". Other architectures also have no support for context functions. So a more general solution would be better. What packages use context functions anyway? best regards Waldemar ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-18 0:11 ` Paul Enman 2015-12-18 21:55 ` Arnout Vandecappelle @ 2015-12-19 9:31 ` Waldemar Brodkorb 1 sibling, 0 replies; 15+ messages in thread From: Waldemar Brodkorb @ 2015-12-19 9:31 UTC (permalink / raw) To: buildroot Hi Paul, Paul Enman wrote, > Hi All, > Thanks for your feedback and insight. Buildroot does build a working Cortex-M > (thumb instructions only) uClibc toolchain by touching up the uClibc(-ng) > config file with > > Enable COMPILE_IN_THUMB_MODE > and > Disable UCLIBC_HAS_CONTEXT_FUNCS > > ARMv5 and thumb1 targets shouldn't be effected by this patch; I'll look into > guarding packages that depend on (obsolescent?) context control functions and > prepare an updated version for review. I think some general symbol like BR2_ARCH_HAS_CONTEXT_FUNCS might be useful, as other architectures like ARC/Xtensa do have the same problem here. > The toolchain compiles a bootable kernel and both Linuxthreads and NPTL build > without error, however I am looking into why flthdr shows busybox bFLT flags > are set to 0x2 (Has-PIC-GOT). Is this a problem? What target do you use and did you do some runtime testing on real hardware? best regards Waldemar ^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option 2015-12-15 22:03 ` Thomas Petazzoni 2015-12-16 7:10 ` Waldemar Brodkorb 2015-12-16 22:08 ` Arnout Vandecappelle @ 2015-12-23 16:16 ` Paul Enman 2 siblings, 0 replies; 15+ messages in thread From: Paul Enman @ 2015-12-23 16:16 UTC (permalink / raw) To: buildroot Hi Thomas On Tue, Dec 15, 2015 at 4:03 PM, Thomas Petazzoni < thomas.petazzoni@free-electrons.com> wrote: > Paul, > > On Sun, 13 Dec 2015 19:28:40 -0600, Paul Enman wrote: > > From: penman <paul.enman@gmail.com> > > This is still not good, it should be your full name here as well. > Ok > > > > > Signed-off-by: Paul Enman <paul.enman@gmail.com> > > --- > > > > When buildroot is configured to build uClibc with thumb, it uses a > workaround > > for that relies on interworking between arm and thumb instructions and > does > > not set the config file to enable compile in thumb mode. > > > > This patch enables buildroot to configure and compile uClibc in thumb > mode. > > Why do you put all these explanations after the "---" sign? They should > really be part of the commit log. > The docs/manual/contribute.txt, Line 252 indicate this; I'll add to the commit log. > > > > > arch/Config.in.arm | 18 +++++++++--------- > > package/uclibc/uclibc.mk | 12 ++++++++++++ > > 2 files changed, 21 insertions(+), 9 deletions(-) > > > > diff --git a/arch/Config.in.arm b/arch/Config.in.arm > > index 67ff384..2d318f2 100644 > > --- a/arch/Config.in.arm > > +++ b/arch/Config.in.arm > > @@ -374,6 +374,15 @@ config BR2_ARM_INSTRUCTIONS_ARM > > This option instructs the compiler to generate regular ARM > > instructions, that are all 32 bits wide. > > > > +config BR2_ARM_INSTRUCTIONS_THUMB2 > > + bool "Thumb2" > > + depends on BR2_ARM_CPU_HAS_THUMB2 > > + help > > + This option instructions the compiler to generate Thumb2 > > + instructions, which allows to mix 16 bits instructions and > > + 32 bits instructions. This generally provides a much smaller > > + compiled binary size. > > + > > config BR2_ARM_INSTRUCTIONS_THUMB > > bool "Thumb" > > depends on BR2_ARM_CPU_HAS_THUMB > > @@ -389,15 +398,6 @@ comment "Thumb1 is not compatible with VFP" > > depends on BR2_ARM_CPU_HAS_THUMB > > depends on !BR2_ARM_SOFT_FLOAT > > > > -config BR2_ARM_INSTRUCTIONS_THUMB2 > > - bool "Thumb2" > > - depends on BR2_ARM_CPU_HAS_THUMB2 > > - help > > - This option instructions the compiler to generate Thumb2 > > - instructions, which allows to mix 16 bits instructions and > > - 32 bits instructions. This generally provides a much smaller > > - compiled binary size. > > I don't understand why you are re-ordering the options here. Why are > you doing this? > I observed the default order of precedence for targets that support both Thumb and Thumb2 (currently only Cortex-M3) is to default to Thumb(1), by reordering, the default order would be ARM->Thumb2->Thumb as available. This reordering is not necessary. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151223/bd849ee7/attachment.html> ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2015-12-31 19:44 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-12-04 22:56 [Buildroot] [PATCH 1/1] [1/1] package/uclibc: Enable compile in thumb mode when selected penman 2015-12-05 15:08 ` Arnout Vandecappelle 2015-12-08 19:34 ` Paul Enman 2015-12-14 1:28 ` [Buildroot] [PATCH v2] package/uclibc: Enable compile in thumb mode configuration option Paul Enman 2015-12-15 22:03 ` Thomas Petazzoni 2015-12-16 7:10 ` Waldemar Brodkorb 2015-12-16 21:49 ` Arnout Vandecappelle 2015-12-19 9:13 ` Waldemar Brodkorb 2015-12-31 19:44 ` Paul Enman 2015-12-16 22:08 ` Arnout Vandecappelle 2015-12-18 0:11 ` Paul Enman 2015-12-18 21:55 ` Arnout Vandecappelle 2015-12-19 9:35 ` Waldemar Brodkorb 2015-12-19 9:31 ` Waldemar Brodkorb 2015-12-23 16:16 ` Paul Enman
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.