aboutsummaryrefslogtreecommitdiff
path: root/elf/Makefile
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2012-04-30 15:41:15 -0700
committerRoland McGrath <roland@hack.frob.com>2012-05-01 13:27:52 -0700
commit82397ed6eab79f3f17f66efae5ccfa19fa0e03d0 (patch)
treecac18c3bcd914ae38850bdbee3266b9281aa41b1 /elf/Makefile
parent82a79e7d1843f9d90075a0bf2f04557040829bb0 (diff)
downloadglibc-82397ed6eab79f3f17f66efae5ccfa19fa0e03d0.tar
glibc-82397ed6eab79f3f17f66efae5ccfa19fa0e03d0.tar.gz
glibc-82397ed6eab79f3f17f66efae5ccfa19fa0e03d0.tar.bz2
glibc-82397ed6eab79f3f17f66efae5ccfa19fa0e03d0.zip
Do check-execstack test using readelf rather than a build-time C program.
Diffstat (limited to 'elf/Makefile')
-rw-r--r--elf/Makefile41
1 files changed, 26 insertions, 15 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 50934be71b..c207b53904 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -872,18 +872,6 @@ CFLAGS-tst-pie1.c += $(pie-ccflag)
$(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
-check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 \
- $(objpfx:%/=-I%)
-$(objpfx)check-execstack: check-execstack.c $(objpfx)check-execstack.h
- $(native-compile)
-$(objpfx)check-execstack.h: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
- $(make-target-directory)
- { echo '#include <stackinfo.h>'; echo '@@@DEFAULT_STACK_PERMS@@@'; } | \
- $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
- sed -n -e 's/^@@@\(.*\)@@@/#define DEFAULT_STACK_PERMS \1/p' > $@T
- mv -f $@T $@
-generated += check-execstack.h
-
check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
$(objpfx)check-localplt: check-localplt.c
$(native-compile)
@@ -909,9 +897,32 @@ $(objpfx)check-textrel.out: $(..)scripts/check-textrel.awk \
LC_ALL=C $(AWK) -f $^ > $@
generated += check-textrel.out
-$(objpfx)check-execstack.out: $(objpfx)check-execstack $(all-built-dso)
- $(dir $<)$(notdir $<) $(filter-out $<, $^) > $@
-generated += check-execstack check-execstack.out
+$(objpfx)execstack-default: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
+ $(make-target-directory)
+ { echo '#include <elf.h>'; \
+ echo '#include <stackinfo.h>'; \
+ echo '#if (DEFAULT_STACK_PERMS & PF_X) == 0'; \
+ echo '@@@execstack-no@@@'; \
+ echo '#else'; \
+ echo '@@@execstack-yes@@@'; \
+ echo '#endif'; } | \
+ $(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
+ sed -n -e 's/^@@@\(.*\)@@@/\1/p' > $@T
+ mv -f $@T $@
+generated += execstack-default
+
+$(all-built-dso:=.phdr): %.phdr: %
+ @rm -f $@T
+ LC_ALL=C $(READELF) -W -l $< > $@T
+ test -s $@T
+ mv -f $@T $@
+generated += $(all-built-dso:=.phdr)
+
+$(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
+ $(objpfx)execstack-default \
+ $(all-built-dso:=.phdr)
+ LC_ALL=C $(AWK) -f $^ > $@
+generated += check-execstack.out
$(objpfx)tst-dlmodcount: $(libdl)
$(objpfx)tst-dlmodcount.out: $(test-modules)