+++ /dev/null
-Index: prelink/testsuite/functions.sh
-===================================================================
---- prelink.orig/testsuite/functions.sh
-+++ prelink/testsuite/functions.sh
-@@ -1,7 +1,7 @@
- #!/bin/bash
--CC="${CC:-gcc} ${LINKOPTS}"
-+CC="${CC:-gcc} ${LINKOPTS} -Wl,--copy-dt-needed-entries" ; echo "CC=$CC"
--CCLINK=${CCLINK:-${CC} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`}
-+CCLINK="${CCLINK:-${CC} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`} -Wl,--copy-dt-needed-entries"
--CXX="${CXX:-g++} ${LINKOPTS}"
-+CXX="${CXX:-g++} ${LINKOPTS} -Wl,--copy-dt-needed-entries" ; echo "CXX=$CXX"
--CXXLINK=${CXXLINK:-${CXX} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`}
-+CXXLINK="${CXXLINK:-${CXX} -Wl,--dynamic-linker=`echo ./ld*.so.*[0-9]`} -Wl,--copy-dt-needed-entries"
- PRELINK=${PRELINK:-../src/prelink -c ./prelink.conf -C ./prelink.cache --ld-library-path=. --dynamic-linker=`echo ./ld*.so.*[0-9]`}
- srcdir=${srcdir:-`dirname $0`}
+++ /dev/null
---- src/arch-i386.c
-+++ src/arch-i386.c
-@@ -143,9 +143,11 @@
- return 2;
- }
- case R_386_PC32:
-- error (0, 0, "%s: R_386_PC32 relocs should not be present in prelinked REL sections",
-- dso->filename);
-- return 1;
-+ if (!dry_run)
-+ error (0, 0, "%s: R_386_PC32 relocs should not be present in prelinked REL sections",
-+ dso->filename);
-+ return !dry_run;
-+
- case R_386_TLS_DTPOFF32:
- write_le32 (dso, rel->r_offset, value);
- break;
-@@ -379,9 +381,10 @@
- break;
- case R_386_32:
- case R_386_PC32:
-- error (0, 0, "%s: R_386_%s32 relocs should not be present in prelinked REL sections",
-- dso->filename, GELF_R_TYPE (rel->r_info) == R_386_32 ? "" : "PC");
-- return 1;
-+ if (!dry_run)
-+ error (0, 0, "%s: R_386_%s32 relocs should not be present in prelinked REL sections",
-+ dso->filename, GELF_R_TYPE (rel->r_info) == R_386_32 ? "" : "PC");
-+ return !dry_run;
- case R_386_TLS_DTPMOD32:
- case R_386_TLS_DTPOFF32:
- case R_386_TLS_TPOFF32:
---- src/conflict.c
-+++ src/conflict.c
-@@ -461,9 +461,9 @@
- goto error_out;
- info->dsos[i] = dso;
- /* Now check that the DSO matches what we recorded about it. */
-- if (ent->timestamp != dso->info_DT_GNU_PRELINKED
-+ if (!dry_run && (ent->timestamp != dso->info_DT_GNU_PRELINKED
- || ent->checksum != dso->info_DT_CHECKSUM
-- || ent->base != dso->base)
-+ || ent->base != dso->base))
- {
- error (0, 0, "%s: Library %s has changed since it has been prelinked",
- info->dso->filename, ent->filename);
-@@ -772,6 +772,7 @@
- - info->dynbss_base, cr.rela[i].r_addend,
- cr.rela[i].r_offset);
-
-+ if (!dry_run) {
- switch (j)
- {
- case 1:
-@@ -786,6 +787,7 @@
- goto error_out;
- }
- }
-+ }
- }
-
- if (info->conflict_rela_size)
---- src/doit.c
-+++ src/doit.c
-@@ -137,10 +137,6 @@
- goto error_out;
- }
-
-- if (dry_run)
-- close_dso (dso);
-- else
-- {
- if (prelink_prepare (dso))
- goto make_unprelinkable;
- if (ent->type == ET_DYN && relocate_dso (dso, ent->base))
-@@ -152,7 +148,10 @@
- dso = NULL;
- goto error_out;
- }
-- }
-+
-+ if (dry_run)
-+ close_dso (dso);
-+
- ent->done = 2;
- ent->flags |= PCF_PRELINKED;
-
---- src/execstack.c
-+++ src/execstack.c
-@@ -31,6 +31,7 @@
-
- int set;
- int execflag;
-+int dry_run = 0; // for arch-i386
-
- const char *argp_program_version = "execstack 1.0";
-
+++ /dev/null
-diff -ru src.orig/conflict.c src/conflict.c
---- src.orig/conflict.c 2002-12-13 00:44:21.000000000 +0100
-+++ src/conflict.c 2003-01-07 12:53:31.000000000 +0100
-@@ -449,7 +449,7 @@
- for (i = 1; i < ndeps; ++i)
- {
- ent = info->ent->depends[i - 1];
-- if ((dso = open_dso (ent->filename)) == NULL)
-+ if ((dso = open_dso (ent->canon_filename)) == NULL)
- goto error_out;
- info->dsos[i] = dso;
- /* Now check that the DSO matches what we recorded about it. */
-@@ -623,8 +623,8 @@
- && dso->phdr[k].p_vaddr + dso->phdr[k].p_memsz
- > info->conflict_rela[j].r_offset)
- {
-- error (0, 0, "%s: Cannot prelink against non-PIC shared library %s",
-- info->dso->filename, dso->filename);
-+ error (0, 0, "%s: shared library %s appears possibly non-PIC and contains conflicts. Symbol offset: %lx",
-+ info->dso->filename, dso->filename, (long)info->conflict_rela[j].r_offset);
- goto error_out;
- }
- }
---- src.orig/gather.c 2002-12-03 19:55:59.000000000 +0100
-+++ src/gather.c 2003-01-07 12:53:31.000000000 +0100
-@@ -369,7 +369,7 @@
- DSO *dso;
-
- ent->type = ET_BAD;
-- dso = open_dso (ent->filename);
-+ dso = open_dso (ent->canon_filename);
- if (dso == NULL)
- return 1;
-
-Nur in src: gather.c.orig.
-diff -ru src.orig/layout.c src/layout.c
---- src.orig/layout.c 2002-12-03 18:42:31.000000000 +0100
-+++ src/layout.c 2003-01-07 12:59:39.000000000 +0100
-@@ -535,7 +535,8 @@
- < ((deps[j - 1]->end + max_page_size - 1)
- & ~(max_page_size - 1))
- && (deps[j]->type == ET_DYN || deps[j - 1]->type == ET_DYN))
-- abort ();
-+ error(EXIT_FAILURE, 0, "The sorted library entries for %s and %s do overlap",
-+ deps[j-1]->canon_filename, deps[j]->canon_filename);
- }
- #endif
- }
---- src.orig/space.c 2003-02-25 12:01:19.000000000 +0100
-+++ src/space.c 2003-02-25 16:46:42.000000000 +0100
-@@ -338,6 +338,8 @@
- shdr[j] = *add;
- shdr[j].sh_addr = (shdr[j - 1].sh_addr + shdr[j - 1].sh_size
- + add->sh_addralign - 1) & ~(add->sh_addralign - 1);
-+ if (shdr[j].sh_addr < phdr[i].p_vaddr)
-+ shdr[j].sh_addr = phdr[i].p_vaddr;
- shdr[j].sh_offset = (shdr[j].sh_addr - phdr[i].p_vaddr)
- + phdr[i].p_offset;
- phdr[i].p_filesz = shdr[j].sh_addr + add->sh_size - phdr[i].p_vaddr;
-
---- src/dso.c.orig 2003-06-30 10:51:51.000000000 +0000
-+++ src/dso.c 2003-07-29 07:09:25.000000000 +0000
-@@ -191,8 +191,11 @@
- || RELOCATE_SCN (dso->shdr[last].sh_flags)
- || RELOCATE_SCN (dso->shdr[i].sh_flags))
- {
-- error (0, 0, "%s: section file offsets not monotonically increasing",
-- dso->filename);
-+ error (0, 0, "%s: section file offsets not monotonically increasing (%s before %s)",
-+ dso->filename,
-+ strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i-1].sh_name),
-+ strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name));
-+
- return 1;
- }
- }
+++ /dev/null
---- testsuite/deps1.sh
-+++ testsuite/deps1.sh
-@@ -49,7 +49,7 @@
- readelf -A deps1.tree/usr/lib/lib3.so >> deps1.log 2>&1 || exit 7
- readelf -A deps1.tree/usr/bin/bin1 >> deps1.log 2>&1 || exit 8
- LIBS="deps1.tree/usr/lib/lib1.so deps1.tree/usr/lib/lib2.so"
--LIBS="$LIBS deps1.tree/opt/lib/lib1.so"
-+# LIBS="$LIBS deps1.tree/opt/lib/lib1.so"
- readelf -S deps1.tree/usr/lib/lib3.so | grep -q .gnu.prelink_undo \
- && LIBS="$LIBS deps1.tree/usr/lib/lib3.so"
- readelf -S deps1.tree/usr/bin/bin1 | grep -q .gnu.prelink_undo \
---- testsuite/deps2.sh
-+++ testsuite/deps2.sh
-@@ -49,7 +49,7 @@
- readelf -A deps2.tree/usr/lib/lib3.so >> deps2.log 2>&1 || exit 7
- readelf -A deps2.tree/usr/bin/bin1 >> deps2.log 2>&1 || exit 8
- LIBS="deps2.tree/usr/lib/lib1.so deps2.tree/usr/lib/lib2.so"
--LIBS="$LIBS deps2.tree/opt/lib/lib1.so"
-+#LIBS="$LIBS deps2.tree/opt/lib/lib1.so"
- BINS=
- comparelibs >> deps2.log 2>&1 || exit 9
- exit 0
---- testsuite/quick1.sh
-+++ testsuite/quick1.sh
-@@ -1,4 +1,13 @@
- #!/bin/bash
-+
-+exit 77 # this only works every second time. And if it doesn't, it's just slower
-+
-+case "`uname -m`" in
-+++ # I'm not sure why this test is so flacky on s390
-+++ # but the only thing going wrong is that it checks too much
-+++ s390) exit 77;;
-+esac
-+
- . `dirname $0`/functions.sh
- check_one() {
- cnt=0
---- testsuite/quick2.sh
-+++ testsuite/quick2.sh
-@@ -1,5 +1,8 @@
- #!/bin/bash
- . `dirname $0`/functions.sh
-+
-+#exit 77 # requires -fPIE
-+
- check_one() {
- cnt=0
- log=$1
---- testsuite/reloc10.sh
-+++ testsuite/reloc10.sh
-@@ -1,4 +1,7 @@
- #!/bin/bash
-+
-+exit 77 # if you can tell me how this is supposed to work at all, do so
-+
- . `dirname $0`/functions.sh
- rm -f reloc10 reloc10lib*.so reloc10.log
- rm -f prelink.cache
---- testsuite/reloc11.sh
-+++ testsuite/reloc11.sh
-@@ -1,4 +1,7 @@
- #!/bin/bash
-+
-+exit 77 # if you can tell me how this is supposed to work at all, do so
-+
- . `dirname $0`/functions.sh
- rm -f reloc11 reloc11lib*.so reloc11.log
- rm -f prelink.cache
---- testsuite/reloc2.sh.orig 2009-12-16 13:02:06.000000000 +0100
-+++ testsuite/reloc2.sh 2010-03-15 14:39:16.353657000 +0100
-@@ -2,8 +2,7 @@
- . `dirname $0`/functions.sh
- SHFLAGS=
- case "`uname -m`" in
-- ia64|ppc*|x86_64|mips*|arm*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
-- s390*) if file reloc1lib1.so | grep -q 64-bit; then SHFLAGS=-fpic; fi;;
-+ ia64|ppc*|x86_64|mips*|s390*) SHFLAGS=-fpic;; # Does not support non-pic shared libs
- esac
- # Disable this test under SELinux if textrel
- if test -z "$SHFLAGS" -a -x /usr/sbin/getenforce; then
Url: http://people.redhat.com/jakub/prelink/
Source: http://people.redhat.com/jakub/prelink/%name-%version.tar.bz2
Source2: %name.conf
-Patch0: %name-make_it_cool.diff
-Patch3: %name-tests.diff
-Patch4: %name-make-dry-run-verbose.diff
-Patch5: fix-copydtneeded.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
# It does not work at all on ia64, so let's listen upstream supported
# architectures
ExclusiveArch: %{ix86} alpha sparc sparc64 s390 s390x x86_64 ppc ppc64
%prep
%setup -q -n prelink
-%patch0 -p0
-%patch3 -p0
-%patch4 -p0
-%patch5 -p1
%build
# This package failed when testing with -Wl,-as-needed being default.