aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/.gitignore3
-rw-r--r--testsuite/Makefile.am4
-rw-r--r--testsuite/order.c15
-rwxr-xr-xtestsuite/order.sh24
-rw-r--r--testsuite/orderlib.c10
-rw-r--r--testsuite/orderlib.h2
-rw-r--r--testsuite/orderlib1.c6
-rw-r--r--testsuite/orderlib1.h1
-rw-r--r--testsuite/orderlib2.c6
-rw-r--r--testsuite/orderlib3.c6
10 files changed, 74 insertions, 3 deletions
diff --git a/testsuite/.gitignore b/testsuite/.gitignore
index 060ed90..3bc76fb 100644
--- a/testsuite/.gitignore
+++ b/testsuite/.gitignore
@@ -27,6 +27,8 @@ reloc2
reloc3
reloc6
reloc7
+reloc8
+reloc9
shuffle1
shuffle2
shuffle3
@@ -45,4 +47,5 @@ tls6
tls7
tlstest
undo1
+order
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 94a58c9..94ad5e9 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -1,7 +1,5 @@
## Process this file with automake to create Makefile.in
-AUTOMAKE_OPTIONS = 1.4 gnu
-
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall
AM_CFLAGS = -Wall
@@ -16,7 +14,7 @@ TESTS = movelibs.sh \
cycle1.sh cycle2.sh \
deps1.sh deps2.sh \
ifunc1.sh ifunc2.sh ifunc3.sh \
- undosyslibs.sh preload1.sh
+ undosyslibs.sh preload1.sh order.sh
TESTS_ENVIRONMENT = \
PRELINK="../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=`echo ./ld*.so.*[0-9]`" \
CC="$(CC) $(LINKOPTS)" CCLINK="$(CC) -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`" \
diff --git a/testsuite/order.c b/testsuite/order.c
new file mode 100644
index 0000000..5e0ef43
--- /dev/null
+++ b/testsuite/order.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include "orderlib1.h"
+#include "orderlib.h"
+
+int
+main()
+{
+ int rc = 0;
+ rc += orderlib1(); /* 10 */
+ rc += value();
+
+ printf("rc = %d (expect 6010)\n", rc);
+
+ return (rc != 6010);
+}
diff --git a/testsuite/order.sh b/testsuite/order.sh
new file mode 100755
index 0000000..ce0dbda
--- /dev/null
+++ b/testsuite/order.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+. `dirname $0`/functions.sh
+rm -f order orderlib*.so order.log
+rm -f prelink.cache
+
+# Need a sysroot for this...
+$CC -shared -O2 -fpic -o orderlib3.so $srcdir/orderlib3.c
+$CC -shared -O2 -fpic -o orderlib2.so $srcdir/orderlib2.c
+$CC -shared -O2 -fpic -o orderlib1.so $srcdir/orderlib1.c orderlib3.so
+$CC -shared -O2 -fpic -o orderlib.so $srcdir/orderlib.c orderlib1.so orderlib2.so orderlib3.so
+BINS="order"
+LIBS="orderlib.so orderlib1.so orderlib2.so orderlib3.so"
+$CCLINK -o order $srcdir/order.c -Wl,-rpath-link,. orderlib.so orderlib3.so
+
+: > order.log
+LD_LIBRARY_PATH=. ./order >> order.log || exit 1
+#exit 1
+#savelibs
+echo $PRELINK ${PRELINK_OPTS--vm} ./order >> order.log
+$PRELINK ${PRELINK_OPTS--vm} ./order >> order.log 2>&1 || exit 2
+grep -q ^`echo $PRELINK | sed 's/ .*$/: /'` order.log && exit 3
+LD_LIBRARY_PATH=. ./order >> order.log || exit 4
+# So that it is not prelinked again
+chmod -x ./order
diff --git a/testsuite/orderlib.c b/testsuite/orderlib.c
new file mode 100644
index 0000000..0a97e0a
--- /dev/null
+++ b/testsuite/orderlib.c
@@ -0,0 +1,10 @@
+#include "orderlib.h"
+#include "orderlib1.h"
+
+int orderlib1(void)
+{
+ int rc = 0;
+ rc += value();
+ rc += value1();
+ return rc;
+}
diff --git a/testsuite/orderlib.h b/testsuite/orderlib.h
new file mode 100644
index 0000000..a4f1eb0
--- /dev/null
+++ b/testsuite/orderlib.h
@@ -0,0 +1,2 @@
+int value(void);
+int value1(void);
diff --git a/testsuite/orderlib1.c b/testsuite/orderlib1.c
new file mode 100644
index 0000000..be4ebdc
--- /dev/null
+++ b/testsuite/orderlib1.c
@@ -0,0 +1,6 @@
+#include "orderlib.h"
+
+int value1(void)
+{
+ return 10;
+}
diff --git a/testsuite/orderlib1.h b/testsuite/orderlib1.h
new file mode 100644
index 0000000..5763a36
--- /dev/null
+++ b/testsuite/orderlib1.h
@@ -0,0 +1 @@
+int orderlib1(void);
diff --git a/testsuite/orderlib2.c b/testsuite/orderlib2.c
new file mode 100644
index 0000000..d1908ea
--- /dev/null
+++ b/testsuite/orderlib2.c
@@ -0,0 +1,6 @@
+#include "orderlib.h"
+
+int value(void)
+{
+ return 200;
+}
diff --git a/testsuite/orderlib3.c b/testsuite/orderlib3.c
new file mode 100644
index 0000000..f0ff8cd
--- /dev/null
+++ b/testsuite/orderlib3.c
@@ -0,0 +1,6 @@
+#include "orderlib.h"
+
+int value(void)
+{
+ return 3000;
+}