[PATCH] D77330: Consider increasing the default ARM32 page size to 64k.
Tobias Hieta via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 00:30:09 PDT 2020
thieta added a comment.
Hello Nick,
Maybe I am using the wrong terminology here and in that case I am sorry. What I mean is the default max page size for the arm32 target in lld. Here is the tests I can boil it down to:
Consider hello.c
#include <stdio.h>
int main(int argc, char** argv)
{
printf("Hello World!\n");
return 0;
}
I build this three different ways:
With lld no arguments about max page size:
clang --target=arm-linux-gnueabi -march=armv7-a -mthumb -mfloat-abi=soft -mfpu=vfpv3-d16 --sysroot=$TOOLCHAIN_DIR/arm-linux-gnueabi/libc --gcc-toolchain=$TOOLCHAIN_DIR hello.c -o hello-lld -fuse-ld=lld
With ld.bfd:
clang --target=arm-linux-gnueabi -march=armv7-a -mthumb -mfloat-abi=soft -mfpu=vfpv3-d16 --sysroot=$TOOLCHAIN_DIR/arm-linux-gnueabi/libc --gcc-toolchain=$TOOLCHAIN_DIR hello.c -o hello-bfd -fuse-ld=bfd
And finally with lld and max-page-size argument:
clang --target=arm-linux-gnueabi -march=armv7-a -mthumb -mfloat-abi=soft -mfpu=vfpv3-d16 --sysroot=$TOOLCHAIN_DIR/arm-linux-gnueabi/libc --gcc-toolchain=$TOOLCHAIN_DIR hello.c -o hello -fuse-ld=lld -Wl,-max-page-size=0x10000
I copied them over to the device and ran them:
root at WD-EX2100 root # ./hello-bfd
Hello World!
root at WD-EX2100 root # ./hello-lld
Killed
root at WD-EX2100 root # ./hello-lld-max-page
Hello World!
root at WD-EX2100 root #
As you see it works when we set the max-page-size, we can also verify this quickly with readelf:
➜ readelf -a hello-bfd | grep LOAD
LOAD 0x000000 0x00010000 0x00010000 0x0043c 0x0043c R E 0x10000
LOAD 0x00043c 0x0002043c 0x0002043c 0x0011c 0x00120 RW 0x10000
➜ readelf -a hello-lld | grep LOAD
LOAD 0x000000 0x00010000 0x00010000 0x003e4 0x003e4 R 0x1000
LOAD 0x0003e4 0x000113e4 0x000113e4 0x001cc 0x001cc R E 0x1000
LOAD 0x0005b0 0x000125b0 0x000125b0 0x000d8 0x000d8 RW 0x1000
LOAD 0x000688 0x00013688 0x00013688 0x00024 0x00025 RW 0x1000
➜ readelf -a hello-lld-max-page | grep LOAD
LOAD 0x000000 0x00010000 0x00010000 0x003e4 0x003e4 R 0x10000
LOAD 0x0003e4 0x000203e4 0x000203e4 0x001cc 0x001cc R E 0x10000
LOAD 0x0005b0 0x000305b0 0x000305b0 0x000d8 0x000d8 RW 0x10000
LOAD 0x000688 0x00040688 0x00040688 0x00024 0x00025 RW 0x10000
And just to confirm the device have the following page size configuration:
root at WD-EX2100 root # getconf PAGESIZE
32768
And we can try it on another device with another page size configuration:
root at Netgear-RN102:~# getconf PAGESIZE
4096
root at Netgear-RN102:~# ./hello-lld
Hello World!
root at Netgear-RN102:~# ./hello-bfd
Hello World!
root at Netgear-RN102:~# ./hello-lld-max-page
Hello World!
Hope this was the information you where looking for.
I also uploaded the binaries here: https://artifacts.plex.tv/testing/page_size_tests.tar.gz
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77330/new/
https://reviews.llvm.org/D77330
More information about the llvm-commits
mailing list