#844467 ld.gold on armel uses small page size, decreasing portability

Package:
binutils
Source:
binutils
Description:
GNU assembler, linker and binary utilities
Submitter:
Joey Hess
Date:
2025-08-29 05:33:13 UTC
Severity:
normal
Tags:
#844467#5
Date:
2016-11-16 03:54:53 UTC
From:
To:
Apparently some ARM based NAS devices, such as the WD My Cloud EX2,
have the kernel using a page size of 32k or 64k. Binaries linked with
ld.gold on armel use a page size of 4k. Trying to use those binaries
with such a kernel fails: "ELF load command alignment not page-aligned"

Using the regular ld on armel, a 64k (0x10000) page size is used:

# arm-linux-gnueabi-ld -o hello  hello.o  -lc
# readelf -l hello | grep LOAD
  LOAD           0x000000 0x00010000 0x00010000 0x001d2 0x001d2 R E 0x10000
  LOAD           0x0001d4 0x000201d4 0x000201d4 0x000b0 0x000b0 RW  0x10000

Using ld.gold, a 4k (0x1000) page size is used:

# arm-linux-gnueabi-ld.gold -o hello  hello.o  -lc
# readelf -l hello | grep LOAD
  LOAD           0x000000 0x00008000 0x00008000 0x001d2 0x001d2 R E 0x1000
  LOAD           0x0001d2 0x000091d2 0x000091d2 0x000b2 0x000b2 RW  0x1000

ghc uses ld.gold to link haskell programs. Probably some other stuff
links with ld.gold as well. This makes debian binaries, chroots, etc not
as portable for use with such kernels as it could be.

Workaround: Pass -z common-page-size=65536 -z max-page-size=65536 to
ld.gold.

#844467#10
Date:
2016-11-16 22:00:31 UTC
From:
To:
Linking with -z common-page-size=65536 -z max-page-size=65536 fails:

ld.gold.orig: internal error in do_write, at ../../gold/output.cc:464

It works using a 32kb page size.

#844467#19
Date:
2016-11-23 11:12:24 UTC
From:
To:
please report a separate upstream issue about the default size change, as
requested by upstream.

#844467#22
Date:
2016-11-23 11:12:24 UTC
From:
To:
please report a separate upstream issue about the default size change, as
requested by upstream.