Skip to contentSkip to conversation

arch: remove support for BR2_ARC_PAGE_SIZE_4K

PATCH In review Thomas Petazzoni via buildroot 1 participant 7 messages Jul 17, 2022 – Aug 11, 2022 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch: remove support for BR2_ARC_PAGE_SIZE_4K

BR2_ARC_PAGE_SIZE_4K=y is broken with both glibc and uClibc. The link of the C library fails with:

ld: common page size (0x2000) > maximum page size (0x1000)

This is due to BR2_ARC_PAGE_SIZE_4K=y settings -Wl,-z,max-page-size=4096, but binutils apparently defaulting to common-page-size=8192.

While this could potentially be fixed by passing -Wl,-z,common-page-size=4096, these failures indicates that nobody has tested 4KB page sizes on ARC in the context of Buildroot, so it is more sensible to drop support for this feature. Should anybody need this, and have the ability to ensure that it works, we would certainly be able to re-introduce the feature.

Fixes:

http://autobuild.buildroot.net/results/c8b2f331c98453670cd982558144c4fd84674a3d/ (uclibc)
http://autobuild.buildroot.net/results/3a22f7aac38145b26c549254b819f87329e7a77e/ (glibc)

---
 Config.in.legacy   | 7 +++++++
 arch/Config.in.arc | 5 -----
 arch/arch.mk.arc   | 4 +---
 linux/linux.mk     | 4 ----
 4 files changed, 8 insertions(+), 12 deletions(-)
Config.in.legacy +7 -0
index 956da10a9f..1590a9fa25 100644
@@ -146,6 +146,13 @@ endif
 
 comment "Legacy options removed in 2022.08"
 
+config BR2_ARC_PAGE_SIZE_4K
+	bool "Support for 4KB pages on ARC removed"
+	select BR2_LEGACY
+	help
+	  The support to use 4KB pages on the ARC architecture has
+	  been removed, as it was broken with both glibc and uClibc.
+
 config BR2_PACKAGE_PHP_EXT_WDDX
 	bool "php wddx removed"
 	select BR2_LEGACY
arch/Config.in.arc +0 -5
index 388d3496bc..58103ad171 100644
@@ -103,10 +103,6 @@ choice
 	  size matching the hardware configuration. Otherwise
 	  user-space applications will fail at runtime.
 
-config BR2_ARC_PAGE_SIZE_4K
-	bool "4KB"
-	depends on !BR2_arc750d
-
 config BR2_ARC_PAGE_SIZE_8K
 	bool "8KB"
 	help
@@ -121,7 +117,6 @@ endchoice
 
 config BR2_ARC_PAGE_SIZE
 	string
-	default "4K" if BR2_ARC_PAGE_SIZE_4K
 	default "8K" if BR2_ARC_PAGE_SIZE_8K
 	default "16K" if BR2_ARC_PAGE_SIZE_16K
 
arch/arch.mk.arc +1 -3
index 32b818b0e0..697c0ff524 100644
@@ -6,9 +6,7 @@ ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic
 endif
 
 # Explicitly set LD's "max-page-size" instead of relying on some defaults
-ifeq ($(BR2_ARC_PAGE_SIZE_4K),y)
-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
-else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
+ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
 ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
 else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y)
 ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384
linux/linux.mk +0 -4
index 322ccabbd9..f012689a9e 100644
@@ -362,10 +362,6 @@ define LINUX_KCONFIG_FIXUP_CMDS
 		$(call KCONFIG_ENABLE_OPT,CONFIG_AEABI))
 	$(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR))
