aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2016-03-22 11:37:36 -0500
committerMark Hatle <mark.hatle@windriver.com>2016-03-22 11:37:36 -0500
commit335a6e50385e540a2b61b62438414b4376c31947 (patch)
tree367e87bf0c5b9c39cc6aec9f4f61664dfc00c6e6
parentb1d4cfaf190bc394828577581bbc2ee1ca80f0ec (diff)
parent8f55afd84b3580b1f1d6af904e8c2a39221055b7 (diff)
downloadprelink-cross-335a6e50385e540a2b61b62438414b4376c31947.tar.gz
prelink-cross-335a6e50385e540a2b61b62438414b4376c31947.tar.bz2
prelink-cross-335a6e50385e540a2b61b62438414b4376c31947.zip
Merge branch 'cross_prelink_staging' into master_staging
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
-rw-r--r--.gitignore4
-rw-r--r--ChangeLog16
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac5
-rw-r--r--doc/Makefile.am2
-rw-r--r--gelf/Makefile.am4
-rw-r--r--gelfx/Makefile.am2
-rw-r--r--gelfx32/Makefile.am2
-rw-r--r--m4/libelf.m42
-rw-r--r--patches/Makefile.am2
-rw-r--r--src/Makefile.am4
-rw-r--r--src/dso.c5
-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
22 files changed, 102 insertions, 24 deletions
diff --git a/.gitignore b/.gitignore
index 4510dcd..29a6bd9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,14 +16,18 @@ install-sh
libtool
ltmain.sh
m4
+!m4/Makefile.am
+!m4/libelf.m4
missing
*.o
stamp-h1
test-driver
.deps
.libs
+.dirstamp
*.lo
*.la
execstack
prelink
prelink-rtld
+*~
diff --git a/ChangeLog b/ChangeLog
index f82f55e..a6a0578 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2016-22-28 Mark Hatle <mark.hatle@windriver.com>
+ * Merge with cross_prelink
+
+2016-03-18 Donn Seeley <donn.seeley@windriver.com>
+ * testsuite/order: Add test to verify prelink/prelink-rtld resolution
+ order
+
+2016-03-18 Mark Hatle <mark.hatle@windriver.com>
+ * src/dso.c: Fix compilation warning
+
+2016-03-10 Mark Hatle <mark.hatle@windriver.com>
+ * configure.ac, m4/libelf.m4, doc/Makefile.am, gelf/Makefile.am,
+ gelfx/Makefile.am, gelfx32/Makefile.am, patches/Makefile.am,
+ src/Makefile.am, testsuite/Makefile.am:
+ Update to avoid autoconf/automake warnings
+
2015-10-29 Mark Hatle <mark.hatle@windriver.com>
Kyle McMartin <kmcmartin@redhat.com>
Jakub Jelinek <jakub@redhat.com>
diff --git a/Makefile.am b/Makefile.am
index 5a50830..b78e89d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,5 @@
## Process this file with automake to create Makefile.in
-AUTOMAKE_OPTIONS = 1.4 gnu
MAINT_CHARSET = latin1
ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index 11a5443..5046176 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,12 @@
dnl Process this file with autoconf to produce a configure script. -*-m4-*-
-AC_INIT(src/prelink.c)
+AC_INIT([prelink], [1.0])
AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_MACRO_DIR([m4])
AC_PREREQ(2.50) dnl Minimum Autoconf version required.
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
-AM_INIT_AUTOMAKE([prelink], [0.0])
+AM_INIT_AUTOMAKE([subdir-objects gnu 1.4])
ALL_LINGUAS=
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 45f4757..95f5636 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,7 +1,5 @@
## Process this file with automake to create Makefile.in
-AUTOMAKE_OPTIONS = 1.4 gnu
-
man_MANS = prelink.8 execstack.8
EXTRA_DIST = prelink.8 execstack.8 prelink.conf
PDFLATEXINPUTS = TEXINPUTS_pdflatex=.:$(srcdir):`kpsewhich --progname=pdflatex --show-path=cnf.pdflatex`
diff --git a/gelf/Makefile.am b/gelf/Makefile.am
index f6320fa..ec30b76 100644
--- a/gelf/Makefile.am
+++ b/gelf/Makefile.am
@@ -1,10 +1,8 @@
## 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
-INCLUDES = @GELFINCLUDE@
+AM_CPPFLAGS = @GELFINCLUDE@
noinst_LTLIBRARIES = libgelf.la
diff --git a/gelfx/Makefile.am b/gelfx/Makefile.am
index ae51b93..9ea1a44 100644
--- a/gelfx/Makefile.am
+++ b/gelfx/Makefile.am
@@ -1,5 +1,3 @@
## Process this file with automake to create Makefile.in
-AUTOMAKE_OPTIONS = 1.4 gnu
-
noinst_HEADERS = gelfx.h
diff --git a/gelfx32/Makefile.am b/gelfx32/Makefile.am
index ae51b93..9ea1a44 100644
--- a/gelfx32/Makefile.am
+++ b/gelfx32/Makefile.am
@@ -1,5 +1,3 @@
## Process this file with automake to create Makefile.in
-AUTOMAKE_OPTIONS = 1.4 gnu
-
noinst_HEADERS = gelfx.h
diff --git a/m4/libelf.m4 b/m4/libelf.m4
index 88f061b..295bf0c 100644
--- a/m4/libelf.m4
+++ b/m4/libelf.m4
@@ -5,7 +5,7 @@ dnl Detect it.
dnl Written by Jakub Jelinek <jakub@redhat.com>.
-AC_DEFUN(AC_LIBELF_SXWORD,
+AC_DEFUN([AC_LIBELF_SXWORD],
[AC_TRY_RUN([
#include <errno.h>
#include <fcntl.h>
diff --git a/patches/Makefile.am b/patches/Makefile.am
index efe5d40..18bf051 100644
--- a/patches/Makefile.am
+++ b/patches/Makefile.am
@@ -1,5 +1,3 @@
## Process this file with automake to create Makefile.in
-AUTOMAKE_OPTIONS = 1.4 gnu
-
EXTRA_DIST = libelf-0.7.0.patch libelf-0.7.0-hash.patch linux-2.4.10.patch
diff --git a/src/Makefile.am b/src/Makefile.am
index 0f9c8d0..8e5f7b8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,5 @@
## Process this file with automake to create Makefile.in
-AUTOMAKE_OPTIONS = 1.4 gnu
-
PKGVERSION = "\"@PKGVERSION@\""
REPORT_BUGS_TO = "\"@REPORT_BUGS_TO@\""
@@ -13,7 +11,7 @@ AM_CPPFLAGS = -DSBINDIR='"@sbindir@"' -DBINDIR='"@bindir@"' \
-DEXEEXT='"$(EXEEXT)"' \
-DPKGVERSION=$(PKGVERSION) \
-DREPORT_BUGS_TO=$(REPORT_BUGS_TO)
-INCLUDES = @GELFINCLUDE@
+AM_CPPFLAGS += @GELFINCLUDE@
sbin_PROGRAMS = prelink
bin_PROGRAMS = execstack
diff --git a/src/dso.c b/src/dso.c
index d4eceb4..1dac153 100644
--- a/src/dso.c
+++ b/src/dso.c
@@ -285,7 +285,7 @@ fdopen_dso (int fd, const char *name)
Elf *elf = NULL;
GElf_Ehdr ehdr;
GElf_Addr last_off;
- int i, j, k, last, *sections, *invsections;
+ int i, j, k, *sections, *invsections;
DSO *dso = NULL;
struct PLArch *plarch;
extern struct PLArch __start_pl_arch[], __stop_pl_arch[];
@@ -390,11 +390,10 @@ fdopen_dso (int fd, const char *name)
sections = (int *) alloca (dso->ehdr.e_shnum * sizeof (int) * 2);
sections[0] = 0;
- for (i = 1, j = 1, k = dso->ehdr.e_shnum, last = -1;
+ for (i = 1, j = 1, k = dso->ehdr.e_shnum;
i < dso->ehdr.e_shnum; ++i)
if (RELOCATE_SCN (dso->shdr[i].sh_flags))
{
- last = i;
sections[j++] = i;
}
else
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;
+}