Work around glibc's VDSO parser limitations am: 1a209057bf

Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/native_bridge_support/+/3453432

Change-Id: I71d8ae3b65368ddbc9d40cb81cbe247ce05f9cc5
Signed-off-by: Automerger Merge Worker <[email protected]>
diff --git a/android_api/vdso/Android.bp b/android_api/vdso/Android.bp
index 94e91f7..a6befce 100644
--- a/android_api/vdso/Android.bp
+++ b/android_api/vdso/Android.bp
@@ -43,10 +43,15 @@
     ldflags: [
         "-Wl,--exclude-libs,ALL",
         "-Wl,-soname,linux-vdso.so.1",
-
         // TODO(b/146399556): Use -z,separate-code to ensure that each segment's p_offset and
         // p_vaddr values are equal to work around problems with __libc_init_vdso in Bionic.
         "-Wl,-z,separate-code",
+        // Load image with the page size offset, so that we don't have zero-vaddr PT_LOAD segments.
+        // This is a workaround for the fact that Glibc doesn't properly support such VDSOs.
+        // See b/376574008.
+        // TODO(b/376574008): Page size may need to be tuned for
+        // go/android-dev/guide/practices/page-sizes unless linker automatically aligns it.
+        "-Wl,--image-base=0x4000",
         // We need sysv hash style to support vdso-parser:
         // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/vDSO/parse_vdso.c
         "-Wl,--hash-style=both",