public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix ld bloat introduced between binutils-2.38 and 2.39
@ 2023-01-02 16:08 Hans-Peter Nilsson
  2023-01-03  1:35 ` Alan Modra
  0 siblings, 1 reply; 10+ messages in thread
From: Hans-Peter Nilsson @ 2023-01-02 16:08 UTC (permalink / raw)
  To: binutils

(Subject is for email list use, see below for a better
commit title.)

Ok to commit?  If so, binutils-2.39 and 2.40 branches too?
If not, suggestion of other approaches, no later than
configure-time?

--- 8< ---
Subject: Let --with-elf-maxpagesize=N override target ELF_MAXPAGESIZE

Since commit 9833b7757d24, "PR28824, relro security issues",
ELF_MAXPAGESIZE matters much more, with regards to layout of
the linked file.  That commit fixed an actual bug, but also
exposes a problem for targets were that value is too high.

For example, for ARM(32, a.k.a. "Aarch32") specifically
bfd_arch_arm, it's set to 64 KiB, making all Linux(/GNU)
targets pay an extra amount of up to 60 KiB of bloat in
DSO:s and executables.  This matters when there are many
such files, and where storage is expensive.

It's *mostly* bloat when using a Linux kernel, as ARM(32) is
a good example of an target where ELF_MAXPAGESIZE is set to
an extreme value for an obscure corner-case.  The ARM
(32-bit) kernel has 4 KiB pages, has had that value forever,
and can't be configured to any other value.  The use-case is
IIUC "Aarch32" emulation on an "Aarch64" (arm64) kernel, but
not just that, but a setup where the Linux page-size is
configured to something other than the *default* 4 KiB.  Not
sure there actually any such systems in use, again with
both Aarch32 compatibility support and a non-4KiB pagesize,
with all the warnings in the kernel config and requiring the
"EXPERT" level set on.

That may sound like an argument for setting the bfd_arch_arm
ELF_MAXPAGESIZE to 4 KiB, but then the obscure corner-case
wouldn't be properly handled.  I wouldn't oppose that, but I
prefer not to regress the linker by default in my own patch.
I know about the linker option "-z max-page-size=0x1000",
but that requires finding every linker invocation or
patching gcc -and still finding all stray naked ld calls.

There was for a short while config.relro_use_commonpagesize
in the linker (commit 31b4d3a16f20) but besides the
self-explanatory ld_config_type member, IMHO it's too
obscure to re-introduce.

Instead, I suggest simply making ELF_MAXPAGESIZE generally
overridable by means of a --with option at linker
configuration time.  In the patch I make the option
ELF-specific mostly for simplicity (more object-formats
means more places to find and patch, also the original
problem is ELF-specific).

bfd:
	Let --with-elf-maxpagesize=N override target ELF_MAXPAGESIZE.
	* configure.ac: Define FORCED_ELF_MAXPAGESIZE if
	--with-elf-maxpagesize=N is passed.
	* elfxx-target.h: Let FORCED_ELF_MAXPAGESIZE] override ELF_MAXPAGESIZE.
	* configure, config.in: Regenerate.
---
 bfd/config.in      |  3 +++
 bfd/configure      | 22 ++++++++++++++++++++--
 bfd/configure.ac   | 10 ++++++++++
 bfd/elfxx-target.h |  5 +++++
 4 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/bfd/configure.ac b/bfd/configure.ac
index 82a3d1f832e7..88eaa52b5a82 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -115,6 +115,16 @@ AC_ARG_WITH(mmap,
   *)    AC_MSG_ERROR(bad value ${withval} for BFD with-mmap option) ;;
 esac],[want_mmap=false])dnl
 
+ac_default_elf_maxpagesize=unset
+AC_ARG_WITH(elf_maxpagesize,
+  AS_HELP_STRING([--with-elf-maxpagesize=N],
+    [Set ELF_MAXPAGESIZE to N instead of using the target value]),
+[ac_default_elf_maxpagesize=$withval]) dnl
+if test ${ac_default_elf_maxpagesize} != unset; then
+  AC_DEFINE_UNQUOTED(FORCED_ELF_MAXPAGESIZE, ${ac_default_elf_maxpagesize},
+    [Define to a value with which to override the target ELF_MAXPAGESIZE.])
+fi
+
 AC_ARG_ENABLE(secureplt,
 [  --enable-secureplt      Default to creating read-only plt entries],
 [case "${enableval}" in
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 9bcbdfb27dd8..2a32b8a8cb0d 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -374,6 +374,11 @@
 #define ELF_OSABI ELFOSABI_NONE
 #endif
 
+#ifdef FORCED_ELF_MAXPAGESIZE
+#undef ELF_MAXPAGESIZE
+#define ELF_MAXPAGESIZE FORCED_ELF_MAXPAGESIZE
+#endif
+
 #ifndef ELF_MAXPAGESIZE
 # error ELF_MAXPAGESIZE is not defined
 #define ELF_MAXPAGESIZE 1
-- 
2.30.2


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

* Re: [PATCH] Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-02 16:08 [PATCH] Fix ld bloat introduced between binutils-2.38 and 2.39 Hans-Peter Nilsson
@ 2023-01-03  1:35 ` Alan Modra
  2023-01-03  2:41   ` ARM: " Hans-Peter Nilsson
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Modra @ 2023-01-03  1:35 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

On Mon, Jan 02, 2023 at 05:08:57PM +0100, Hans-Peter Nilsson via Binutils wrote:
> That may sound like an argument for setting the bfd_arch_arm
> ELF_MAXPAGESIZE to 4 KiB, but then the obscure corner-case
> wouldn't be properly handled.

Agreed.  It's what x86 did when facing the same thing.  If anybody
cares about the obscure corner-case you identify then they can just
use -z max-page-size.  Or edit elf32-arm.c.

> Instead, I suggest simply making ELF_MAXPAGESIZE generally
> overridable by means of a --with option at linker
> configuration time.

I dislike configure time options that affect linker behaviour, but I
realise I'm flogging a dead horse since we already have a lot of them.
However, this particular option is worse than most since it affects
all ELF targets.  That can't be correct or useful with
--enable-targets=all.

-- 
Alan Modra
Australia Development Lab, IBM

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

* ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-03  1:35 ` Alan Modra
@ 2023-01-03  2:41   ` Hans-Peter Nilsson
  2023-01-03  8:12     ` Alan Modra
  0 siblings, 1 reply; 10+ messages in thread
