summary refs log tree commit diff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-12-20 18:33:55 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-01-24 06:37:15 -0800
commitb5237c0746fcf5252fc88291a63782c59167fcb5 (patch)
treeb2a5891f4b054220ffb8c3290ac114012bbd8376 /elf/Makefile
parent114d07fd9a54684cb67b02174f2c48d19f3e2502 (diff)
downloadglibc-b5237c0746fcf5252fc88291a63782c59167fcb5.tar.gz
glibc-b5237c0746fcf5252fc88291a63782c59167fcb5.tar.xz
glibc-b5237c0746fcf5252fc88291a63782c59167fcb5.zip
elf: Add a test for PT_LOAD segments with mixed p_align [BZ #28676]
Add tst-p_alignmod1-edit to edit the copy of tst-p_alignmod-base.so to
reduce p_align of the first PT_LOAD segment by half and verify that the
shared library is mapped with the maximum p_align of all PT_LOAD segments.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile17
1 files changed, 17 insertions, 0 deletions
diff --git a/elf/Makefile b/elf/Makefile
index a749ef6eee..1758259075 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -413,6 +413,8 @@ tests += \
   tst-nodelete-opened \
   tst-noload \
   tst-null-argv \
+  tst-p_alignmod1-edit \
+  tst-p_align1 \
   tst-relsort1 \
   tst-ro-dynamic \
   tst-rtld-run-static \
@@ -737,6 +739,7 @@ modules-names = \
   tst-nodelete-dlclose-plugin \
   tst-nodelete-opened-lib \
   tst-null-argv-lib \
+  tst-p_alignmod-base \
   tst-relsort1mod1 \
   tst-relsort1mod2 \
   tst-ro-dynamic-mod \
@@ -2592,3 +2595,17 @@ CFLAGS-tst-dl_find_object-mod6.c += -funwind-tables
 CFLAGS-tst-dl_find_object-mod7.c += -funwind-tables
 CFLAGS-tst-dl_find_object-mod8.c += -funwind-tables
 CFLAGS-tst-dl_find_object-mod9.c += -funwind-tables
+
+$(objpfx)tst-p_alignmod-base.so: $(libsupport)
+LDFLAGS-tst-p_alignmod-base.so += -Wl,-z,max-page-size=0x200000
+
+$(objpfx)tst-p_align1: $(objpfx)tst-p_alignmod1.so
+
+# Make a copy of tst-p_alignmod-base.so and lower p_align of the first
+# PT_LOAD segment.
+$(objpfx)tst-p_alignmod1.so: $(objpfx)tst-p_alignmod1-edit \
+			     $(objpfx)tst-p_alignmod-base.so
+	rm -f $@
+	cp $(objpfx)tst-p_alignmod-base.so $@
+	$(test-wrapper-env) $(run-program-env) $(rtld-prefix) \
+	  $(objpfx)tst-p_alignmod1-edit $@