Skip to content

Commit

Permalink
Merge branch 'cross_prelink_staging' into master_staging
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Hatle <[email protected]>
  • Loading branch information
Mark Hatle committed Mar 22, 2016
2 parents b1d4cfa + 8f55afd commit 335a6e5
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 24 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
*~
16 changes: 16 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2016-22-28 Mark Hatle <[email protected]>
* Merge with cross_prelink

2016-03-18 Donn Seeley <[email protected]>
* testsuite/order: Add test to verify prelink/prelink-rtld resolution
order

2016-03-18 Mark Hatle <[email protected]>
* src/dso.c: Fix compilation warning

2016-03-10 Mark Hatle <[email protected]>
* 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 <[email protected]>
Kyle McMartin <[email protected]>
Jakub Jelinek <[email protected]>
Expand Down
1 change: 0 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -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=

Expand Down
2 changes: 0 additions & 2 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
4 changes: 1 addition & 3 deletions gelf/Makefile.am
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 0 additions & 2 deletions gelfx/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## Process this file with automake to create Makefile.in

AUTOMAKE_OPTIONS = 1.4 gnu

noinst_HEADERS = gelfx.h
2 changes: 0 additions & 2 deletions gelfx32/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
## Process this file with automake to create Makefile.in

AUTOMAKE_OPTIONS = 1.4 gnu

noinst_HEADERS = gelfx.h
2 changes: 1 addition & 1 deletion m4/libelf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dnl Detect it.

dnl Written by Jakub Jelinek <[email protected]>.

AC_DEFUN(AC_LIBELF_SXWORD,
AC_DEFUN([AC_LIBELF_SXWORD],
[AC_TRY_RUN([
#include <errno.h>
#include <fcntl.h>
Expand Down
2 changes: 0 additions & 2 deletions patches/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
4 changes: 1 addition & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -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@\""

Expand All @@ -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
Expand Down
5 changes: 2 additions & 3 deletions src/dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions testsuite/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ reloc2
reloc3
reloc6
reloc7
reloc8
reloc9
shuffle1
shuffle2
shuffle3
Expand All @@ -45,4 +47,5 @@ tls6
tls7
tlstest
undo1
order

4 changes: 1 addition & 3 deletions testsuite/Makefile.am
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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]`" \
Expand Down
15 changes: 15 additions & 0 deletions testsuite/order.c
Original file line number Diff line number Diff line change
@@ -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);
}
24 changes: 24 additions & 0 deletions testsuite/order.sh
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions testsuite/orderlib.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "orderlib.h"
#include "orderlib1.h"

int orderlib1(void)
{
int rc = 0;
rc += value();
rc += value1();
return rc;
}
2 changes: 2 additions & 0 deletions testsuite/orderlib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
int value(void);
int value1(void);
6 changes: 6 additions & 0 deletions testsuite/orderlib1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "orderlib.h"

int value1(void)
{
return 10;
}
1 change: 1 addition & 0 deletions testsuite/orderlib1.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int orderlib1(void);
6 changes: 6 additions & 0 deletions testsuite/orderlib2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "orderlib.h"

int value(void)
{
return 200;
}
6 changes: 6 additions & 0 deletions testsuite/orderlib3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "orderlib.h"

int value(void)
{
return 3000;
}

0 comments on commit 335a6e5

Please sign in to comment.