From: Hans-Peter Nilsson @ 2023-01-03  2:41 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

> From: Alan Modra <amodra@gmail.com>
> CC: "binutils@sourceware.org" <binutils@sourceware.org>

> On Mon, Jan 02, 2023 at 05:08:57PM +0100, Hans-Peter Nilsson via Binutils wrote:
> > That may sound like an argument for setting the bfd_arch_arm
> > ELF_MAXPAGESIZE to 4 KiB, but then the obscure corner-case
> > wouldn't be properly handled.
> 
> Agreed.  It's what x86 did when facing the same thing.  If anybody
> cares about the obscure corner-case you identify then they can just
> use -z max-page-size.  Or edit elf32-arm.c.

I see where this is going, but...

> > Instead, I suggest simply making ELF_MAXPAGESIZE generally
> > overridable by means of a --with option at linker
> > configuration time.
> 
> I dislike configure time options that affect linker behaviour, but I
> realise I'm flogging a dead horse since we already have a lot of them.
> However, this particular option is worse than most since it affects
> all ELF targets.  That can't be correct or useful with
> --enable-targets=all.

I have to say that people using --enable-targets=all to
build their linkers definitely shouldn't be using this
option, as their definition of "all" then doesn't include
obscure corner cases!  And how do the
"--enable-targets=all"-people link?  IIUC they have to
specify an emulation when using such a linker, so they can't
be using a general invocation.  To wit, I don't think the
"--enable-targets=all"-breakage is a valid counter-argument.

Anyway, here's the obvious alternative.  It needs to have
the ARM testsuite adjusted (not included, will fix and send
for separate consideration on approval).

Ok for master, 2.40 and 2.39?

--- 8< ---
Subject: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39

Since commit 9833b7757d24, "PR28824, relro security issues",
ELF_MAXPAGESIZE matters much more, with regards to layout of
the linked file.  That commit fixed an actual bug, but also
exposes a problem for targets were that value is too high.

For example, for ARM(32, a.k.a. "Aarch32") specifically
bfd_arch_arm, it's set to 64 KiB, making all Linux(/GNU)
targets pay an extra amount of up to 60 KiB of bloat in
DSO:s and executables.  This matters when there are many
such files, and where storage is expensive.