-	$(if $(BR2_ARC_PAGE_SIZE_4K),
-		$(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
-		$(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
-		$(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))
 	$(if $(BR2_ARC_PAGE_SIZE_8K),
 		$(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
 		$(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
Signature · 6 lines
2.36.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Thomas,

Please let me take a look at this one.

The point is we do use 4 KiB page for building for the ARCv3 processors,
see https://github.com/foss-for-synopsys-dwc-arc-processors/buildroot/blob/arc64/arch/Config.in.arc#L133.
And so far I haven't seen any problems with either uClibc or glibc.

And since I don't immediately see any changes in Binutils for ARCv3 which touch "common-page-size", I'd like to figure out what goes wrong here.

I'll get back to you soon with some explanation of what we see here.

-Alexey
________________________________
From: Thomas Petazzoni <[email protected]>
Sent: Monday, July 18, 2022 12:04 AM
To: [email protected] <[email protected]>
Cc: Thomas Petazzoni <[email protected]>; ARC Maintainers <[email protected]>
Subject: [arc-buildroot] [PATCH] arch: remove support for BR2_ARC_PAGE_SIZE_4K

BR2_ARC_PAGE_SIZE_4K=y is broken with both glibc and uClibc. The link of the C library fails with:

ld: common page size (0x2000) > maximum page size (0x1000)

This is due to BR2_ARC_PAGE_SIZE_4K=y settings -Wl,-z,max-page-size=4096, but binutils apparently defaulting to common-page-size=8192.

While this could potentially be fixed by passing -Wl,-z,common-page-size=4096, these failures indicates that nobody has tested 4KB page sizes on ARC in the context of Buildroot, so it is more sensible to drop support for this feature. Should anybody need this, and have the ability to ensure that it works, we would certainly be able to re-introduce the feature.

Fixes:

  https://urldefense.com/v3/__http://autobuild.buildroot.net/results/c8b2f331c98453670cd982558144c4fd84674a3d/__;!!A4F2R9G_pg!d146KtaYDg9TTYEfT0WXaW0aZMlQQKFLOg2D6B-sBZTaF-Z9vn7WvMcW7awUpJi0eotuvN5Rby7WE8qT-3KSx15eJwata0p_gA$  (uclibc)
  https://urldefense.com/v3/__http://autobuild.buildroot.net/results/3a22f7aac38145b26c549254b819f87329e7a77e/__;!!A4F2R9G_pg!d146KtaYDg9TTYEfT0WXaW0aZMlQQKFLOg2D6B-sBZTaF-Z9vn7WvMcW7awUpJi0eotuvN5Rby7WE8qT-3KSx15eJwbxDr7yig$  (glibc)
---
 Config.in.legacy   | 7 +++++++
 arch/Config.in.arc | 5 -----
 arch/arch.mk.arc   | 4 +---
 linux/linux.mk     | 4 ----
 4 files changed, 8 insertions(+), 12 deletions(-)
Config.in.legacy +7 -0
index 956da10a9f..1590a9fa25 100644
@@ -146,6 +146,13 @@ endif
 
 comment "Legacy options removed in 2022.08"
 
+config BR2_ARC_PAGE_SIZE_4K
+       bool "Support for 4KB pages on ARC removed"
+       select BR2_LEGACY
+       help
+         The support to use 4KB pages on the ARC architecture has
+         been removed, as it was broken with both glibc and uClibc.
+
 config BR2_PACKAGE_PHP_EXT_WDDX
         bool "php wddx removed"
         select BR2_LEGACY
arch/Config.in.arc +0 -5
index 388d3496bc..58103ad171 100644
@@ -103,10 +103,6 @@ choice
           size matching the hardware configuration. Otherwise
           user-space applications will fail at runtime.
 
-config BR2_ARC_PAGE_SIZE_4K
-       bool "4KB"
-       depends on !BR2_arc750d
-
 config BR2_ARC_PAGE_SIZE_8K
         bool "8KB"
         help
@@ -121,7 +117,6 @@ endchoice
 
 config BR2_ARC_PAGE_SIZE
         string
-       default "4K" if BR2_ARC_PAGE_SIZE_4K
         default "8K" if BR2_ARC_PAGE_SIZE_8K
         default "16K" if BR2_ARC_PAGE_SIZE_16K
 
arch/arch.mk.arc +1 -3
index 32b818b0e0..697c0ff524 100644
@@ -6,9 +6,7 @@ ARCH_TOOLCHAIN_WRAPPER_OPTS = -matomic
 endif
 
 # Explicitly set LD's "max-page-size" instead of relying on some defaults
-ifeq ($(BR2_ARC_PAGE_SIZE_4K),y)
-ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
-else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
+ifeq ($(BR2_ARC_PAGE_SIZE_8K),y)
 ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
 else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y)
 ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384
linux/linux.mk +0 -4
index 322ccabbd9..f012689a9e 100644
@@ -362,10 +362,6 @@ define LINUX_KCONFIG_FIXUP_CMDS
                 $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI))
         $(if $(BR2_powerpc)$(BR2_powerpc64)$(BR2_powerpc64le),
                 $(call KCONFIG_ENABLE_OPT,CONFIG_PPC_DISABLE_WERROR))
-       $(if $(BR2_ARC_PAGE_SIZE_4K),
-               $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
-               $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)
-               $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_16K))
         $(if $(BR2_ARC_PAGE_SIZE_8K),
                 $(call KCONFIG_DISABLE_OPT,CONFIG_ARC_PAGE_SIZE_4K)
                 $(call KCONFIG_ENABLE_OPT,CONFIG_ARC_PAGE_SIZE_8K)

--
2.36.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hello Alexey,

Quoted 10 lines · On Sun, 17 Jul 2022 21:13:08 +0000 Alexey Brodkin…

Please let me take a look at this one.

The point is we do use 4 KiB page for building for the ARCv3 processors,
see https://github.com/foss-for-synopsys-dwc-arc-processors/buildroot/blob/arc64/arch/Config.in.arc#L133.
And so far I haven't seen any problems with either uClibc or glibc.

And since I don't immediately see any changes in Binutils for ARCv3 which touch "common-page-size", I'd like to figure out what goes wrong here.

I'll get back to you soon with some explanation of what we see here.

Thanks for your feedback. Will definitely wait to hear from you before merging this patch.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

Hi Thomas, Claudiu,

Quoted 9 lines
Quoted 6 lines · On Sun, 17 Jul 2022 21:13:08 +0000 Alexey Brodkin…

Please let me take a look at this one.

The point is we do use 4 KiB page for building for the ARCv3 processors,
see https://urldefense.com/v3/__https://github.com/foss-for-synopsys-dwc-arc-processors/buildroot/blob/arc64/arch/Config.in.arc*L133__;Iw!!A4F2R9G_pg!cxR1QodBjZ2_XZsfTSe3ThcFYm_X7BN7ERYq6smx9IqcZZUrUzXD2gEF1R_oFrKNb0SrguAeGg-kt6hFvkHhbcQpTs3QXHvksOs$ . And so far I haven't seen any problems with either uClibc or glibc.

Quoted 7 lines
Quoted 4 lines

And since I don't immediately see any changes in Binutils for ARCv3 which touch "common-page-size", I'd like to figure out what goes wrong here.

I'll get back to you soon with some explanation of what we see here.

Thanks for your feedback. Will definitely wait to hear from you before merging this patch.

So that seems to be a good catch indeed.

1. In older GNU LD such a check doesn't exist and so LD never craps out. And here I mean the latest ARC Binutils ("arc-2020.09-release"), which are based on upstream v2.35. Thus if building with 4KiB pages but ARC Binutils, the problem is not seen. I'm sure even built that way binaries work perfectly fine as I do remember trying it not that long ago myself.

BTW that pre-defined "common-page-size" comes from GCC actually, see
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/arc/linux.h;h=0f1ff055be757ad1483910fc4918e7fef7fe4d5e;hb=1ea978e3066ac565a1ec28a96a4d61eaf38e2726#l48

2. And in case of building for ARCv3 processors we don't mess with "page-size"
stuff in the "LINK_SPEC", see https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/blob/arc64/gcc/config/arc64/linux32.h#L26

That said I'd like to get our GCC & Binutils maintainer input on what needs to be done with these "page-size" options in the "LINK_SPEC".

Maybe with use of up-to-date Binutils those default values are no longer needed? Or we may keep default "max" value and then not explicitly set outside "common" value will be adjusted as needed automatically.

See https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/ldelf.c;h=bfa0d54753ad8a7de02b4bae999119588ef982c6;hb=refs/heads/master#l90

-Alexey
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw

Hello Alexey,

Quoted 10 lines · On Tue, 19 Jul 2022 18:20:25 +0000 Alexey Brodkin via buildroot…

So that seems to be a good catch indeed.

1. In older GNU LD such a check doesn't exist and so LD never craps out. And here I mean the latest ARC Binutils ("arc-2020.09-release"), which are based on upstream v2.35. Thus if building with 4KiB pages but ARC Binutils, the problem is not seen. I'm sure even built that way binaries work perfectly fine as I do remember trying it not that long ago myself.

BTW that pre-defined "common-page-size" comes from GCC actually, see
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/config/arc/linux.h;h=0f1ff055be757ad1483910fc4918e7fef7fe4d5e;hb=1ea978e3066ac565a1ec28a96a4d61eaf38e2726#l48

OK.

Quoted 2 lines

2. And in case of building for ARCv3 processors we don't mess with "page-size"
stuff in the "LINK_SPEC", see https://github.com/foss-for-synopsys-dwc-arc-processors/gcc/blob/arc64/gcc/config/arc64/linux32.h#L26

OK, but I don't really see the relationship.

Quoted 4 lines

That said I'd like to get our GCC & Binutils maintainer input on what needs to be done with these "page-size" options in the "LINK_SPEC".

Maybe with use of up-to-date Binutils those default values are no longer needed?

Why no longer needed? Of course is you change the page size, you need to pass some options to the linker so that it can place sections and define load addresses (and other related stuff) accordingly.

Quoted 2 lines

Or we may keep default "max" value and then not explicitly set outside "common" value will be adjusted as needed automatically.

I don't understand what you mean here. Today, we are setting max-page-size, and that doesn't work because the common-page-size value is higher. As I mentioned in my initial patch, passing -Wl,-z,max-page-size=4096 (already done) and -Wl,-z,common-page-size=4096 would most likely fix the error, but I wasn't sure it was the correct thing to do.

Do you have more feedback from your GCC and binutils maintainer perhaps?

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

A message that is not in the archive (sent off-list or not yet received): IA1PR12MB6210D4881185B436788BF05EA1969@IA1PR12MB6210.namprd12.prod.outlook.com

#6 lore raw

Hello,

Re-adding Buildroot mailing list in Cc.

Quoted 10 lines · On Thu, 28 Jul 2022 20:25:47 +0000 Alexey Brodkin…
Quoted 6 lines

I don't understand what you mean here. Today, we are setting max-page-size, and that doesn't work because the common-page-size value is higher. As I mentioned in my initial patch, passing

(quoted diff) +0 -2
-Wl,-z,max-page-size=4096 (already done) and
-Wl,-z,common-page-size=4096 would most likely fix the error, but I

wasn't sure it was the correct thing to do.

So, right, suggested change of explicit setup of "common-page-size=max-page-size" is a good fix as it is compatible with older Binutils (before the change referred above, i.e. before 2.38).

Could you provide the patch?

Keep in mind that this block of code:

# Explicitly set LD's "max-page-size" instead of relying on some defaults ifeq ($(BR2_ARC_PAGE_SIZE_4K)$(BR2_ARM64_PAGE_SIZE_4K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 else ifeq ($(BR2_ARM64_PAGE_SIZE_64K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=65536 endif

in arch/arch.mk, has been recently modified to be used for configurable page sizes on ARM64. So, if we decide to add -Wl,-z,common-page-size=XYZ, it also needs to work for ARM64 (I think it should, but I just want to warn that this code is no longer ARC-specific).

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Hello Alexey,

Quoted 19 lines · On Wed, 3 Aug 2022 19:22:29 +0200 Thomas Petazzoni…
Quoted 3 lines

So, right, suggested change of explicit setup of "common-page-size=max-page-size" is a good fix as it is compatible with older Binutils (before the change referred above, i.e. before 2.38).

Could you provide the patch?

Keep in mind that this block of code:

# Explicitly set LD's "max-page-size" instead of relying on some defaults ifeq ($(BR2_ARC_PAGE_SIZE_4K)$(BR2_ARM64_PAGE_SIZE_4K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=4096
else ifeq ($(BR2_ARC_PAGE_SIZE_8K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=8192
else ifeq ($(BR2_ARC_PAGE_SIZE_16K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=16384 else ifeq ($(BR2_ARM64_PAGE_SIZE_64K),y) ARCH_TOOLCHAIN_WRAPPER_OPTS += -Wl,-z,max-page-size=65536 endif

Quoted 5 lines

in arch/arch.mk, has been recently modified to be used for configurable page sizes on ARM64. So, if we decide to add -Wl,-z,common-page-size=XYZ, it also needs to work for ARM64 (I think it should, but I just want to warn that this code is no longer ARC-specific).

Do you think you will be able to provide a patch to fix support for 4K page size support on ARC in Buildroot?

It is not really a major feature of Buildroot, and it's causing some build failures in our autobuilders, so if no fix is provided, we'll probably end up dropping support, as proposed by my patch posted on July 17.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot