diff -Nru prelink-0.0.20071009/ChangeLog prelink-0.0.20090311/ChangeLog --- prelink-0.0.20071009/ChangeLog 2007-10-09 12:00:40.000000000 -0500 +++ prelink-0.0.20090311/ChangeLog 2009-03-11 04:48:54.000000000 -0500 @@ -1,3 +1,67 @@ +2009-03-11 Jakub Jelinek + + * src/prelink.h (PLArch): Add rtype_class_valid field. + * src/get.c (prelink_record_relocations): If not /4, or + dso->arch->rtype_class_valid instead of RTYPE_CLASS_VALID + into reloc_class. + * src/cxx.c (remove_redundant_cxx_conflicts): Use + info->dso->arch->rtype_class_valid instead of RTYPE_CLASS_VALID. + * src/arch-ppc64.c (ppc64_reloc_class): For R_PPC64_COPY return + RTYPE_CLASS_COPY | RTYPE_CLASS_PLT, for non-TLS relocs return + RTYPE_CLASS_PLT. + (PL_ARCH): Set rtype_class_valid to RTYPE_CLASS_PLT. + * src/arch-alpha.c (PL_ARCH): Set rtype_class_valid to + RTYPE_CLASS_VALID. + * src/arch-arm.c (PL_ARCH): Likewise. + * src/arch-cris.c (PL_ARCH): Likewise. + * src/arch-i386.c (PL_ARCH): Likewise. + * src/arch-ia64.c (PL_ARCH): Likewise. + * src/arch-mips.c (PL_ARCH): Likewise. + * src/arch-ppc.c (PL_ARCH): Likewise. + * src/arch-s390.c (PL_ARCH): Likewise. + * src/arch-s390x.c (PL_ARCH): Likewise. + * src/arch-sh.c (PL_ARCH): Likewise. + * src/arch-sparc.c (PL_ARCH): Likewise. + * src/arch-sparc64.c (PL_ARCH): Likewise. + * src/arch-x86_64.c (PL_ARCH): Likewise. + +2009-03-04 Joseph Myers + + * testsuite/reloc2.sh, testsuite/tls3.sh: Add ARM to architectures + requiring PIC shared libraries. + +2009-03-04 Daniel Jacobowitz + Joseph Myers + + * src/arch-arm.c (arm_prelink_rel, arm_prelink_rela, + arm_prelink_conflict_rel, arm_prelink_conflict_rela, arm_rel_to_rela, + arm_rela_to_rel, arm_need_rel_to_rela, arm_undo_prelink_rel, + arm_reloc_class): Handle TLS relocations. + * src/prelink.h (R_ARM_TLS_DTPMOD32, R_ARM_TLS_DTPOFF32, + R_ARM_TLS_TPOFF32): Define if R_ARM_TLS_DTPMOD32 not already + defined. + +2009-03-04 Daniel Jacobowitz + + * src/arch-arm.c (arm_adjust_dyn, arm_adjust_rel, arm_adjust_rela, + arm_prelink_rel, arm_prelink_rela, arm_apply_conflict_rela, + arm_apply_rel, arm_apply_rela, arm_prelink_conflict_rela, + arm_rel_to_rela, arm_rela_to_rel, arm_need_rel_to_rela, + arm_arch_prelink, arm_arch_undo_prelink, arm_undo_prelink_rel): + Use endian-neutral functions. + +2008-09-29 Joseph Myers + + * src/arch-sparc64.c (sparc64_prelink_rela, + sparc64_prelink_conflict_rela, sparc64_undo_prelink_rela, + sparc64_reloc_class): Handle TLS relocations. + (PL_ARCH): Update mmap_base and mmap_end for TASK_UNMAPPED_BASE + change to 0xfffff80100000000. + +2007-12-04 Daniel Jacobowitz + + * src/gather.c (gather_object): Print an error if nftw64 fails. + 2007-10-09 Jakub Jelinek * src/cxx.c (remove_redundant_cxx_conflicts): Allow .sdata diff -Nru prelink-0.0.20071009/debian/changelog prelink-0.0.20090311/debian/changelog --- prelink-0.0.20071009/debian/changelog 2009-05-10 01:09:34.000000000 -0500 +++ prelink-0.0.20090311/debian/changelog 2009-05-10 01:09:34.000000000 -0500 @@ -1,3 +1,18 @@ +prelink (0.0.20090311-1ubuntu1) karmic; urgency=low + + [ Steven Susbauer ] + * Merge from debian unstable (LP: #374367), remaining changes: + - Update maintainer field. + - Keep lpia arch. + + -- Steven Susbauer Sun, 10 May 2009 01:02:40 -0500 + +prelink (0.0.20090311-1) unstable; urgency=low + + * New upstream release. + + -- Andrés Roldán Tue, 14 Apr 2009 14:15:26 +0000 + prelink (0.0.20071009-1ubuntu1) intrepid; urgency=low * Build prelink on lpia. diff -Nru prelink-0.0.20071009/debian/compat prelink-0.0.20090311/debian/compat --- prelink-0.0.20071009/debian/compat 2009-05-10 01:09:34.000000000 -0500 +++ prelink-0.0.20090311/debian/compat 2009-05-10 01:09:34.000000000 -0500 @@ -1 +1 @@ -4 +5 diff -Nru prelink-0.0.20071009/debian/control prelink-0.0.20090311/debian/control --- prelink-0.0.20071009/debian/control 2009-05-10 01:09:34.000000000 -0500 +++ prelink-0.0.20090311/debian/control 2009-05-10 01:09:34.000000000 -0500 @@ -1,10 +1,11 @@ Source: prelink Section: admin Priority: optional -Maintainer: Andrés Roldán +Maintainer: Ubuntu MOTU Developers +XSBC-Original-Maintainer: Andrés Roldán Uploaders: GNU Libc Maintainers Build-Depends: libc6-dev (>> 2.3.5) | libc6.1-dev (>> 2.3.5), debhelper (>> 4.0.18), libelfg0-dev, libpopt-dev, dpatch (>= 1.11), libselinux1-dev -Standards-Version: 3.6.2.0 +Standards-Version: 3.8.1.0 Package: prelink Architecture: alpha amd64 i386 lpia powerpc ppc64 diff -Nru prelink-0.0.20071009/debian/prelink.spec prelink-0.0.20090311/debian/prelink.spec --- prelink-0.0.20071009/debian/prelink.spec 2009-05-10 01:09:34.000000000 -0500 +++ prelink-0.0.20090311/debian/prelink.spec 2009-05-10 01:09:34.000000000 -0500 @@ -1,10 +1,10 @@ Summary: An ELF prelinking utility Name: prelink Version: 0.4.0 -Release: 1 -License: GPL +Release: 7%{?dist} +License: GPLv2+ Group: System Environment/Base -%define date 20071009 +%define date 20090311 Source: ftp://people.redhat.com/jakub/prelink/prelink-%{date}.tar.bz2 Source2: prelink.conf Source3: prelink.cron @@ -12,11 +12,12 @@ Buildroot: %{_tmppath}/prelink-root #BuildRequires: libelf-devel >= 0.7.0-5 BuildRequires: elfutils-libelf-devel-static -BuildRequires: libselinux-devel +BuildRequires: libselinux-static +BuildRequires: glibc-static Requires: glibc >= 2.2.4-18, coreutils, findutils Requires: util-linux, gawk, grep # For now -ExclusiveArch: %{ix86} alpha sparc sparc64 s390 s390x x86_64 ppc ppc64 +ExclusiveArch: %{ix86} alpha sparc sparcv9 sparc64 s390 s390x x86_64 ppc ppc64 %description The prelink package contains a utility which modifies ELF shared libraries @@ -24,7 +25,7 @@ and thus programs come up faster. %prep -%setup -n prelink +%setup -q -n prelink %build %configure --disable-shared @@ -83,6 +84,23 @@ %attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/log/prelink/prelink.log %changelog +* Wed Mar 11 2009 Jakub Jelinek 0.4.0-7 +- fix prelinking on ppc64 + +* Tue Mar 10 2009 Jakub Jelinek 0.4.0-6 +- BuildRequire glibc-static +- rebuilt with gcc 4.4 +- sparc64 and ARM TLS support + +* Thu Feb 26 2009 Fedora Release Engineering - 0.4.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Fri Aug 29 2008 Tom "spot" Callaway 0.4.0-4 +- fix license tag + +* Tue Apr 8 2008 Jakub Jelinek 0.4.0-3 +- BuildRequire libselinux-static rather than libselinux-devel (#440749) + * Tue Oct 9 2007 Jakub Jelinek 0.4.0-1 - add support for -c /etc/prelink.conf.d/*.conf in prelink.conf (#244452) - remove no longer existent directories from default prelink.conf (#248694) diff -Nru prelink-0.0.20071009/src/arch-alpha.c prelink-0.0.20090311/src/arch-alpha.c --- prelink-0.0.20071009/src/arch-alpha.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-alpha.c 2009-03-10 12:53:47.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -467,6 +467,7 @@ .R_JMP_SLOT = R_ALPHA_JMP_SLOT, .R_COPY = -1, .R_RELATIVE = R_ALPHA_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld-linux.so.2", .adjust_dyn = alpha_adjust_dyn, .adjust_rel = alpha_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-arm.c prelink-0.0.20090311/src/arch-arm.c --- prelink-0.0.20071009/src/arch-arm.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-arm.c 2009-03-10 12:53:58.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -40,12 +40,12 @@ if (sec == -1) return 0; - data = read_ule32 (dso, dyn->d_un.d_ptr); + data = read_une32 (dso, dyn->d_un.d_ptr); /* If .got.plt[0] points to _DYNAMIC, it needs to be adjusted. */ if (data == dso->shdr[n].sh_addr && data >= start) - write_le32 (dso, dyn->d_un.d_ptr, data + adjust); + write_ne32 (dso, dyn->d_un.d_ptr, data + adjust); - data = read_ule32 (dso, dyn->d_un.d_ptr + 4); + data = read_une32 (dso, dyn->d_un.d_ptr + 4); /* If .got.plt[1] points to .plt, it needs to be adjusted. */ if (data && data >= start) { @@ -57,7 +57,7 @@ && strcmp (strptr (dso, dso->ehdr.e_shstrndx, dso->shdr[i].sh_name), ".plt") == 0) { - write_le32 (dso, dyn->d_un.d_ptr + 4, data + adjust); + write_ne32 (dso, dyn->d_un.d_ptr + 4, data + adjust); break; } } @@ -74,9 +74,9 @@ { case R_ARM_RELATIVE: case R_ARM_JUMP_SLOT: - data = read_ule32 (dso, rel->r_offset); + data = read_une32 (dso, rel->r_offset); if (data >= start) - write_le32 (dso, rel->r_offset, data + adjust); + write_ne32 (dso, rel->r_offset, data + adjust); break; } return 0; @@ -96,13 +96,13 @@ rela->r_addend += (Elf32_Sword) adjust; /* Write it to the memory location as well. Not necessary, but we can do it. */ - write_le32 (dso, rela->r_offset, rela->r_addend); + write_ne32 (dso, rela->r_offset, rela->r_addend); } break; case R_ARM_JUMP_SLOT: - data = read_ule32 (dso, rela->r_offset); + data = read_une32 (dso, rela->r_offset); if (data >= start) - write_le32 (dso, rela->r_offset, data + adjust); + write_ne32 (dso, rela->r_offset, data + adjust); break; break; } @@ -126,18 +126,18 @@ { case R_ARM_GLOB_DAT: case R_ARM_JUMP_SLOT: - write_le32 (dso, rel->r_offset, value); + write_ne32 (dso, rel->r_offset, value); break; case R_ARM_ABS32: { - if (read_ule32 (dso, rel->r_offset)) + if (read_une32 (dso, rel->r_offset)) { error (0, 0, "%s: R_ARM_ABS32 relocs with non-zero addend should not be present in prelinked REL sections", dso->filename); return 1; } rel->r_info = GELF_R_INFO (GELF_R_SYM (rel->r_info), R_ARM_GLOB_DAT); - write_le32 (dso, rel->r_offset, value); + write_ne32 (dso, rel->r_offset, value); /* Tell prelink_rel routine *rel has changed. */ return 2; } @@ -151,6 +151,25 @@ return 0; error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename); return 1; + case R_ARM_TLS_DTPOFF32: + write_ne32 (dso, rel->r_offset, value); + break; + /* DTPMOD32 and TPOFF32 is impossible to predict in shared libraries + unless prelink sets the rules. */ + case R_ARM_TLS_DTPMOD32: + if (dso->ehdr.e_type == ET_EXEC) + { + error (0, 0, "%s: R_ARM_TLS_DTPMOD32 reloc in executable?", + dso->filename); + return 1; + } + break; + case R_ARM_TLS_TPOFF32: + if (dso->ehdr.e_type == ET_EXEC) + error (0, 0, "%s: R_ARM_TLS_TPOFF32 relocs should not be present in " + "prelinked ET_EXEC REL sections", + dso->filename); + break; default: error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, (int) GELF_R_TYPE (rel->r_info)); @@ -178,10 +197,10 @@ { case R_ARM_GLOB_DAT: case R_ARM_JUMP_SLOT: - write_le32 (dso, rela->r_offset, value + rela->r_addend); + write_ne32 (dso, rela->r_offset, value + rela->r_addend); break; case R_ARM_ABS32: - write_le32 (dso, rela->r_offset, value + rela->r_addend); + write_ne32 (dso, rela->r_offset, value + rela->r_addend); break; case R_ARM_PC24: val = value + rela->r_addend - rela->r_offset; @@ -192,8 +211,8 @@ return 1; } val &= 0xffffff; - write_le32 (dso, rela->r_offset, - (read_ule32 (dso, rela->r_offset) & 0xff000000) | val); + write_ne32 (dso, rela->r_offset, + (read_une32 (dso, rela->r_offset) & 0xff000000) | val); break; case R_ARM_COPY: if (dso->ehdr.e_type == ET_EXEC) @@ -201,6 +220,24 @@ return 0; error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename); return 1; + case R_ARM_TLS_DTPOFF32: + write_ne32 (dso, rela->r_offset, value + rela->r_addend); + break; + /* DTPMOD32 and TPOFF32 is impossible to predict in shared libraries + unless prelink sets the rules. */ + case R_ARM_TLS_DTPMOD32: + if (dso->ehdr.e_type == ET_EXEC) + { + error (0, 0, "%s: R_ARM_TLS_DTPMOD32 reloc in executable?", + dso->filename); + return 1; + } + break; + case R_ARM_TLS_TPOFF32: + if (dso->ehdr.e_type == ET_EXEC && info->resolvetls) + write_ne32 (dso, rela->r_offset, + value + rela->r_addend + info->resolvetls->offset); + break; default: error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, (int) GELF_R_TYPE (rela->r_info)); @@ -218,7 +255,7 @@ case R_ARM_GLOB_DAT: case R_ARM_JUMP_SLOT: case R_ARM_ABS32: - buf_write_le32 (buf, rela->r_addend); + buf_write_ne32 (info->dso, buf, rela->r_addend); break; default: abort (); @@ -240,14 +277,14 @@ break; case R_ARM_GLOB_DAT: case R_ARM_JUMP_SLOT: - buf_write_le32 (buf, value); + buf_write_ne32 (info->dso, buf, value); break; case R_ARM_ABS32: - buf_write_le32 (buf, value + read_ule32 (info->dso, rel->r_offset)); + buf_write_ne32 (info->dso, buf, value + read_une32 (info->dso, rel->r_offset)); break; case R_ARM_PC24: val = value + rel->r_offset; - value = read_ule32 (info->dso, rel->r_offset) << 8; + value = read_une32 (info->dso, rel->r_offset) << 8; value = ((Elf32_Sword) value) >> 6; val += value; val >>= 2; @@ -257,7 +294,7 @@ return 1; } val &= 0xffffff; - buf_write_le32 (buf, (buf_read_ule32 (buf) & 0xff000000) | val); + buf_write_ne32 (info->dso, buf, (buf_read_une32 (info->dso, buf) & 0xff000000) | val); break; case R_ARM_COPY: abort (); @@ -285,7 +322,7 @@ case R_ARM_GLOB_DAT: case R_ARM_JUMP_SLOT: case R_ARM_ABS32: - buf_write_le32 (buf, value + rela->r_addend); + buf_write_ne32 (info->dso, buf, value + rela->r_addend); break; case R_ARM_PC24: val = value + rela->r_addend - rela->r_offset; @@ -296,7 +333,7 @@ return 1; } val &= 0xffffff; - buf_write_le32 (buf, (buf_read_ule32 (buf) & 0xff000000) | val); + buf_write_ne32 (info->dso, buf, (buf_read_une32 (info->dso, buf) & 0xff000000) | val); break; case R_ARM_COPY: abort (); @@ -315,6 +352,7 @@ { GElf_Addr value; struct prelink_conflict *conflict; + struct prelink_tls *tls; GElf_Rela *ret; if (GELF_R_TYPE (rel->r_info) == R_ARM_RELATIVE @@ -324,8 +362,34 @@ conflict = prelink_conflict (info, GELF_R_SYM (rel->r_info), GELF_R_TYPE (rel->r_info)); if (conflict == NULL) - return 0; - value = conflict_lookup_value (conflict); + { + if (info->curtls == NULL) + return 0; + + switch (GELF_R_TYPE (rel->r_info)) + { + /* Even local DTPMOD and TPOFF relocs need conflicts. */ + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_TPOFF32: + break; + + default: + return 0; + } + value = 0; + } + else + { + /* DTPOFF32 wants to see only real conflicts, not lookups + with reloc_class RTYPE_CLASS_TLS. */ + if (GELF_R_TYPE (rel->r_info) == R_ARM_TLS_DTPOFF32 + && conflict->lookup.tls == conflict->conflict.tls + && conflict->lookupval == conflict->conflictval) + return 0; + + value = conflict_lookup_value (conflict); + } + ret = prelink_conflict_add_rela (info); if (ret == NULL) return 1; @@ -345,6 +409,33 @@ case R_ARM_COPY: error (0, 0, "R_ARM_COPY should not be present in shared libraries"); return 1; + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_DTPOFF32: + case R_ARM_TLS_TPOFF32: + if (conflict != NULL + && (conflict->reloc_class != RTYPE_CLASS_TLS + || conflict->lookup.tls == NULL)) + { + error (0, 0, "%s: TLS reloc not resolving to STT_TLS symbol", + dso->filename); + return 1; + } + tls = conflict ? conflict->lookup.tls : info->curtls; + ret->r_info = GELF_R_INFO (0, R_ARM_ABS32); + switch (GELF_R_TYPE (rel->r_info)) + { + case R_ARM_TLS_DTPMOD32: + ret->r_addend = tls->modid; + break; + case R_ARM_TLS_DTPOFF32: + ret->r_addend = value; + break; + case R_ARM_TLS_TPOFF32: + ret->r_addend = (value + read_une32 (dso, rel->r_offset) + + tls->offset); + break; + } + break; default: error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, (int) GELF_R_TYPE (rel->r_info)); @@ -359,6 +450,7 @@ { GElf_Addr value; struct prelink_conflict *conflict; + struct prelink_tls *tls; GElf_Rela *ret; Elf32_Sword val; @@ -368,9 +460,36 @@ return 0; conflict = prelink_conflict (info, GELF_R_SYM (rela->r_info), GELF_R_TYPE (rela->r_info)); + if (conflict == NULL) - return 0; - value = conflict_lookup_value (conflict); + { + if (info->curtls == NULL) + return 0; + + switch (GELF_R_TYPE (rela->r_info)) + { + /* Even local DTPMOD and TPOFF relocs need conflicts. */ + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_TPOFF32: + break; + + default: + return 0; + } + value = 0; + } + else + { + /* DTPOFF32 wants to see only real conflicts, not lookups + with reloc_class RTYPE_CLASS_TLS. */ + if (GELF_R_TYPE (rela->r_info) == R_ARM_TLS_DTPOFF32 + && conflict->lookup.tls == conflict->conflict.tls + && conflict->lookupval == conflict->conflictval) + return 0; + + value = conflict_lookup_value (conflict); + } + ret = prelink_conflict_add_rela (info); if (ret == NULL) return 1; @@ -391,13 +510,39 @@ error (0, 0, "%s: R_ARM_PC24 overflow", dso->filename); return 1; } - value = read_ule32 (dso, rela->r_offset) & 0xff000000; + value = read_une32 (dso, rela->r_offset) & 0xff000000; ret->r_addend = (Elf32_Sword) (value | (val & 0xffffff)); ret->r_info = GELF_R_INFO (0, R_ARM_ABS32); break; case R_ARM_COPY: error (0, 0, "R_ARM_COPY should not be present in shared libraries"); return 1; + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_DTPOFF32: + case R_ARM_TLS_TPOFF32: + if (conflict != NULL + && (conflict->reloc_class != RTYPE_CLASS_TLS + || conflict->lookup.tls == NULL)) + { + error (0, 0, "%s: TLS reloc not resolving to STT_TLS symbol", + dso->filename); + return 1; + } + tls = conflict ? conflict->lookup.tls : info->curtls; + ret->r_info = GELF_R_INFO (0, R_ARM_ABS32); + switch (GELF_R_TYPE (rela->r_info)) + { + case R_ARM_TLS_DTPMOD32: + ret->r_addend = tls->modid; + break; + case R_ARM_TLS_DTPOFF32: + ret->r_addend = value; + break; + case R_ARM_TLS_TPOFF32: + ret->r_addend = value + rela->r_addend + tls->offset; + break; + } + break; default: error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, (int) GELF_R_TYPE (rela->r_info)); @@ -418,14 +563,17 @@ abort (); case R_ARM_RELATIVE: case R_ARM_ABS32: - rela->r_addend = (Elf32_Sword) read_ule32 (dso, rel->r_offset); + case R_ARM_TLS_TPOFF32: + rela->r_addend = (Elf32_Sword) read_une32 (dso, rel->r_offset); break; case R_ARM_PC24: - rela->r_addend = read_ule32 (dso, rel->r_offset) << 8; + rela->r_addend = read_une32 (dso, rel->r_offset) << 8; rela->r_addend = ((Elf32_Sword) rela->r_addend) >> 6; break; case R_ARM_COPY: case R_ARM_GLOB_DAT: + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_DTPOFF32: rela->r_addend = 0; break; } @@ -445,15 +593,18 @@ abort (); case R_ARM_RELATIVE: case R_ARM_ABS32: - write_le32 (dso, rela->r_offset, rela->r_addend); + case R_ARM_TLS_TPOFF32: + write_ne32 (dso, rela->r_offset, rela->r_addend); break; case R_ARM_PC24: - write_le32 (dso, rela->r_offset, - (read_ule32 (dso, rela->r_offset) & 0xff000000) + write_ne32 (dso, rela->r_offset, + (read_une32 (dso, rela->r_offset) & 0xff000000) | ((rela->r_addend >> 2) & 0xffffff)); break; case R_ARM_GLOB_DAT: - write_le32 (dso, rela->r_offset, 0); + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_DTPOFF32: + write_ne32 (dso, rela->r_offset, 0); break; } return 0; @@ -479,7 +630,7 @@ switch (ELF32_R_TYPE (rel->r_info)) { case R_ARM_ABS32: - val = read_ule32 (dso, rel->r_offset); + val = read_une32 (dso, rel->r_offset); /* R_ARM_ABS32 with addend 0 can be converted to R_ARM_GLOB_DAT and we don't have to convert to RELA because of that. */ @@ -488,6 +639,14 @@ /* FALLTHROUGH */ case R_ARM_PC24: return 1; + case R_ARM_TLS_TPOFF32: + /* In shared libraries TPOFF is changed always into + conflicts, for executables we need to preserve + original addend. */ + if (dso->ehdr.e_type == ET_EXEC) + return 1; + + break; } } } @@ -521,7 +680,7 @@ if (i == dso->ehdr.e_shnum) return 0; data = dso->shdr[i].sh_addr; - write_le32 (dso, dso->info[DT_PLTGOT] + 4, data); + write_ne32 (dso, dso->info[DT_PLTGOT] + 4, data); } return 0; @@ -550,9 +709,9 @@ if (i == dso->ehdr.e_shnum) return 0; - data = read_ule32 (dso, dso->info[DT_PLTGOT] + 4); + data = read_une32 (dso, dso->info[DT_PLTGOT] + 4); if (data == dso->shdr[i].sh_addr) - write_le32 (dso, dso->info[DT_PLTGOT] + 4, 0); + write_ne32 (dso, dso->info[DT_PLTGOT] + 4, 0); } return 0; @@ -580,17 +739,17 @@ } else { - Elf32_Addr data = read_ule32 (dso, dso->shdr[sec].sh_addr + 4); + Elf32_Addr data = read_une32 (dso, dso->shdr[sec].sh_addr + 4); assert (rel->r_offset >= dso->shdr[sec].sh_addr + 12); assert (((rel->r_offset - dso->shdr[sec].sh_addr) & 3) == 0); - write_le32 (dso, rel->r_offset, data); + write_ne32 (dso, rel->r_offset, data); } break; case R_ARM_GLOB_DAT: sec = addr_to_sec (dso, rel->r_offset); - write_le32 (dso, rel->r_offset, 0); + write_ne32 (dso, rel->r_offset, 0); if (sec != -1) { if (strcmp (strptr (dso, dso->ehdr.e_shstrndx, @@ -614,6 +773,12 @@ return 0; error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename); return 1; + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_DTPOFF32: + write_ne32 (dso, rel->r_offset, 0); + break; + case R_ARM_TLS_TPOFF32: + break; default: error (0, 0, "%s: Unknown arm relocation type %d", dso->filename, (int) GELF_R_TYPE (rel->r_info)); @@ -636,6 +801,10 @@ { case R_ARM_COPY: return RTYPE_CLASS_COPY; case R_ARM_JUMP_SLOT: return RTYPE_CLASS_PLT; + case R_ARM_TLS_DTPMOD32: + case R_ARM_TLS_DTPOFF32: + case R_ARM_TLS_TPOFF32: + return RTYPE_CLASS_TLS; default: return RTYPE_CLASS_VALID; } } @@ -648,6 +817,7 @@ .R_JMP_SLOT = R_ARM_JUMP_SLOT, .R_COPY = R_ARM_COPY, .R_RELATIVE = R_ARM_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld-linux.so.2", .adjust_dyn = arm_adjust_dyn, .adjust_rel = arm_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-cris.c prelink-0.0.20090311/src/arch-cris.c --- prelink-0.0.20071009/src/arch-cris.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-cris.c 2009-03-10 12:54:08.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -375,6 +375,7 @@ .R_JUMP_SLOT = R_CRIS_JUMP_SLOT, .R_COPY = R_CRIS_COPY, .R_RELATIVE = R_CRIS_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld.so.1", .adjust_dyn = cris_adjust_dyn, .adjust_rel = cris_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-i386.c prelink-0.0.20090311/src/arch-i386.c --- prelink-0.0.20071009/src/arch-i386.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-i386.c 2009-03-10 12:54:17.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -1052,6 +1052,7 @@ .R_JMP_SLOT = R_386_JMP_SLOT, .R_COPY = R_386_COPY, .R_RELATIVE = R_386_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld-linux.so.2", .adjust_dyn = i386_adjust_dyn, .adjust_rel = i386_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-ia64.c prelink-0.0.20090311/src/arch-ia64.c --- prelink-0.0.20071009/src/arch-ia64.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-ia64.c 2009-03-10 12:54:25.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -493,6 +493,7 @@ .R_JMP_SLOT = R_IA64_IPLTLSB, .R_COPY = -1, .R_RELATIVE = R_IA64_REL64LSB, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld-linux-ia64.so.2", .adjust_dyn = ia64_adjust_dyn, .adjust_rel = ia64_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-mips.c prelink-0.0.20090311/src/arch-mips.c --- prelink-0.0.20071009/src/arch-mips.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-mips.c 2009-03-10 12:54:45.000000000 -0500 @@ -999,6 +999,7 @@ /* R_MIPS_REL32 relocations against symbol 0 do act as relative relocs, but those against other symbols don't. */ .R_RELATIVE = ~0U, + .rtype_class_valid = RTYPE_CLASS_VALID, .arch_adjust = mips_arch_adjust, .adjust_dyn = mips_adjust_dyn, .adjust_rel = mips_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-ppc64.c prelink-0.0.20090311/src/arch-ppc64.c --- prelink-0.0.20071009/src/arch-ppc64.c 2006-08-13 10:18:17.000000000 -0500 +++ prelink-0.0.20090311/src/arch-ppc64.c 2009-03-10 12:55:48.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2002, 2003, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2002. This program is free software; you can redistribute it and/or modify @@ -771,13 +771,12 @@ { switch (reloc_type) { - case R_PPC64_COPY: return RTYPE_CLASS_COPY; - case R_PPC64_ADDR24: return RTYPE_CLASS_PLT; + case R_PPC64_COPY: return RTYPE_CLASS_COPY | RTYPE_CLASS_PLT; default: if (reloc_type >= R_PPC64_DTPMOD64 && reloc_type <= R_PPC64_TPREL16_HIGHESTA) return RTYPE_CLASS_TLS; - return RTYPE_CLASS_VALID; + return RTYPE_CLASS_PLT; } } @@ -824,6 +823,7 @@ .R_JMP_SLOT = R_PPC64_JMP_SLOT, .R_COPY = R_PPC64_COPY, .R_RELATIVE = R_PPC64_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_PLT, .dynamic_linker = "/lib64/ld64.so.1", .adjust_section = ppc64_adjust_section, .adjust_dyn = ppc64_adjust_dyn, diff -Nru prelink-0.0.20071009/src/arch-ppc.c prelink-0.0.20090311/src/arch-ppc.c --- prelink-0.0.20071009/src/arch-ppc.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-ppc.c 2009-03-10 12:56:18.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -1122,6 +1122,7 @@ .R_JMP_SLOT = R_PPC_JMP_SLOT, .R_COPY = R_PPC_COPY, .R_RELATIVE = R_PPC_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld.so.1", .adjust_dyn = ppc_adjust_dyn, .adjust_rel = ppc_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-s390.c prelink-0.0.20090311/src/arch-s390.c --- prelink-0.0.20071009/src/arch-s390.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-s390.c 2009-03-10 12:56:26.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -482,6 +482,7 @@ .R_JMP_SLOT = R_390_JMP_SLOT, .R_COPY = R_390_COPY, .R_RELATIVE = R_390_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld.so.1", .adjust_dyn = s390_adjust_dyn, .adjust_rel = s390_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-s390x.c prelink-0.0.20090311/src/arch-s390x.c --- prelink-0.0.20071009/src/arch-s390x.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-s390x.c 2009-03-10 12:56:34.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -598,6 +598,7 @@ .R_JMP_SLOT = R_390_JMP_SLOT, .R_COPY = R_390_COPY, .R_RELATIVE = R_390_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld64.so.1", .adjust_dyn = s390x_adjust_dyn, .adjust_rel = s390x_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-sh.c prelink-0.0.20090311/src/arch-sh.c --- prelink-0.0.20071009/src/arch-sh.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-sh.c 2009-03-10 12:56:42.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -414,6 +414,7 @@ .R_JMP_SLOT = R_SH_JMP_SLOT, .R_COPY = R_SH_COPY, .R_RELATIVE = R_SH_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld-linux.so.2", .adjust_dyn = sh_adjust_dyn, .adjust_rel = sh_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-sparc64.c prelink-0.0.20090311/src/arch-sparc64.c --- prelink-0.0.20071009/src/arch-sparc64.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-sparc64.c 2009-03-10 12:56:52.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -232,6 +232,38 @@ (((value - rela->r_offset) >> 2) & 0x3fffffff) | (read_ube32 (dso, rela->r_offset) & 0xc0000000)); break; + case R_SPARC_TLS_DTPOFF64: + write_be64 (dso, rela->r_offset, value + rela->r_addend); + break; + /* DTPMOD64 and TPOFF64 is impossible to predict in shared libraries + unless prelink sets the rules. */ + case R_SPARC_TLS_DTPMOD64: + if (dso->ehdr.e_type == ET_EXEC) + { + error (0, 0, "%s: R_SPARC_TLS_DTPMOD64 reloc in executable?", + dso->filename); + return 1; + } + break; + case R_SPARC_TLS_TPOFF64: + if (dso->ehdr.e_type == ET_EXEC && info->resolvetls) + write_be64 (dso, rela->r_offset, + value + rela->r_addend - info->resolvetls->offset); + break; + case R_SPARC_TLS_LE_HIX22: + if (dso->ehdr.e_type == ET_EXEC && info->resolvetls) + write_be32 (dso, rela->r_offset, + (read_ube32 (dso, rela->r_offset) & 0xffc00000) + | (((~(value + rela->r_addend - info->resolvetls->offset)) + >> 10) & 0x3fffff)); + break; + case R_SPARC_TLS_LE_LOX10: + if (dso->ehdr.e_type == ET_EXEC && info->resolvetls) + write_be32 (dso, rela->r_offset, + (read_ube32 (dso, rela->r_offset) & 0xffffe000) | 0x1c00 + | ((value + rela->r_addend - info->resolvetls->offset) + & 0x3ff)); + break; case R_SPARC_H44: write_be32 (dso, rela->r_offset, ((value >> 22) & 0x3fffff) @@ -405,6 +437,7 @@ { GElf_Addr value; struct prelink_conflict *conflict; + struct prelink_tls *tls; GElf_Rela *ret; int r_type; @@ -415,8 +448,33 @@ conflict = prelink_conflict (info, GELF_R_SYM (rela->r_info), SPARC64_R_TYPE (rela->r_info)); if (conflict == NULL) - return 0; - value = conflict_lookup_value (conflict); + { + if (info->curtls == NULL) + return 0; + switch (SPARC64_R_TYPE (rela->r_info)) + { + /* Even local DTPMOD64 and TPOFF64 relocs need conflicts. */ + case R_SPARC_TLS_DTPMOD64: + case R_SPARC_TLS_TPOFF64: + case R_SPARC_TLS_LE_HIX22: + case R_SPARC_TLS_LE_LOX10: + break; + default: + return 0; + } + value = 0; + } + else + { + /* DTPOFF64 wants to see only real conflicts, not lookups + with reloc_class RTYPE_CLASS_TLS. */ + if (SPARC64_R_TYPE (rela->r_info) == R_SPARC_TLS_DTPOFF64 + && conflict->lookup.tls == conflict->conflict.tls + && conflict->lookupval == conflict->conflictval) + return 0; + + value = conflict_lookup_value (conflict); + } ret = prelink_conflict_add_rela (info); if (ret == NULL) return 1; @@ -500,6 +558,47 @@ case R_SPARC_UA32: case R_SPARC_UA64: break; + case R_SPARC_TLS_DTPMOD64: + case R_SPARC_TLS_DTPOFF64: + case R_SPARC_TLS_TPOFF64: + case R_SPARC_TLS_LE_HIX22: + case R_SPARC_TLS_LE_LOX10: + if (conflict != NULL + && (conflict->reloc_class != RTYPE_CLASS_TLS + || conflict->lookup.tls == NULL)) + { + error (0, 0, "%s: TLS reloc not resolving to STT_TLS symbol", + dso->filename); + return 1; + } + tls = conflict ? conflict->lookup.tls : info->curtls; + switch (r_type) + { + case R_SPARC_TLS_DTPMOD64: + r_type = R_SPARC_64; + value = tls->modid; + break; + case R_SPARC_TLS_DTPOFF64: + r_type = R_SPARC_64; + break; + case R_SPARC_TLS_TPOFF64: + r_type = R_SPARC_64; + value -= tls->offset; + break; + case R_SPARC_TLS_LE_HIX22: + r_type = R_SPARC_32; + value -= tls->offset; + value = (read_ube32 (dso, rela->r_offset) & 0xffc00000) + | (((~value) >> 10) & 0x3fffff); + break; + case R_SPARC_TLS_LE_LOX10: + r_type = R_SPARC_32; + value -= tls->offset; + value = (read_ube32 (dso, rela->r_offset) & 0xffffe000) | 0x1c00 + | (value & 0x3ff); + break; + } + break; default: error (0, 0, "%s: Unknown Sparc relocation type %d", dso->filename, r_type); @@ -582,6 +681,9 @@ case R_SPARC_64: case R_SPARC_UA64: case R_SPARC_DISP64: + case R_SPARC_TLS_DTPMOD64: + case R_SPARC_TLS_DTPOFF64: + case R_SPARC_TLS_TPOFF64: write_be64 (dso, rela->r_offset, 0); break; case R_SPARC_32: @@ -635,6 +737,14 @@ write_be32 (dso, rela->r_offset, read_ube32 (dso, rela->r_offset) & ~0x1fff); break; + case R_SPARC_TLS_LE_LOX10: + write_be32 (dso, rela->r_offset, + read_ube32 (dso, rela->r_offset) & 0xffffe000); + break; + case R_SPARC_TLS_LE_HIX22: + write_be32 (dso, rela->r_offset, + read_ube32 (dso, rela->r_offset) & 0xffc00000); + break; case R_SPARC_COPY: if (dso->ehdr.e_type == ET_EXEC) /* COPY relocs are handled specially in generic code. */ @@ -679,6 +789,12 @@ { case R_SPARC_COPY: return RTYPE_CLASS_COPY; case R_SPARC_JMP_SLOT: return RTYPE_CLASS_PLT; + case R_SPARC_TLS_DTPMOD64: + case R_SPARC_TLS_DTPOFF64: + case R_SPARC_TLS_TPOFF64: + case R_SPARC_TLS_LE_HIX22: + case R_SPARC_TLS_LE_LOX10: + return RTYPE_CLASS_TLS; default: return RTYPE_CLASS_VALID; } } @@ -691,6 +807,7 @@ .R_JMP_SLOT = R_SPARC_JMP_SLOT, .R_COPY = R_SPARC_COPY, .R_RELATIVE = R_SPARC_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib64/ld-linux.so.2", .adjust_dyn = sparc64_adjust_dyn, .adjust_rel = sparc64_adjust_rel, @@ -709,17 +826,17 @@ .max_reloc_size = 8, .arch_prelink = sparc64_arch_prelink, .undo_prelink_rela = sparc64_undo_prelink_rela, - /* Although TASK_UNMAPPED_BASE is 0xfffff80000000000, we leave some + /* Although TASK_UNMAPPED_BASE is 0xfffff80100000000, we leave some area so that mmap of /etc/ld.so.cache and ld.so's malloc does not take some library's VA slot. Also, if this guard area isn't too small, typically even dlopened libraries will get the slots they desire. */ - .mmap_base = 0xfffff80001000000LL, + .mmap_base = 0xfffff80101000000LL, /* If we need yet more space for shared libraries, we can of course expand, but limiting all DSOs into 4 GB means stack overflows jumping to shared library functions is much harder (there is '\0' byte in the address before the bytes that matter). */ - .mmap_end = 0xfffff80100000000LL, + .mmap_end = 0xfffff80200000000LL, .max_page_size = 0x100000, .page_size = 0x2000 }; diff -Nru prelink-0.0.20071009/src/arch-sparc.c prelink-0.0.20090311/src/arch-sparc.c --- prelink-0.0.20071009/src/arch-sparc.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-sparc.c 2009-03-10 12:57:01.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -607,6 +607,7 @@ .R_JMP_SLOT = R_SPARC_JMP_SLOT, .R_COPY = R_SPARC_COPY, .R_RELATIVE = R_SPARC_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib/ld-linux.so.2", .adjust_dyn = sparc_adjust_dyn, .adjust_rel = sparc_adjust_rel, diff -Nru prelink-0.0.20071009/src/arch-x86_64.c prelink-0.0.20090311/src/arch-x86_64.c --- prelink-0.0.20071009/src/arch-x86_64.c 2006-12-01 12:21:24.000000000 -0600 +++ prelink-0.0.20090311/src/arch-x86_64.c 2009-03-10 12:57:09.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004, 2006 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2006, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -505,6 +505,7 @@ .R_JMP_SLOT = R_X86_64_JUMP_SLOT, .R_COPY = R_X86_64_COPY, .R_RELATIVE = R_X86_64_RELATIVE, + .rtype_class_valid = RTYPE_CLASS_VALID, .dynamic_linker = "/lib64/ld-linux-x86-64.so.2", .adjust_dyn = x86_64_adjust_dyn, .adjust_rel = x86_64_adjust_rel, diff -Nru prelink-0.0.20071009/src/cxx.c prelink-0.0.20090311/src/cxx.c --- prelink-0.0.20071009/src/cxx.c 2007-10-09 12:00:08.000000000 -0500 +++ prelink-0.0.20090311/src/cxx.c 2009-03-11 04:39:21.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2007 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2007, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -307,6 +307,7 @@ struct find_cxx_sym_cache **cache; struct find_cxx_sym_cache *binsymcache = NULL; int ret = 0; + int rtype_class_valid; /* Don't bother doing this for non-C++ programs. */ for (i = 0; i < info->ent->ndepends; ++i) @@ -324,6 +325,8 @@ assert (elf_getdata (scn, binsymtab) == NULL); } + rtype_class_valid = info->dso->arch->rtype_class_valid; + state = 0; memset (&fcs1, 0, sizeof (fcs1)); memset (&fcs2, 0, sizeof (fcs2)); @@ -401,7 +404,7 @@ for (conflict = info->conflicts[fcs1.n].hash[cidx]; conflict; conflict = conflict->next) if (conflict->symoff == symoff - && conflict->reloc_class == RTYPE_CLASS_VALID) + && conflict->reloc_class == rtype_class_valid) break; if (conflict == NULL) @@ -558,7 +561,7 @@ for (l = 0; l < 251; l++) for (conflict = info->conflicts[fcs1.n].hash[l]; conflict; conflict = conflict->next) - if (conflict->reloc_class == RTYPE_CLASS_VALID + if (conflict->reloc_class == rtype_class_valid && conflict->conflict.ent) { size_t ccidx @@ -595,7 +598,7 @@ && conflict->conflict.ent && (conflict->conflict.ent->base + conflict->conflictval == s->u.ent->base + s->value) - && conflict->reloc_class == RTYPE_CLASS_VALID) + && conflict->reloc_class == rtype_class_valid) { pltref_remove: if (verbose > 3) diff -Nru prelink-0.0.20071009/src/gather.c prelink-0.0.20090311/src/gather.c --- prelink-0.0.20071009/src/gather.c 2007-10-08 09:37:16.000000000 -0500 +++ prelink-0.0.20090311/src/gather.c 2008-10-09 15:31:03.000000000 -0500 @@ -1004,6 +1004,8 @@ ++implicit; ret = nftw64 (name, gather_func, 20, flags | FTW_ACTIONRETVAL); --implicit; + if (ret < 0) + error (0, errno, "Failed searching %s", name); #ifndef HAVE_FTW_ACTIONRETVAL free (blacklist_dir); blacklist_dir = NULL; diff -Nru prelink-0.0.20071009/src/get.c prelink-0.0.20090311/src/get.c --- prelink-0.0.20071009/src/get.c 2007-10-09 08:43:19.000000000 -0500 +++ prelink-0.0.20090311/src/get.c 2009-03-10 13:16:44.000000000 -0500 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -275,7 +275,12 @@ if (type) reloc_class = dso->arch->reloc_class (reloc_class); else - reloc_class |= RTYPE_CLASS_VALID; + { + if ((reloc_class | RTYPE_CLASS_VALID) == RTYPE_CLASS_TLS) + reloc_class |= RTYPE_CLASS_VALID; + else + reloc_class |= dso->arch->rtype_class_valid; + } while (*symname == ' ' || *symname == '\t') ++symname; @@ -452,7 +457,12 @@ if (type) reloc_class = dso->arch->reloc_class (reloc_class); else - reloc_class |= RTYPE_CLASS_VALID; + { + if ((reloc_class | RTYPE_CLASS_VALID) == RTYPE_CLASS_TLS) + reloc_class |= RTYPE_CLASS_VALID; + else + reloc_class |= dso->arch->rtype_class_valid; + } while (*symname == ' ' || *symname == '\t') ++symname; diff -Nru prelink-0.0.20071009/src/P prelink-0.0.20090311/src/P --- prelink-0.0.20071009/src/P 1969-12-31 18:00:00.000000000 -0600 +++ prelink-0.0.20090311/src/P 2009-03-10 13:06:42.000000000 -0500 @@ -0,0 +1,277 @@ +--- prelink/src/arch-ppc.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-ppc.c 2009-03-10 18:56:18.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -1122,6 +1122,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_PPC_JMP_SLOT, + .R_COPY = R_PPC_COPY, + .R_RELATIVE = R_PPC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = ppc_adjust_dyn, + .adjust_rel = ppc_adjust_rel, +--- prelink/src/arch-arm.c.jj 2009-03-10 15:36:55.000000000 +0100 ++++ prelink/src/arch-arm.c 2009-03-10 18:53:58.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -817,6 +817,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_ARM_JUMP_SLOT, + .R_COPY = R_ARM_COPY, + .R_RELATIVE = R_ARM_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = arm_adjust_dyn, + .adjust_rel = arm_adjust_rel, +--- prelink/src/arch-sparc64.c.jj 2008-10-09 22:36:07.000000000 +0200 ++++ prelink/src/arch-sparc64.c 2009-03-10 18:56:52.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -807,6 +807,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SPARC_JMP_SLOT, + .R_COPY = R_SPARC_COPY, + .R_RELATIVE = R_SPARC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib64/ld-linux.so.2", + .adjust_dyn = sparc64_adjust_dyn, + .adjust_rel = sparc64_adjust_rel, +--- prelink/src/arch-alpha.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-alpha.c 2009-03-10 18:53:47.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -467,6 +467,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_ALPHA_JMP_SLOT, + .R_COPY = -1, + .R_RELATIVE = R_ALPHA_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = alpha_adjust_dyn, + .adjust_rel = alpha_adjust_rel, +--- prelink/src/arch-cris.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-cris.c 2009-03-10 18:54:08.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -375,6 +375,7 @@ PL_ARCH = { + .R_JUMP_SLOT = R_CRIS_JUMP_SLOT, + .R_COPY = R_CRIS_COPY, + .R_RELATIVE = R_CRIS_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = cris_adjust_dyn, + .adjust_rel = cris_adjust_rel, +--- prelink/src/arch-s390x.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-s390x.c 2009-03-10 18:56:34.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -598,6 +598,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_390_JMP_SLOT, + .R_COPY = R_390_COPY, + .R_RELATIVE = R_390_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld64.so.1", + .adjust_dyn = s390x_adjust_dyn, + .adjust_rel = s390x_adjust_rel, +--- prelink/src/arch-ia64.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-ia64.c 2009-03-10 18:54:25.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -493,6 +493,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_IA64_IPLTLSB, + .R_COPY = -1, + .R_RELATIVE = R_IA64_REL64LSB, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux-ia64.so.2", + .adjust_dyn = ia64_adjust_dyn, + .adjust_rel = ia64_adjust_rel, +--- prelink/src/arch-ppc64.c.jj 2006-08-13 17:18:17.000000000 +0200 ++++ prelink/src/arch-ppc64.c 2009-03-10 18:55:48.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2002. + + This program is free software; you can redistribute it and/or modify +@@ -771,13 +771,12 @@ ppc64_reloc_class (int reloc_type) + { + switch (reloc_type) + { +- case R_PPC64_COPY: return RTYPE_CLASS_COPY; +- case R_PPC64_ADDR24: return RTYPE_CLASS_PLT; ++ case R_PPC64_COPY: return RTYPE_CLASS_COPY | RTYPE_CLASS_PLT; + default: + if (reloc_type >= R_PPC64_DTPMOD64 + && reloc_type <= R_PPC64_TPREL16_HIGHESTA) + return RTYPE_CLASS_TLS; +- return RTYPE_CLASS_VALID; ++ return RTYPE_CLASS_PLT; + } + } + +@@ -824,6 +823,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_PPC64_JMP_SLOT, + .R_COPY = R_PPC64_COPY, + .R_RELATIVE = R_PPC64_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_PLT, + .dynamic_linker = "/lib64/ld64.so.1", + .adjust_section = ppc64_adjust_section, + .adjust_dyn = ppc64_adjust_dyn, +--- prelink/src/get.c.jj 2007-10-09 15:43:19.000000000 +0200 ++++ prelink/src/get.c 2009-03-10 19:06:29.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -275,7 +275,7 @@ prelink_record_relocations (struct preli + if (type) + reloc_class = dso->arch->reloc_class (reloc_class); + else +- reloc_class |= RTYPE_CLASS_VALID; ++ reloc_class |= dso->arch->rtype_class_valid; + + while (*symname == ' ' || *symname == '\t') ++symname; + +@@ -452,7 +452,7 @@ prelink_record_relocations (struct preli + if (type) + reloc_class = dso->arch->reloc_class (reloc_class); + else +- reloc_class |= RTYPE_CLASS_VALID; ++ reloc_class |= dso->arch->rtype_class_valid; + + while (*symname == ' ' || *symname == '\t') ++symname; + +--- prelink/src/arch-s390.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-s390.c 2009-03-10 18:56:26.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -482,6 +482,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_390_JMP_SLOT, + .R_COPY = R_390_COPY, + .R_RELATIVE = R_390_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = s390_adjust_dyn, + .adjust_rel = s390_adjust_rel, +--- prelink/src/arch-i386.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-i386.c 2009-03-10 18:54:17.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -1052,6 +1052,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_386_JMP_SLOT, + .R_COPY = R_386_COPY, + .R_RELATIVE = R_386_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = i386_adjust_dyn, + .adjust_rel = i386_adjust_rel, +--- prelink/src/prelink.h.jj 2009-03-10 15:36:21.000000000 +0100 ++++ prelink/src/prelink.h 2009-03-10 18:48:19.000000000 +0100 +@@ -1,4 +1,5 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 ++ Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -159,6 +160,7 @@ struct PLArch + int R_COPY; + int R_JMP_SLOT; + int R_RELATIVE; ++ int rtype_class_valid; + int (*arch_adjust) (DSO *dso, GElf_Addr start, GElf_Addr adjust); + int (*adjust_section) (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust); + int (*adjust_dyn) (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start, +--- prelink/src/arch-sparc.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-sparc.c 2009-03-10 18:57:01.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -607,6 +607,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SPARC_JMP_SLOT, + .R_COPY = R_SPARC_COPY, + .R_RELATIVE = R_SPARC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = sparc_adjust_dyn, + .adjust_rel = sparc_adjust_rel, +--- prelink/src/arch-x86_64.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-x86_64.c 2009-03-10 18:57:09.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2006 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2006, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -505,6 +505,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_X86_64_JUMP_SLOT, + .R_COPY = R_X86_64_COPY, + .R_RELATIVE = R_X86_64_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib64/ld-linux-x86-64.so.2", + .adjust_dyn = x86_64_adjust_dyn, + .adjust_rel = x86_64_adjust_rel, +--- prelink/src/arch-mips.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-mips.c 2009-03-10 18:54:45.000000000 +0100 +@@ -999,6 +999,7 @@ PL_ARCH = { + /* R_MIPS_REL32 relocations against symbol 0 do act as relative relocs, + but those against other symbols don't. */ + .R_RELATIVE = ~0U, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .arch_adjust = mips_arch_adjust, + .adjust_dyn = mips_adjust_dyn, + .adjust_rel = mips_adjust_rel, +--- prelink/src/arch-sh.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-sh.c 2009-03-10 18:56:42.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -414,6 +414,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SH_JMP_SLOT, + .R_COPY = R_SH_COPY, + .R_RELATIVE = R_SH_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = sh_adjust_dyn, + .adjust_rel = sh_adjust_rel, diff -Nru prelink-0.0.20071009/src/P2 prelink-0.0.20090311/src/P2 --- prelink-0.0.20071009/src/P2 1969-12-31 18:00:00.000000000 -0600 +++ prelink-0.0.20090311/src/P2 2009-03-10 13:17:09.000000000 -0500 @@ -0,0 +1,287 @@ +--- prelink/src/arch-ppc.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-ppc.c 2009-03-10 18:56:18.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -1122,6 +1122,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_PPC_JMP_SLOT, + .R_COPY = R_PPC_COPY, + .R_RELATIVE = R_PPC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = ppc_adjust_dyn, + .adjust_rel = ppc_adjust_rel, +--- prelink/src/arch-arm.c.jj 2009-03-10 15:36:55.000000000 +0100 ++++ prelink/src/arch-arm.c 2009-03-10 18:53:58.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -817,6 +817,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_ARM_JUMP_SLOT, + .R_COPY = R_ARM_COPY, + .R_RELATIVE = R_ARM_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = arm_adjust_dyn, + .adjust_rel = arm_adjust_rel, +--- prelink/src/arch-sparc64.c.jj 2008-10-09 22:36:07.000000000 +0200 ++++ prelink/src/arch-sparc64.c 2009-03-10 18:56:52.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -807,6 +807,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SPARC_JMP_SLOT, + .R_COPY = R_SPARC_COPY, + .R_RELATIVE = R_SPARC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib64/ld-linux.so.2", + .adjust_dyn = sparc64_adjust_dyn, + .adjust_rel = sparc64_adjust_rel, +--- prelink/src/arch-alpha.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-alpha.c 2009-03-10 18:53:47.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -467,6 +467,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_ALPHA_JMP_SLOT, + .R_COPY = -1, + .R_RELATIVE = R_ALPHA_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = alpha_adjust_dyn, + .adjust_rel = alpha_adjust_rel, +--- prelink/src/arch-cris.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-cris.c 2009-03-10 18:54:08.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -375,6 +375,7 @@ PL_ARCH = { + .R_JUMP_SLOT = R_CRIS_JUMP_SLOT, + .R_COPY = R_CRIS_COPY, + .R_RELATIVE = R_CRIS_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = cris_adjust_dyn, + .adjust_rel = cris_adjust_rel, +--- prelink/src/arch-s390x.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-s390x.c 2009-03-10 18:56:34.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -598,6 +598,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_390_JMP_SLOT, + .R_COPY = R_390_COPY, + .R_RELATIVE = R_390_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld64.so.1", + .adjust_dyn = s390x_adjust_dyn, + .adjust_rel = s390x_adjust_rel, +--- prelink/src/arch-ia64.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-ia64.c 2009-03-10 18:54:25.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -493,6 +493,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_IA64_IPLTLSB, + .R_COPY = -1, + .R_RELATIVE = R_IA64_REL64LSB, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux-ia64.so.2", + .adjust_dyn = ia64_adjust_dyn, + .adjust_rel = ia64_adjust_rel, +--- prelink/src/arch-ppc64.c.jj 2006-08-13 17:18:17.000000000 +0200 ++++ prelink/src/arch-ppc64.c 2009-03-10 18:55:48.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2002. + + This program is free software; you can redistribute it and/or modify +@@ -771,13 +771,12 @@ ppc64_reloc_class (int reloc_type) + { + switch (reloc_type) + { +- case R_PPC64_COPY: return RTYPE_CLASS_COPY; +- case R_PPC64_ADDR24: return RTYPE_CLASS_PLT; ++ case R_PPC64_COPY: return RTYPE_CLASS_COPY | RTYPE_CLASS_PLT; + default: + if (reloc_type >= R_PPC64_DTPMOD64 + && reloc_type <= R_PPC64_TPREL16_HIGHESTA) + return RTYPE_CLASS_TLS; +- return RTYPE_CLASS_VALID; ++ return RTYPE_CLASS_PLT; + } + } + +@@ -824,6 +823,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_PPC64_JMP_SLOT, + .R_COPY = R_PPC64_COPY, + .R_RELATIVE = R_PPC64_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_PLT, + .dynamic_linker = "/lib64/ld64.so.1", + .adjust_section = ppc64_adjust_section, + .adjust_dyn = ppc64_adjust_dyn, +--- prelink/src/get.c.jj 2007-10-09 15:43:19.000000000 +0200 ++++ prelink/src/get.c 2009-03-10 19:16:44.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -275,7 +275,12 @@ prelink_record_relocations (struct preli + if (type) + reloc_class = dso->arch->reloc_class (reloc_class); + else +- reloc_class |= RTYPE_CLASS_VALID; ++ { ++ if ((reloc_class | RTYPE_CLASS_VALID) == RTYPE_CLASS_TLS) ++ reloc_class |= RTYPE_CLASS_VALID; ++ else ++ reloc_class |= dso->arch->rtype_class_valid; ++ } + + while (*symname == ' ' || *symname == '\t') ++symname; + +@@ -452,7 +457,12 @@ prelink_record_relocations (struct preli + if (type) + reloc_class = dso->arch->reloc_class (reloc_class); + else +- reloc_class |= RTYPE_CLASS_VALID; ++ { ++ if ((reloc_class | RTYPE_CLASS_VALID) == RTYPE_CLASS_TLS) ++ reloc_class |= RTYPE_CLASS_VALID; ++ else ++ reloc_class |= dso->arch->rtype_class_valid; ++ } + + while (*symname == ' ' || *symname == '\t') ++symname; + +--- prelink/src/arch-s390.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-s390.c 2009-03-10 18:56:26.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -482,6 +482,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_390_JMP_SLOT, + .R_COPY = R_390_COPY, + .R_RELATIVE = R_390_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = s390_adjust_dyn, + .adjust_rel = s390_adjust_rel, +--- prelink/src/arch-i386.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-i386.c 2009-03-10 18:54:17.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -1052,6 +1052,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_386_JMP_SLOT, + .R_COPY = R_386_COPY, + .R_RELATIVE = R_386_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = i386_adjust_dyn, + .adjust_rel = i386_adjust_rel, +--- prelink/src/prelink.h.jj 2009-03-10 15:36:21.000000000 +0100 ++++ prelink/src/prelink.h 2009-03-10 18:48:19.000000000 +0100 +@@ -1,4 +1,5 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 ++ Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -159,6 +160,7 @@ struct PLArch + int R_COPY; + int R_JMP_SLOT; + int R_RELATIVE; ++ int rtype_class_valid; + int (*arch_adjust) (DSO *dso, GElf_Addr start, GElf_Addr adjust); + int (*adjust_section) (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust); + int (*adjust_dyn) (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start, +--- prelink/src/arch-sparc.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-sparc.c 2009-03-10 18:57:01.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -607,6 +607,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SPARC_JMP_SLOT, + .R_COPY = R_SPARC_COPY, + .R_RELATIVE = R_SPARC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = sparc_adjust_dyn, + .adjust_rel = sparc_adjust_rel, +--- prelink/src/arch-x86_64.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-x86_64.c 2009-03-10 18:57:09.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2006 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2006, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -505,6 +505,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_X86_64_JUMP_SLOT, + .R_COPY = R_X86_64_COPY, + .R_RELATIVE = R_X86_64_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib64/ld-linux-x86-64.so.2", + .adjust_dyn = x86_64_adjust_dyn, + .adjust_rel = x86_64_adjust_rel, +--- prelink/src/arch-mips.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-mips.c 2009-03-10 18:54:45.000000000 +0100 +@@ -999,6 +999,7 @@ PL_ARCH = { + /* R_MIPS_REL32 relocations against symbol 0 do act as relative relocs, + but those against other symbols don't. */ + .R_RELATIVE = ~0U, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .arch_adjust = mips_arch_adjust, + .adjust_dyn = mips_adjust_dyn, + .adjust_rel = mips_adjust_rel, +--- prelink/src/arch-sh.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-sh.c 2009-03-10 18:56:42.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -414,6 +414,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SH_JMP_SLOT, + .R_COPY = R_SH_COPY, + .R_RELATIVE = R_SH_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = sh_adjust_dyn, + .adjust_rel = sh_adjust_rel, diff -Nru prelink-0.0.20071009/src/P3 prelink-0.0.20090311/src/P3 --- prelink-0.0.20071009/src/P3 1969-12-31 18:00:00.000000000 -0600 +++ prelink-0.0.20090311/src/P3 2009-03-11 04:39:51.000000000 -0500 @@ -0,0 +1,339 @@ +--- prelink/src/arch-ppc.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-ppc.c 2009-03-10 18:56:18.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -1122,6 +1122,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_PPC_JMP_SLOT, + .R_COPY = R_PPC_COPY, + .R_RELATIVE = R_PPC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = ppc_adjust_dyn, + .adjust_rel = ppc_adjust_rel, +--- prelink/src/arch-arm.c.jj 2009-03-10 15:36:55.000000000 +0100 ++++ prelink/src/arch-arm.c 2009-03-10 18:53:58.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -817,6 +817,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_ARM_JUMP_SLOT, + .R_COPY = R_ARM_COPY, + .R_RELATIVE = R_ARM_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = arm_adjust_dyn, + .adjust_rel = arm_adjust_rel, +--- prelink/src/arch-sparc64.c.jj 2008-10-09 22:36:07.000000000 +0200 ++++ prelink/src/arch-sparc64.c 2009-03-10 18:56:52.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -807,6 +807,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SPARC_JMP_SLOT, + .R_COPY = R_SPARC_COPY, + .R_RELATIVE = R_SPARC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib64/ld-linux.so.2", + .adjust_dyn = sparc64_adjust_dyn, + .adjust_rel = sparc64_adjust_rel, +--- prelink/src/arch-alpha.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-alpha.c 2009-03-10 18:53:47.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -467,6 +467,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_ALPHA_JMP_SLOT, + .R_COPY = -1, + .R_RELATIVE = R_ALPHA_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = alpha_adjust_dyn, + .adjust_rel = alpha_adjust_rel, +--- prelink/src/arch-cris.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-cris.c 2009-03-10 18:54:08.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -375,6 +375,7 @@ PL_ARCH = { + .R_JUMP_SLOT = R_CRIS_JUMP_SLOT, + .R_COPY = R_CRIS_COPY, + .R_RELATIVE = R_CRIS_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = cris_adjust_dyn, + .adjust_rel = cris_adjust_rel, +--- prelink/src/cxx.c.jj 2007-10-09 19:00:08.000000000 +0200 ++++ prelink/src/cxx.c 2009-03-11 10:39:21.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2007 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2007, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -307,6 +307,7 @@ remove_redundant_cxx_conflicts (struct p + struct find_cxx_sym_cache **cache; + struct find_cxx_sym_cache *binsymcache = NULL; + int ret = 0; ++ int rtype_class_valid; + + /* Don't bother doing this for non-C++ programs. */ + for (i = 0; i < info->ent->ndepends; ++i) +@@ -324,6 +325,8 @@ remove_redundant_cxx_conflicts (struct p + assert (elf_getdata (scn, binsymtab) == NULL); + } + ++ rtype_class_valid = info->dso->arch->rtype_class_valid; ++ + state = 0; + memset (&fcs1, 0, sizeof (fcs1)); + memset (&fcs2, 0, sizeof (fcs2)); +@@ -401,7 +404,7 @@ remove_redundant_cxx_conflicts (struct p + for (conflict = info->conflicts[fcs1.n].hash[cidx]; conflict; + conflict = conflict->next) + if (conflict->symoff == symoff +- && conflict->reloc_class == RTYPE_CLASS_VALID) ++ && conflict->reloc_class == rtype_class_valid) + break; + + if (conflict == NULL) +@@ -558,7 +561,7 @@ check_pltref: + for (l = 0; l < 251; l++) + for (conflict = info->conflicts[fcs1.n].hash[l]; + conflict; conflict = conflict->next) +- if (conflict->reloc_class == RTYPE_CLASS_VALID ++ if (conflict->reloc_class == rtype_class_valid + && conflict->conflict.ent) + { + size_t ccidx +@@ -595,7 +598,7 @@ check_pltref: + && conflict->conflict.ent + && (conflict->conflict.ent->base + + conflict->conflictval == s->u.ent->base + s->value) +- && conflict->reloc_class == RTYPE_CLASS_VALID) ++ && conflict->reloc_class == rtype_class_valid) + { + pltref_remove: + if (verbose > 3) +--- prelink/src/arch-s390x.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-s390x.c 2009-03-10 18:56:34.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -598,6 +598,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_390_JMP_SLOT, + .R_COPY = R_390_COPY, + .R_RELATIVE = R_390_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld64.so.1", + .adjust_dyn = s390x_adjust_dyn, + .adjust_rel = s390x_adjust_rel, +--- prelink/src/arch-ia64.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-ia64.c 2009-03-10 18:54:25.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -493,6 +493,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_IA64_IPLTLSB, + .R_COPY = -1, + .R_RELATIVE = R_IA64_REL64LSB, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux-ia64.so.2", + .adjust_dyn = ia64_adjust_dyn, + .adjust_rel = ia64_adjust_rel, +--- prelink/src/arch-ppc64.c.jj 2006-08-13 17:18:17.000000000 +0200 ++++ prelink/src/arch-ppc64.c 2009-03-10 18:55:48.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2002. + + This program is free software; you can redistribute it and/or modify +@@ -771,13 +771,12 @@ ppc64_reloc_class (int reloc_type) + { + switch (reloc_type) + { +- case R_PPC64_COPY: return RTYPE_CLASS_COPY; +- case R_PPC64_ADDR24: return RTYPE_CLASS_PLT; ++ case R_PPC64_COPY: return RTYPE_CLASS_COPY | RTYPE_CLASS_PLT; + default: + if (reloc_type >= R_PPC64_DTPMOD64 + && reloc_type <= R_PPC64_TPREL16_HIGHESTA) + return RTYPE_CLASS_TLS; +- return RTYPE_CLASS_VALID; ++ return RTYPE_CLASS_PLT; + } + } + +@@ -824,6 +823,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_PPC64_JMP_SLOT, + .R_COPY = R_PPC64_COPY, + .R_RELATIVE = R_PPC64_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_PLT, + .dynamic_linker = "/lib64/ld64.so.1", + .adjust_section = ppc64_adjust_section, + .adjust_dyn = ppc64_adjust_dyn, +--- prelink/src/get.c.jj 2007-10-09 15:43:19.000000000 +0200 ++++ prelink/src/get.c 2009-03-10 19:16:44.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -275,7 +275,12 @@ prelink_record_relocations (struct preli + if (type) + reloc_class = dso->arch->reloc_class (reloc_class); + else +- reloc_class |= RTYPE_CLASS_VALID; ++ { ++ if ((reloc_class | RTYPE_CLASS_VALID) == RTYPE_CLASS_TLS) ++ reloc_class |= RTYPE_CLASS_VALID; ++ else ++ reloc_class |= dso->arch->rtype_class_valid; ++ } + + while (*symname == ' ' || *symname == '\t') ++symname; + +@@ -452,7 +457,12 @@ prelink_record_relocations (struct preli + if (type) + reloc_class = dso->arch->reloc_class (reloc_class); + else +- reloc_class |= RTYPE_CLASS_VALID; ++ { ++ if ((reloc_class | RTYPE_CLASS_VALID) == RTYPE_CLASS_TLS) ++ reloc_class |= RTYPE_CLASS_VALID; ++ else ++ reloc_class |= dso->arch->rtype_class_valid; ++ } + + while (*symname == ' ' || *symname == '\t') ++symname; + +--- prelink/src/arch-s390.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-s390.c 2009-03-10 18:56:26.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -482,6 +482,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_390_JMP_SLOT, + .R_COPY = R_390_COPY, + .R_RELATIVE = R_390_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld.so.1", + .adjust_dyn = s390_adjust_dyn, + .adjust_rel = s390_adjust_rel, +--- prelink/src/arch-i386.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-i386.c 2009-03-10 18:54:17.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -1052,6 +1052,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_386_JMP_SLOT, + .R_COPY = R_386_COPY, + .R_RELATIVE = R_386_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = i386_adjust_dyn, + .adjust_rel = i386_adjust_rel, +--- prelink/src/prelink.h.jj 2009-03-10 15:36:21.000000000 +0100 ++++ prelink/src/prelink.h 2009-03-10 18:48:19.000000000 +0100 +@@ -1,4 +1,5 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 ++ Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -159,6 +160,7 @@ struct PLArch + int R_COPY; + int R_JMP_SLOT; + int R_RELATIVE; ++ int rtype_class_valid; + int (*arch_adjust) (DSO *dso, GElf_Addr start, GElf_Addr adjust); + int (*adjust_section) (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust); + int (*adjust_dyn) (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start, +--- prelink/src/arch-sparc.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-sparc.c 2009-03-10 18:57:01.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -607,6 +607,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SPARC_JMP_SLOT, + .R_COPY = R_SPARC_COPY, + .R_RELATIVE = R_SPARC_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = sparc_adjust_dyn, + .adjust_rel = sparc_adjust_rel, +--- prelink/src/arch-x86_64.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-x86_64.c 2009-03-10 18:57:09.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004, 2006 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2006, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -505,6 +505,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_X86_64_JUMP_SLOT, + .R_COPY = R_X86_64_COPY, + .R_RELATIVE = R_X86_64_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib64/ld-linux-x86-64.so.2", + .adjust_dyn = x86_64_adjust_dyn, + .adjust_rel = x86_64_adjust_rel, +--- prelink/src/arch-mips.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-mips.c 2009-03-10 18:54:45.000000000 +0100 +@@ -999,6 +999,7 @@ PL_ARCH = { + /* R_MIPS_REL32 relocations against symbol 0 do act as relative relocs, + but those against other symbols don't. */ + .R_RELATIVE = ~0U, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .arch_adjust = mips_arch_adjust, + .adjust_dyn = mips_adjust_dyn, + .adjust_rel = mips_adjust_rel, +--- prelink/src/arch-sh.c.jj 2006-12-01 19:21:24.000000000 +0100 ++++ prelink/src/arch-sh.c 2009-03-10 18:56:42.000000000 +0100 +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2001, 2002, 2003, 2004 Red Hat, Inc. ++/* Copyright (C) 2001, 2002, 2003, 2004, 2009 Red Hat, Inc. + Written by Jakub Jelinek , 2001. + + This program is free software; you can redistribute it and/or modify +@@ -414,6 +414,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_SH_JMP_SLOT, + .R_COPY = R_SH_COPY, + .R_RELATIVE = R_SH_RELATIVE, ++ .rtype_class_valid = RTYPE_CLASS_VALID, + .dynamic_linker = "/lib/ld-linux.so.2", + .adjust_dyn = sh_adjust_dyn, + .adjust_rel = sh_adjust_rel, diff -Nru prelink-0.0.20071009/src/prelink.h prelink-0.0.20090311/src/prelink.h --- prelink-0.0.20071009/src/prelink.h 2007-10-09 08:41:18.000000000 -0500 +++ prelink-0.0.20090311/src/prelink.h 2009-03-10 12:48:19.000000000 -0500 @@ -1,4 +1,5 @@ -/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc. +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 + Red Hat, Inc. Written by Jakub Jelinek , 2001. This program is free software; you can redistribute it and/or modify @@ -78,6 +79,12 @@ #define R_MIPS_GLOB_DAT 51 #endif +#ifndef R_ARM_TLS_DTPMOD32 +#define R_ARM_TLS_DTPMOD32 17 +#define R_ARM_TLS_DTPOFF32 18 +#define R_ARM_TLS_TPOFF32 19 +#endif + struct prelink_entry; struct prelink_info; struct PLArch; @@ -153,6 +160,7 @@ int R_COPY; int R_JMP_SLOT; int R_RELATIVE; + int rtype_class_valid; int (*arch_adjust) (DSO *dso, GElf_Addr start, GElf_Addr adjust); int (*adjust_section) (DSO *dso, int n, GElf_Addr start, GElf_Addr adjust); int (*adjust_dyn) (DSO *dso, int n, GElf_Dyn *dyn, GElf_Addr start, diff -Nru prelink-0.0.20071009/testsuite/reloc2.sh prelink-0.0.20090311/testsuite/reloc2.sh --- prelink-0.0.20071009/testsuite/reloc2.sh 2007-06-27 08:42:52.000000000 -0500 +++ prelink-0.0.20090311/testsuite/reloc2.sh 2009-03-10 09:38:57.000000000 -0500 @@ -2,7 +2,7 @@ . `dirname $0`/functions.sh SHFLAGS= case "`uname -m`" in - ia64|ppc*|x86_64|mips*) SHFLAGS=-fpic;; # Does not support non-pic shared libs + 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;; esac # Disable this test under SELinux if textrel diff -Nru prelink-0.0.20071009/testsuite/tls3.sh prelink-0.0.20090311/testsuite/tls3.sh --- prelink-0.0.20071009/testsuite/tls3.sh 2007-10-08 10:38:19.000000000 -0500 +++ prelink-0.0.20090311/testsuite/tls3.sh 2009-03-10 09:38:57.000000000 -0500 @@ -7,7 +7,7 @@ ( ./tlstest || { rm -f tlstest; exit 77; } ) 2>/dev/null || exit 77 SHFLAGS= case "`uname -m`" in - ia64|ppc*|x86_64|alpha*|s390*|mips*) SHFLAGS=-fpic;; # Does not support non-pic shared libs + ia64|ppc*|x86_64|alpha*|s390*|mips*|arm*) SHFLAGS=-fpic;; # Does not support non-pic shared libs esac # Disable this test under SELinux if textrel test -z "$SHFLAGS" -a -x /usr/sbin/getenforce -a "`/usr/sbin/getenforce`" = Enforcing && exit 77