It's *mostly* bloat when using a Linux kernel, as ARM(32) is
a good example of an target where ELF_MAXPAGESIZE is set to
an extreme value for an obscure corner-case.  The ARM
(32-bit) kernel has 4 KiB pages, has had that value forever,
and can't be configured to any other value.  The use-case is
IIUC "Aarch32" emulation on an "Aarch64" (arm64) kernel, but
not just that, but a setup where the Linux page-size is
configured to something other than the *default* 4 KiB.  Not
sure there actually any such systems in use, again with
both Aarch32 compatibility support and a non-4KiB pagesize,
with all the warnings in the kernel config and requiring the
"EXPERT" level set on.

So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only
one default max-page-size" and set ELF_MAXPAGESIZE to 4096.

bfd:
	* elf32-arm.c (ELF_COMMONPAGESIZE): Always set to 0x1000.
---
 bfd/elf32-arm.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 0cd3aec14368..b83c43c741c9 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -20261,11 +20261,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
 #define ELF_ARCH			bfd_arch_arm
 #define ELF_TARGET_ID			ARM_ELF_DATA
 #define ELF_MACHINE_CODE		EM_ARM
-#ifdef __QNXTARGET__
 #define ELF_MAXPAGESIZE			0x1000
-#else
-#define ELF_MAXPAGESIZE			0x10000
-#endif
 #define ELF_COMMONPAGESIZE		0x1000
 
 #define bfd_elf32_mkobject			elf32_arm_mkobject
-- 
2.30.2



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

* Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-03  2:41   ` ARM: " Hans-Peter Nilsson
@ 2023-01-03  8:12     ` Alan Modra
  2023-01-03 15:16       ` Hans-Peter Nilsson
  0 siblings, 1 reply; 10+ messages in thread
From: Alan Modra @ 2023-01-03  8:12 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

On Tue, Jan 03, 2023 at 03:41:19AM +0100, Hans-Peter Nilsson wrote:
> So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only
> one default max-page-size" and set ELF_MAXPAGESIZE to 4096.

No objections here, but should be acked by one of the ARM maintainers.
> 
> bfd:
> 	* elf32-arm.c (ELF_COMMONPAGESIZE): Always set to 0x1000.
> ---
>  bfd/elf32-arm.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
> index 0cd3aec14368..b83c43c741c9 100644
> --- a/bfd/elf32-arm.c
> +++ b/bfd/elf32-arm.c
> @@ -20261,11 +20261,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
>  #define ELF_ARCH			bfd_arch_arm
>  #define ELF_TARGET_ID			ARM_ELF_DATA
>  #define ELF_MACHINE_CODE		EM_ARM
> -#ifdef __QNXTARGET__
>  #define ELF_MAXPAGESIZE			0x1000
> -#else
> -#define ELF_MAXPAGESIZE			0x10000
> -#endif
>  #define ELF_COMMONPAGESIZE		0x1000
>  
>  #define bfd_elf32_mkobject			elf32_arm_mkobject
> -- 
> 2.30.2
> 

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-03  8:12     ` Alan Modra
@ 2023-01-03 15:16       ` Hans-Peter Nilsson
  2023-01-11 16:24         ` Hans-Peter Nilsson
  2023-01-11 16:28         ` Hans-Peter Nilsson
  0 siblings, 2 replies; 10+ messages in thread
From: Hans-Peter Nilsson @ 2023-01-03 15:16 UTC (permalink / raw)
  To: binutils; +Cc: nickc, rearnsha, ramana.radhakrishnan

> From: Alan Modra <amodra@gmail.com>
> Date: Tue, 3 Jan 2023 09:12:17 +0100

> On Tue, Jan 03, 2023 at 03:41:19AM +0100, Hans-Peter Nilsson wrote:
> > So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only
> > one default max-page-size" and set ELF_MAXPAGESIZE to 4096.
> 
> No objections here, but should be acked by one of the ARM maintainers.

(taking the opportunity to CC: ARM-maintainers)

> > 
> > bfd:
> > 	* elf32-arm.c (ELF_COMMONPAGESIZE): Always set to 0x1000.

JFTR:
Doh: s/ELF_COMMONPAGESIZE/ELF_MAXPAGESIZE/ of course.

brgds, H-P
PS. https://sourceware.org/pipermail/binutils/2023-January/125399.html

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

* Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-03 15:16       ` Hans-Peter Nilsson
@ 2023-01-11 16:24         ` Hans-Peter Nilsson
  2023-01-12 13:48           ` Nick Clifton
  2023-01-11 16:28         ` Hans-Peter Nilsson
  1 sibling, 1 reply; 10+ messages in thread
From: Hans-Peter Nilsson @ 2023-01-11 16:24 UTC (permalink / raw)
  To: binutils, nickc, rearnsha, ramana.radhakrishnan

> From: Hans-Peter Nilsson <Hans-Peter.Nilsson@axis.com>
> Date: Tue, 3 Jan 2023 16:16:29 +0100

PING.  Ok for master, 2.40 and 2.39?

Refreshed patch, i.e. without errata (to be followed by a
testsuite fix, to be committed before this one for bisection
cleanliness):

---- 8< ----

Since commit 9833b7757d24, "PR28824, relro security issues",
ELF_MAXPAGESIZE matters much more, with regards to layout of
the linked file.  That commit fixed an actual bug, but also
exposes a problem for targets were that value is too high.

For example, for ARM(32, a.k.a. "Aarch32") specifically
bfd_arch_arm, it's set to 64 KiB, making all Linux(/GNU)
targets pay an extra amount of up to 60 KiB of bloat in
DSO:s and executables.  This matters when there are many
such files, and where storage is expensive.

It's *mostly* bloat when using a Linux kernel, as ARM(32) is
a good example of an target where ELF_MAXPAGESIZE is set to
an extreme value for an obscure corner-case.  The ARM
(32-bit) kernel has 4 KiB pages, has had that value forever,
and can't be configured to any other value.  The use-case is
IIUC "Aarch32" emulation on an "Aarch64" (arm64) kernel, but
not just that, but a setup where the Linux page-size is
configured to something other than the *default* 4 KiB.  Not
sure there actually any such systems in use, again with
both Aarch32 compatibility support and a non-4KiB pagesize,
with all the warnings in the kernel config and requiring the
"EXPERT" level set on.

So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only
one default max-page-size" and set ELF_MAXPAGESIZE to 4096.

bfd:
	* elf32-arm.c (ELF_MAXPAGESIZE): Always set to 0x1000.
---
 bfd/elf32-arm.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 96ba509f505d..a6d83b97c97d 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -20290,11 +20290,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym)
 #define ELF_ARCH			bfd_arch_arm
 #define ELF_TARGET_ID			ARM_ELF_DATA
 #define ELF_MACHINE_CODE		EM_ARM
-#ifdef __QNXTARGET__
 #define ELF_MAXPAGESIZE			0x1000
-#else
-#define ELF_MAXPAGESIZE			0x10000
-#endif
 #define ELF_COMMONPAGESIZE		0x1000
 
 #define bfd_elf32_mkobject			elf32_arm_mkobject
-- 
2.30.2


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

* Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-03 15:16       ` Hans-Peter Nilsson
  2023-01-11 16:24         ` Hans-Peter Nilsson
@ 2023-01-11 16:28         ` Hans-Peter Nilsson
  2023-01-11 16:39           ` Hans-Peter Nilsson
  2023-01-12 13:49           ` Nick Clifton
  1 sibling, 2 replies; 10+ messages in thread
