[PATCH] D50297: Align AArch64 and i386 image base to superpage

Ryan Prichard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 00:48:53 PDT 2018


rprichard added a comment.

In https://reviews.llvm.org/D50297#1237078, @srhines wrote:

> +Ryan in case there is anything here that could affect Bionic loading from these pages.


AFAIK, this patch isn't a problem for Android. It looks like it could only affect NDK-built non-PIE executables running on 32-bit x86 Jelly Bean or KitKat.

It looks like the ImageBase only matters for non-PIE executables, and the Bionic loader rejects those on android-21 (L) and up for security reasons. The oldest Android OS that the current NDK supports is android-16, which allows PIE executables but can also still run non-PIE executables. L is the first 64-bit release, so this patch can't affect arm64 Android. The NDK Clang driver turns PIE on by default for android-16 and up, but someone could turn it off or use a build system that doesn't set the android-16 API level.

bfd and gold use a default image base of 0x08048000 on x86 (a bit over 128MB), but AFAICT none of the rationales I found for that make sense today. I experimented with various bases from 0 up to 3GB on android-16 and android-19 emulators, and everything seems to work.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D50297





More information about the llvm-commits mailing list