aboutsummaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-07-16 17:56:45 +0000
committerUlrich Drepper <drepper@redhat.com>2004-07-16 17:56:45 +0000
commitf17ed1a9ee9116a4792d22763a8c5912e5076473 (patch)
tree638a6046bfc19a736e675d6ef96db68d52b8aec8 /elf
parent290639c3b42dda0d6245d7a56740a89da07eca4c (diff)
downloadglibc-f17ed1a9ee9116a4792d22763a8c5912e5076473.tar
glibc-f17ed1a9ee9116a4792d22763a8c5912e5076473.tar.gz
glibc-f17ed1a9ee9116a4792d22763a8c5912e5076473.tar.bz2
glibc-f17ed1a9ee9116a4792d22763a8c5912e5076473.zip
[BZ #262]
Update. 2004-07-15 Jakub Jelinek <jakub@redhat.com> [BZ #262] * sysdeps/i386/elf/start.S (_start): Use @GOT instead of @GOTOFF for main. * elf/Makefile: Add rules to build and run tst-pie1. * elf/tst-pie1.c: New test. * elf/tst-piemod1.c: New file.
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile27
-rw-r--r--elf/tst-pie1.c5
-rw-r--r--elf/tst-piemod1.c20
3 files changed, 51 insertions, 1 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 6cdcfd4a26..9bbc304455 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -80,7 +80,7 @@ distribute := rtld-Rules \
nodel2mod1.c nodel2mod2.c nodel2mod3.c \
reldep9.c reldep9mod1.c reldep9mod2.c reldep9mod3.c \
tst-array1.exp tst-array2.exp tst-array4.exp \
- tst-array2dep.c \
+ tst-array2dep.c tst-piemod1.c \
tst-execstack-mod.c tst-dlmodcount.c \
check-textrel.c dl-sysdep.h
@@ -160,6 +160,9 @@ tests-nodelete-yes = nodelete nodelete2
tests-nodlopen-yes = nodlopen nodlopen2
tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
endif
+ifeq (yesyes,$(have-fpie)$(build-shared))
+tests: $(objpfx)tst-pie1.out
+endif
modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
testobj1_1 failobj constload2 constload3 unloadmod \
dep1 dep2 dep3 dep4 $(modules-vis-$(have-protected)) \
@@ -185,6 +188,9 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
ifeq (yes,$(have-initfini-array))
modules-names += tst-array2dep
endif
+ifeq (yesyes,$(have-fpie)$(build-shared))
+modules-names += tst-piemod1
+endif
modules-vis-yes = vismod1 vismod2 vismod3
modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4 \
nodel2mod1 nodel2mod2 nodel2mod3
@@ -705,6 +711,25 @@ $(objpfx)tst-array4.out: $(objpfx)tst-array4 $(objpfx)tst-array2dep.so
$< > $@
cmp $@ tst-array4.exp > /dev/null
+ifeq (yesyes,$(have-fpie)$(build-shared))
+CFLAGS-tst-pie1.c += -fpie
+
+$(objpfx)tst-pie1.out: $(objpfx)tst-pie1
+ $(elf-objpfx)$(rtld-installed-name) \
+ --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) \
+ $< > $@
+
+$(objpfx)tst-pie1: $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so
+ $(LINK.o) -pie -Wl,-O1 \
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) \
+ $(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
+ $(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
+ $(LDFLAGS) $(LDFLAGS-$(@F)) \
+ -L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link) \
+ -o $@ $(objpfx)tst-pie1.o $(objpfx)tst-piemod1.so \
+ $(common-objpfx)libc_nonshared.a
+endif
+
check-textrel-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
$(objpfx)check-textrel: check-textrel.c
$(native-compile)
diff --git a/elf/tst-pie1.c b/elf/tst-pie1.c
new file mode 100644
index 0000000000..75d941f21f
--- /dev/null
+++ b/elf/tst-pie1.c
@@ -0,0 +1,5 @@
+int
+foo (void)
+{
+ return 34;
+}
diff --git a/elf/tst-piemod1.c b/elf/tst-piemod1.c
new file mode 100644
index 0000000000..ad439da800
--- /dev/null
+++ b/elf/tst-piemod1.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+
+int
+foo (void)
+{
+ return 21;
+}
+
+int
+main (void)
+{
+ int val = foo ();
+ if (val != 34)
+ {
+ printf ("foo () returned %d\n", val);
+ return 1;
+ }
+
+ return 0;
+}