From: Hans-Peter Nilsson @ 2023-01-11 16:28 UTC (permalink / raw)
  To: binutils, nickc, rearnsha, ramana.radhakrishnan

To be committed before the ELF_MAXPAGESIZE 0x1000 fix,
wherever (and if ever) that one's approved.

Ok as above?

---- 8< ----

Subject: ld/testsuite: Adjust for ELF_MAXPAGESIZE 0x1000

Many tests reflect a setting of ELF_MAXPAGESIZE to 64 KiB.
With ELF_MAXPAGESIZE changed to 4 KiB, layout is sometimes
different and symbols end up in other places.  Avoid churn
and regexpification of old test patterns by passing the
max-page-size setting active at the time.

ld/testsuite:

	* testsuite/ld-arm/arm-elf.exp,
        testsuite/ld-arm/non-contiguous-arm2.d,
        testsuite/ld-arm/non-contiguous-arm3.d,
        testsuite/ld-arm/non-contiguous-arm5.d,
        testsuite/ld-arm/non-contiguous-arm6.d,
        testsuite/ld-arm/thumb-plt-got.d, testsuite/ld-arm/thumb-plt.d:
	Pass -z max-page-size=0x10000 explicitly to test that rely on
	that value in output-matching patterns.
---
 ld/testsuite/ld-arm/arm-elf.exp           | 49 ++++++++++++-----------
 ld/testsuite/ld-arm/non-contiguous-arm2.d |  2 +-
 ld/testsuite/ld-arm/non-contiguous-arm3.d |  2 +-
 ld/testsuite/ld-arm/non-contiguous-arm5.d |  2 +-
 ld/testsuite/ld-arm/non-contiguous-arm6.d |  2 +-
 ld/testsuite/ld-arm/thumb-plt-got.d       |  2 +-
 ld/testsuite/ld-arm/thumb-plt.d           |  2 +-
 7 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 747155fc8168..9c8056478cec 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -640,7 +640,9 @@ set armeabitests_nonacl {
     {"Multiple farcalls" "-Ttext 0x1000 --section-start .foo=0x2002020" "" "" {farcall-mix.s}
      {{objdump -d farcall-mix.d}}
      "farcall-mix"}
-    {"Multiple farcalls from several sections" "-Ttext 0x1000 --section-start .mytext=0x2000 --section-start .foo=0x2003020" "" "" {farcall-mix2.s}
+    {"Multiple farcalls from several sections"
+     "-Ttext 0x1000 --section-start .mytext=0x2000 --section-start .foo=0x2003020 -z max-page-size=0x10000"
+     "" "" {farcall-mix2.s}
      {{objdump -d farcall-mix2.d}}
      "farcall-mix2"}
 
@@ -738,7 +740,7 @@ set armeabitests_nonacl {
      {{ld cmse-veneers-wrong-entryfct.out}}
      "cmse-veneers-wrong-entryfct"}
     {"Secure gateway veneers (ARMv8-M Baseline)"
-     "-Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --gc-sections" ""
+     "-Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --gc-sections -z max-page-size=0x10000" ""
      "-march=armv8-m.base -mthumb"
      {cmse-veneers.s}
      {{objdump {-d -j .gnu.sgstubs} cmse-veneers.d}
@@ -746,7 +748,7 @@ set armeabitests_nonacl {
       {nm {} cmse-veneers.rd}}
      "cmse-veneers-baseline"}
     {"Secure gateway veneers (ARMv8-M Mainline)"
-     "-Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --gc-sections" ""
+     "-Ttext=0x8000 --section-start .gnu.sgstubs=0x20000 --gc-sections -z max-page-size=0x10000" ""
      "-march=armv8-m.main -mthumb"
      {cmse-veneers.s}
      {{objdump {-d -j .gnu.sgstubs} cmse-veneers.d}
@@ -909,32 +911,32 @@ set armeabitests_nonacl {
      "-EL -Ttext=0x8f00 --fix-cortex-a8" "" "-EL" {cortex-a8-fix-blx-bcond.s}
      {{objdump -dr cortex-a8-fix-blx-bcond.d}}
      "cortex-a8-fix-blx-bcond"}
-    {"IFUNC test 1" "-T ifunc-static.ld" "" "" {ifunc-1.s}
+    {"IFUNC test 1" "-T ifunc-static.ld -z max-page-size=0x10000" "" "" {ifunc-1.s}
      {{objdump -d ifunc-1.dd}
       {objdump {-s -j.data -j.got} ifunc-1.gd}
       {readelf -dr ifunc-1.rd}}
      "ifunc-1"}
-    {"IFUNC test 2" "-T ifunc-static.ld" "" "" {ifunc-2.s}
+    {"IFUNC test 2" "-T ifunc-static.ld -z max-page-size=0x10000" "" "" {ifunc-2.s}
      {{objdump -d ifunc-2.dd}
       {objdump {-s -j.data -j.got} ifunc-2.gd}
       {readelf -dr ifunc-2.rd}}
      "ifunc-2"}
-    {"IFUNC test 5" "-T ifunc-static.ld" "" "" {ifunc-5.s}
+    {"IFUNC test 5" "-T ifunc-static.ld -z max-page-size=0x10000" "" "" {ifunc-5.s}
      {{objdump -d ifunc-5.dd}
       {objdump {-s -j.data -j.got} ifunc-5.gd}
       {readelf -dr ifunc-5.rd}}
      "ifunc-5"}
-    {"IFUNC test 6" "-T ifunc-static.ld" "" "" {ifunc-6.s}
+    {"IFUNC test 6" "-T ifunc-static.ld -z max-page-size=0x10000" "" "" {ifunc-6.s}
      {{objdump -d ifunc-6.dd}
       {objdump {-s -j.data -j.got} ifunc-6.gd}
       {readelf -dr ifunc-6.rd}}
      "ifunc-6"}
-    {"IFUNC test 11" "-T ifunc-static.ld" "" "" {ifunc-11.s}
+    {"IFUNC test 11" "-T ifunc-static.ld -z max-page-size=0x10000" "" "" {ifunc-11.s}
      {{objdump -d ifunc-11.dd}
       {objdump {-s -j.data -j.got} ifunc-11.gd}
       {readelf -dr ifunc-11.rd}}
      "ifunc-11"}
-    {"IFUNC test 17" "-T ifunc-static.ld" "" "" {ifunc-17.s}
+    {"IFUNC test 17" "-T ifunc-static.ld -z max-page-size=0x10000" "" "" {ifunc-17.s}
      {{objdump -d ifunc-17.dd}
       {objdump {-s -j.data -j.got} ifunc-17.gd}
       {readelf -r ifunc-17.rd}}
@@ -1007,7 +1009,7 @@ set armeabitests_nonacl_shared {
      "farcall-mixed-lib.so"}
 
     {"Cortex-A8 erratum fix, b.w to PLT"
-     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared" "" "-EL"
+     "-EL -Tcortex-a8-fix-plt.ld --fix-cortex-a8 -shared -z max-page-size=0x10000" "" "-EL"
      {cortex-a8-fix-b-plt.s}
      {{objdump -dr cortex-a8-fix-b-plt.d}}
      "cortex-a8-fix-b-plt"}
@@ -1027,65 +1029,66 @@ set armeabitests_nonacl_shared {
      {{objdump -dr cortex-a8-fix-blx-plt.d}}
      "cortex-a8-fix-blx-plt"}
     {"Cortex-A8 erratum fix, relocate bl.w to PLT"
-     "-EL --section-start=.plt=0x8e00 -Ttext=0x8f00 --fix-cortex-a8 -shared --hash-style=sysv" ""
+     "-EL --section-start=.plt=0x8e00 -Ttext=0x8f00 --fix-cortex-a8 -shared --hash-style=sysv -z max-page-size=0x10000"
+     ""
      "-EL" {cortex-a8-thumb-target.s cortex-a8-fix-bl-rel.s}
      {{objdump -dr cortex-a8-fix-bl-rel-plt.d}}
      "cortex-a8-fix-bl-rel-thumb"}
 
-    {"IFUNC test 3" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-3.s}
+    {"IFUNC test 3" "-T ifunc-dynamic.ld -shared -z max-page-size=0x10000" "" "" {ifunc-3.s}
 	{{objdump -d ifunc-3.dd}
 	    {objdump {-s -j.data -j.got} ifunc-3.gd}
 	    {readelf -r ifunc-3.rd}}
 	"ifunc-3.so"}
-    {"IFUNC test 4" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-4.s}
+    {"IFUNC test 4" "-T ifunc-dynamic.ld -shared -z max-page-size=0x10000" "" "" {ifunc-4.s}
 	{{objdump -d ifunc-4.dd}
 	    {objdump {-s -j.data -j.got} ifunc-4.gd}
 	    {readelf -r ifunc-4.rd}}
 	"ifunc-4.so"}
-    {"IFUNC test 7" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so -shared" ""
+    {"IFUNC test 7" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so -shared -z max-page-size=0x10000" ""
 	"" {ifunc-7.s}
 	{{objdump -d ifunc-7.dd}
 	    {objdump {-s -j.data -j.got} ifunc-7.gd}
 	    {readelf -r ifunc-7.rd}}
 	"ifunc-7.so"}
-    {"IFUNC test 12" "-T ifunc-dynamic.ld -shared" "" "" {ifunc-12.s}
+    {"IFUNC test 12" "-T ifunc-dynamic.ld -shared -z max-page-size=0x10000" "" "" {ifunc-12.s}
 	{{objdump -d ifunc-12.dd}
 	    {objdump {-s -j.data -j.got} ifunc-12.gd}
 	    {readelf -r ifunc-12.rd}}
 	"ifunc-12.so"}
-    {"IFUNC test 9" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so" "" "" {ifunc-9.s}
+    {"IFUNC test 9" "-T ifunc-dynamic.ld tmpdir/ifunc-3.so -z max-page-size=0x10000" "" "" {ifunc-9.s}
 	{{objdump -d ifunc-9.dd}
 	    {objdump {-s -j.data -j.got} ifunc-9.gd}
 	    {readelf -r ifunc-9.rd}}
 	"ifunc-9"}
-    {"IFUNC test 10" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so" "" "" {ifunc-10.s}
+    {"IFUNC test 10" "-T ifunc-dynamic.ld tmpdir/ifunc-4.so -z max-page-size=0x10000" "" "" {ifunc-10.s}
 	{{objdump -d ifunc-10.dd}
 	    {objdump {-s -j.data -j.got} ifunc-10.gd}
 	    {readelf -r ifunc-10.rd}}
 	"ifunc-10"}
-    {"IFUNC test 13" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-13.s}
+    {"IFUNC test 13" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so -z max-page-size=0x10000" "" "" {ifunc-13.s}
 	{{objdump -d ifunc-13.dd}
 	    {objdump {-s -j.data -j.got} ifunc-13.gd}
 	    {readelf -r ifunc-13.rd}}
 	"ifunc-13"}
-    {"IFUNC test 14" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-14.s}
+    {"IFUNC test 14" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so -z max-page-size=0x10000" "" "" {ifunc-14.s}
 	{{objdump -d ifunc-14.dd}
 	    {objdump {-s -j.data -j.got} ifunc-14.gd}
 	    {readelf -r ifunc-14.rd}}
 	"ifunc-14"}
-    {"IFUNC test 15" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-15.s}
+    {"IFUNC test 15" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so -z max-page-size=0x10000" "" "" {ifunc-15.s}
 	{{objdump -d ifunc-15.dd}
 	    {objdump {-s -j.data -j.got} ifunc-15.gd}
 	    {readelf -r ifunc-15.rd}}
 	"ifunc-15"}
-    {"IFUNC test 16" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so" "" "" {ifunc-16.s}
+    {"IFUNC test 16" "-T ifunc-dynamic.ld tmpdir/ifunc-12.so -z max-page-size=0x10000" "" "" {ifunc-16.s}
 	{{objdump -d ifunc-16.dd}
 	    {objdump {-s -j.data -j.got} ifunc-16.gd}
 	    {readelf -r ifunc-16.rd}}
 	"ifunc-16"}
 
-    {"Long PLT entries in executables" "--long-plt -shared --section-start=.plt=0x1000 --section-start=.got=0xf0001100" ""
-	"" {long-plt-format.s}
+    {"Long PLT entries in executables"
+     "--long-plt -shared --section-start=.plt=0x1000 --section-start=.got=0xf0001100" "" "" {long-plt-format.s}
 	{{objdump "-d -j .plt" long-plt-format.d}}
 	"long-plt-format"}
 
diff --git a/ld/testsuite/ld-arm/non-contiguous-arm2.d b/ld/testsuite/ld-arm/non-contiguous-arm2.d
index 811230c212b8..ed738bcd09c9 100644
--- a/ld/testsuite/ld-arm/non-contiguous-arm2.d
+++ b/ld/testsuite/ld-arm/non-contiguous-arm2.d
@@ -1,6 +1,6 @@
 #name: non-contiguous-arm2
 #source: non-contiguous-arm.s
-#ld: --enable-non-contiguous-regions -T non-contiguous-arm2.ld
+#ld: --enable-non-contiguous-regions -T non-contiguous-arm2.ld -z max-page-size=0x10000
 #objdump: -rdth
 #xfail: [is_generic]
 
diff --git a/ld/testsuite/ld-arm/non-contiguous-arm3.d b/ld/testsuite/ld-arm/non-contiguous-arm3.d
index 9d5bc5649625..2912f35d0f7b 100644
--- a/ld/testsuite/ld-arm/non-contiguous-arm3.d
+++ b/ld/testsuite/ld-arm/non-contiguous-arm3.d
@@ -1,6 +1,6 @@
 #name: non-contiguous-arm3
 #source: non-contiguous-arm.s
-#ld: --enable-non-contiguous-regions -T non-contiguous-arm3.ld
+#ld: --enable-non-contiguous-regions -T non-contiguous-arm3.ld -z max-page-size=0x10000
 #objdump: -rdth
 #xfail: [is_generic]
 #skip: arm*nacl
diff --git a/ld/testsuite/ld-arm/non-contiguous-arm5.d b/ld/testsuite/ld-arm/non-contiguous-arm5.d
index 730df2fc5475..f41f50afd0b6 100644
--- a/ld/testsuite/ld-arm/non-contiguous-arm5.d
+++ b/ld/testsuite/ld-arm/non-contiguous-arm5.d
@@ -1,6 +1,6 @@
 #name: non-contiguous-arm5
 #source: non-contiguous-arm.s
-#ld: --enable-non-contiguous-regions -T non-contiguous-arm5.ld
+#ld: --enable-non-contiguous-regions -T non-contiguous-arm5.ld -z max-page-size=0x10000
 #objdump: -rdth
 #xfail: [is_generic]
 
diff --git a/ld/testsuite/ld-arm/non-contiguous-arm6.d b/ld/testsuite/ld-arm/non-contiguous-arm6.d
index 9a9869caf3f5..3d737f0905e9 100644
--- a/ld/testsuite/ld-arm/non-contiguous-arm6.d
+++ b/ld/testsuite/ld-arm/non-contiguous-arm6.d
@@ -1,6 +1,6 @@
 #name: non-contiguous-arm6
 #source: non-contiguous-arm.s
-#ld: --enable-non-contiguous-regions -T non-contiguous-arm6.ld
+#ld: --enable-non-contiguous-regions -T non-contiguous-arm6.ld -z max-page-size=0x10000
 #objdump: -rdth
 #xfail: [is_generic]
 #skip: arm*nacl
diff --git a/ld/testsuite/ld-arm/thumb-plt-got.d b/ld/testsuite/ld-arm/thumb-plt-got.d
index 370a4e2c6033..5cebae23d453 100644
--- a/ld/testsuite/ld-arm/thumb-plt-got.d
+++ b/ld/testsuite/ld-arm/thumb-plt-got.d
@@ -1,6 +1,6 @@
 #source: thumb-plt.s
 #name: Thumb only PLT and GOT LSB Symbol
-#ld: -shared -e0
+#ld: -shared -e0 -z max-page-size=0x10000
 #readelf: -rx .got
 #skip: *-*-pe *-*-wince *-*-vxworks armeb-*-* *-*-gnueabihf
 
diff --git a/ld/testsuite/ld-arm/thumb-plt.d b/ld/testsuite/ld-arm/thumb-plt.d
index 606b67e26e08..596c8a949dfe 100644
--- a/ld/testsuite/ld-arm/thumb-plt.d
+++ b/ld/testsuite/ld-arm/thumb-plt.d
@@ -1,6 +1,6 @@
 #source: thumb-plt.s
 #name: Thumb only PLT and GOT
-#ld: -shared -e0
+#ld: -shared -e0 -z max-page-size=0x10000
 #objdump: -dr
 #skip: *-*-pe *-*-wince *-*-vxworks armeb-*-* *-*-gnueabihf
 
-- 
2.30.2


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

* Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-11 16:28         ` Hans-Peter Nilsson
@ 2023-01-11 16:39           ` Hans-Peter Nilsson
  2023-01-12 13:49           ` Nick Clifton
  1 sibling, 0 replies; 10+ messages in thread
From: Hans-Peter Nilsson @ 2023-01-11 16:39 UTC (permalink / raw)
  To: binutils

I forgot to mention: with testsuite adjustment, clean test
results for cross to arm-unknown-linux-gnueabi,
arm-unknown-eabi and aarch64-linux-gnu (since the latter
includes the armelf_linux_eabi emulation).

brgds, H-P

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

* Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-11 16:24         ` Hans-Peter Nilsson
@ 2023-01-12 13:48           ` Nick Clifton
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Clifton @ 2023-01-12 13:48 UTC (permalink / raw)
  To: Hans-Peter Nilsson, binutils, rearnsha, ramana.radhakrishnan

Hi Hans-Peter,

> PING.  Ok for master, 2.40 and 2.39?

OK for all three.

Cheers
   Nick


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

* Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39
  2023-01-11 16:28         ` Hans-Peter Nilsson
  2023-01-11 16:39           ` Hans-Peter Nilsson
@ 2023-01-12 13:49           ` Nick Clifton
  1 sibling, 0 replies; 10+ messages in thread
From: Nick Clifton @ 2023-01-12 13:49 UTC (permalink / raw)
  To: Hans-Peter Nilsson, binutils, rearnsha, ramana.radhakrishnan

Hi Hans-Peter,

> To be committed before the ELF_MAXPAGESIZE 0x1000 fix,
> wherever (and if ever) that one's approved.
> 
> Ok as above?

Also approved (branches and mainline).  Please apply.

Cheers
   Nick



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

end of thread, other threads:[~2023-01-12 13:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 16:08 [PATCH] Fix ld bloat introduced between binutils-2.38 and 2.39 Hans-Peter Nilsson
2023-01-03  1:35 ` Alan Modra
2023-01-03  2:41   ` ARM: " Hans-Peter Nilsson
2023-01-03  8:12     ` Alan Modra
2023-01-03 15:16       ` Hans-Peter Nilsson
2023-01-11 16:24         ` Hans-Peter Nilsson
2023-01-12 13:48           ` Nick Clifton
2023-01-11 16:28         ` Hans-Peter Nilsson
2023-01-11 16:39           ` Hans-Peter Nilsson
2023-01-12 13:49           ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).