From 202cdecd6746fbc98375154ad6e7885690627e05 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 22 Jan 2008 09:16:45 +0000 Subject: prelink: Update to the last release (20071027) and pull eabi fixes from poky --- packages/prelink/prelink-20060712/.mtn2git_empty | 0 packages/prelink/prelink-20060712/arm_eabi.patch | 286 -------------------- packages/prelink/prelink-20060712/prelink.conf | 18 -- .../prelink/prelink-20060712/prelink.cron.daily | 40 --- packages/prelink/prelink-20060712/prelink.default | 22 -- packages/prelink/prelink-20061027/.mtn2git_empty | 0 packages/prelink/prelink-20061027/arm_eabi.patch | 297 +++++++++++++++++++++ packages/prelink/prelink-20061027/prelink.conf | 18 ++ .../prelink/prelink-20061027/prelink.cron.daily | 40 +++ packages/prelink/prelink-20061027/prelink.default | 22 ++ packages/prelink/prelink_20060712.bb | 46 ---- packages/prelink/prelink_20061027.bb | 46 ++++ 12 files changed, 423 insertions(+), 412 deletions(-) delete mode 100644 packages/prelink/prelink-20060712/.mtn2git_empty delete mode 100644 packages/prelink/prelink-20060712/arm_eabi.patch delete mode 100644 packages/prelink/prelink-20060712/prelink.conf delete mode 100644 packages/prelink/prelink-20060712/prelink.cron.daily delete mode 100644 packages/prelink/prelink-20060712/prelink.default create mode 100644 packages/prelink/prelink-20061027/.mtn2git_empty create mode 100644 packages/prelink/prelink-20061027/arm_eabi.patch create mode 100644 packages/prelink/prelink-20061027/prelink.conf create mode 100644 packages/prelink/prelink-20061027/prelink.cron.daily create mode 100644 packages/prelink/prelink-20061027/prelink.default delete mode 100644 packages/prelink/prelink_20060712.bb create mode 100644 packages/prelink/prelink_20061027.bb (limited to 'packages/prelink') diff --git a/packages/prelink/prelink-20060712/.mtn2git_empty b/packages/prelink/prelink-20060712/.mtn2git_empty deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packages/prelink/prelink-20060712/arm_eabi.patch b/packages/prelink/prelink-20060712/arm_eabi.patch deleted file mode 100644 index b234af9b3f..0000000000 --- a/packages/prelink/prelink-20060712/arm_eabi.patch +++ /dev/null @@ -1,286 +0,0 @@ -Index: prelink-0.0.20050901/src/arch-arm.c -=================================================================== ---- prelink-0.0.20050901.orig/src/arch-arm.c 2004-09-30 17:07:57.000000000 +0100 -+++ prelink-0.0.20050901/src/arch-arm.c 2006-04-07 14:41:25.000000000 +0100 -@@ -145,6 +145,24 @@ - error (0, 0, "%s: R_ARM_PC24 relocs with non-zero addend should not be present in prelinked REL sections", - dso->filename); - return 1; -+ case R_ARM_TLS_DTPOFF32: -+ write_le32 (dso, rel->r_offset, value); -+ break; -+ /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink -+ sets the rules. Also for TPOFF{32,} there is REL->RELA problem. */ -+ 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; - case R_ARM_COPY: - if (dso->ehdr.e_type == ET_EXEC) - /* COPY relocs are handled specially in generic code. */ -@@ -195,6 +213,24 @@ - write_le32 (dso, rela->r_offset, - (read_ule32 (dso, rela->r_offset) & 0xff000000) | val); - break; -+ case R_ARM_TLS_DTPOFF32: -+ write_le32 (dso, rela->r_offset, value + rela->r_addend); -+ break; -+ /* DTPMOD32 and TPOFF32 is impossible to predict 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_le32 (dso, rela->r_offset, -+ -(value + rela->r_addend - info->resolvetls->offset)); -+ break; - case R_ARM_COPY: - if (dso->ehdr.e_type == ET_EXEC) - /* COPY relocs are handled specially in generic code. */ -@@ -315,6 +351,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 +361,31 @@ - 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; -@@ -342,6 +402,33 @@ - error (0, 0, "%s: R_ARM_%s relocs should not be present in prelinked REL sections", - dso->filename, GELF_R_TYPE (rel->r_info) == R_ARM_ABS32 ? "ABS32" : "PC24"); - 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: R_ARM_TLS 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_ule32 (dso, rel->r_offset) -+ - tls->offset); -+ break; -+ } -+ break; - case R_ARM_COPY: - error (0, 0, "R_ARM_COPY should not be present in shared libraries"); - return 1; -@@ -359,6 +446,7 @@ - { - GElf_Addr value; - struct prelink_conflict *conflict; -+ struct prelink_tls *tls; - GElf_Rela *ret; - Elf32_Sword val; - -@@ -369,8 +457,31 @@ - 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; -@@ -398,6 +509,32 @@ - 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: R_386_TLS 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,6 +555,7 @@ - abort (); - case R_ARM_RELATIVE: - case R_ARM_ABS32: -+ case R_ARM_TLS_TPOFF32: - rela->r_addend = (Elf32_Sword) read_ule32 (dso, rel->r_offset); - break; - case R_ARM_PC24: -@@ -426,6 +564,8 @@ - break; - case R_ARM_COPY: - case R_ARM_GLOB_DAT: -+ case R_ARM_TLS_DTPOFF32: -+ case R_ARM_TLS_DTPMOD32: - rela->r_addend = 0; - break; - } -@@ -445,6 +585,7 @@ - abort (); - case R_ARM_RELATIVE: - case R_ARM_ABS32: -+ case R_ARM_TLS_TPOFF32: - write_le32 (dso, rela->r_offset, rela->r_addend); - break; - case R_ARM_PC24: -@@ -453,6 +594,8 @@ - | ((rela->r_addend >> 2) & 0xffffff)); - break; - case R_ARM_GLOB_DAT: -+ case R_ARM_TLS_DTPMOD32: -+ case R_ARM_TLS_DTPOFF32: - write_le32 (dso, rela->r_offset, 0); - break; - } -@@ -488,6 +631,13 @@ - /* 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; - } - } - } -@@ -612,6 +762,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_le32 (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)); -@@ -634,6 +790,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; - } - } -@@ -646,7 +806,7 @@ - .R_JMP_SLOT = R_ARM_JUMP_SLOT, - .R_COPY = R_ARM_COPY, - .R_RELATIVE = R_ARM_RELATIVE, -- .dynamic_linker = "/lib/ld-linux.so.2", -+ .dynamic_linker = "/lib/ld-linux.so.3", - .adjust_dyn = arm_adjust_dyn, - .adjust_rel = arm_adjust_rel, - .adjust_rela = arm_adjust_rela, diff --git a/packages/prelink/prelink-20060712/prelink.conf b/packages/prelink/prelink-20060712/prelink.conf deleted file mode 100644 index c5a4f4adc3..0000000000 --- a/packages/prelink/prelink-20060712/prelink.conf +++ /dev/null @@ -1,18 +0,0 @@ -# This config file contains a list of directories both with binaries -# and libraries prelink should consider by default. -# If a directory name is prefixed with `-l ', the directory hierarchy -# will be walked as long as filesystem boundaries are not crossed. -# If a directory name is prefixed with `-h ', symbolic links in a -# directory hierarchy are followed. --l /usr/local/sbin --l /sbin --l /usr/sbin --l /usr/local/bin --l /bin --l /usr/bin --l /usr/X11R6/bin --l /usr/games --l /usr/local/lib --l /lib --l /usr/lib --l /usr/X11R6/lib diff --git a/packages/prelink/prelink-20060712/prelink.cron.daily b/packages/prelink/prelink-20060712/prelink.cron.daily deleted file mode 100644 index 0b3c07322c..0000000000 --- a/packages/prelink/prelink-20060712/prelink.cron.daily +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -. /etc/default/prelink - -renice +19 -p $$ >/dev/null 2>&1 - -if [ "$PRELINKING" != yes ]; then - if [ -f /etc/prelink.cache ]; then - echo /usr/sbin/prelink -uav > /var/log/prelink.log - /usr/sbin/prelink -uav >> /var/log/prelink.log 2>&1 - rm -f /etc/prelink.cache - # Restart init if needed - [ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u - fi - exit 0 -fi - -if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \ - || grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then - # If cache does not exist or is from older prelink versions or - # if we were asked to explicitely, force full prelinking - rm -f /etc/prelink.cache /var/lib/misc/prelink.force - PRELINK_OPTS="$PRELINK_OPTS -f" - date > /var/lib/misc/prelink.full -elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \ - -a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \ - = /var/lib/misc/prelink.full ]; then - # If prelink without -q has been run in the last - # PRELINK_FULL_TIME_INTERVAL days, just use quick mode - PRELINK_OPTS="$PRELINK_OPTS -q" -else - date > /var/lib/misc/prelink.full -fi - -echo /usr/sbin/prelink -av $PRELINK_OPTS > /var/log/prelink.log -/usr/sbin/prelink -av $PRELINK_OPTS >> /var/log/prelink.log 2>&1 -# Restart init if needed -[ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u - -exit 0 diff --git a/packages/prelink/prelink-20060712/prelink.default b/packages/prelink/prelink-20060712/prelink.default deleted file mode 100644 index 901258ed2a..0000000000 --- a/packages/prelink/prelink-20060712/prelink.default +++ /dev/null @@ -1,22 +0,0 @@ -# Set this to no to disable prelinking altogether -# or to yes to enable it. -# (if you change this from yes to no prelink -ua -# will be run next night to undo prelinking) -PRELINKING=unknown - -# Options to pass to prelink -# -m Try to conserve virtual memory by allowing overlapping -# assigned virtual memory slots for libraries which -# never appear together in one binary -# -R Randomize virtual memory slot assignments for libraries. -# This makes it slightly harder for various buffer overflow -# attacks, since library addresses will be different on each -# host using -R. -PRELINK_OPTS=-mR - -# How often should full prelink be run (in days) -# Normally, prelink will be run in quick mode, every -# $PRELINK_FULL_TIME_INTERVAL days it will be run -# in normal mode. Comment this line out if prelink -# should be run in normal mode always. -PRELINK_FULL_TIME_INTERVAL=14 diff --git a/packages/prelink/prelink-20061027/.mtn2git_empty b/packages/prelink/prelink-20061027/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/prelink/prelink-20061027/arm_eabi.patch b/packages/prelink/prelink-20061027/arm_eabi.patch new file mode 100644 index 0000000000..dbce9d2895 --- /dev/null +++ b/packages/prelink/prelink-20061027/arm_eabi.patch @@ -0,0 +1,297 @@ +--- + src/arch-arm.c | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 172 insertions(+), 5 deletions(-) + +Index: prelink-0.0.20061027/src/arch-arm.c +=================================================================== +--- prelink-0.0.20061027.orig/src/arch-arm.c 2006-08-13 16:18:17.000000000 +0100 ++++ prelink-0.0.20061027/src/arch-arm.c 2007-09-04 12:29:06.000000000 +0100 +@@ -145,6 +145,26 @@ arm_prelink_rel (struct prelink_info *in + error (0, 0, "%s: R_ARM_PC24 relocs with non-zero addend should not be present in prelinked REL sections", + dso->filename); + return 1; ++ /* DTPOFF32, DTPMOD32 and TPOFF32 is impossible to predict unless prelink ++ sets the rules. Also for DTPOFF32/TPOFF32 there is REL->RELA problem. */ ++ case R_ARM_TLS_DTPOFF32: ++ if (dso->ehdr.e_type == ET_EXEC) ++ error (0, 0, "%s: R_ARM_TLS_DTPOFF32 relocs should not be present in prelinked ET_EXEC REL sections", ++ dso->filename); ++ break; ++ 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; + case R_ARM_COPY: + if (dso->ehdr.e_type == ET_EXEC) + /* COPY relocs are handled specially in generic code. */ +@@ -195,6 +215,25 @@ arm_prelink_rela (struct prelink_info *i + write_le32 (dso, rela->r_offset, + (read_ule32 (dso, rela->r_offset) & 0xff000000) | val); + break; ++ case R_ARM_TLS_DTPOFF32: ++ if (dso->ehdr.e_type == ET_EXEC) ++ write_le32 (dso, rela->r_offset, value + rela->r_addend); ++ break; ++ /* DTPMOD32 and TPOFF32 are impossible to predict 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_le32 (dso, rela->r_offset, ++ value + rela->r_addend + info->resolvetls->offset); ++ break; + case R_ARM_COPY: + if (dso->ehdr.e_type == ET_EXEC) + /* COPY relocs are handled specially in generic code. */ +@@ -315,6 +354,7 @@ arm_prelink_conflict_rel (DSO *dso, stru + { + 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 +364,32 @@ arm_prelink_conflict_rel (DSO *dso, stru + 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 {D,}TPOFF relocs need conflicts. */ ++ case R_ARM_TLS_DTPMOD32: ++ case R_ARM_TLS_DTPOFF32: ++ 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; +@@ -342,6 +406,33 @@ arm_prelink_conflict_rel (DSO *dso, stru + error (0, 0, "%s: R_ARM_%s relocs should not be present in prelinked REL sections", + dso->filename, GELF_R_TYPE (rel->r_info) == R_ARM_ABS32 ? "ABS32" : "PC24"); + 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: R_ARM_TLS 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 + read_ule32 (dso, rel->r_offset); ++ break; ++ case R_ARM_TLS_TPOFF32: ++ ret->r_addend = value + read_ule32 (dso, rel->r_offset) ++ + tls->offset; ++ break; ++ } ++ break; + case R_ARM_COPY: + error (0, 0, "R_ARM_COPY should not be present in shared libraries"); + return 1; +@@ -359,6 +450,7 @@ arm_prelink_conflict_rela (DSO *dso, str + { + GElf_Addr value; + struct prelink_conflict *conflict; ++ struct prelink_tls *tls; + GElf_Rela *ret; + Elf32_Sword val; + +@@ -369,8 +461,32 @@ arm_prelink_conflict_rela (DSO *dso, str + 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 {D,}TPOFF relocs need conflicts. */ ++ case R_ARM_TLS_DTPMOD32: ++ case R_ARM_TLS_DTPOFF32: ++ 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; +@@ -398,6 +514,32 @@ arm_prelink_conflict_rela (DSO *dso, str + 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: R_386_TLS 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 + rela->r_addend; ++ 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,6 +560,8 @@ arm_rel_to_rela (DSO *dso, GElf_Rel *rel + abort (); + case R_ARM_RELATIVE: + case R_ARM_ABS32: ++ case R_ARM_TLS_TPOFF32: ++ case R_ARM_TLS_DTPOFF32: + rela->r_addend = (Elf32_Sword) read_ule32 (dso, rel->r_offset); + break; + case R_ARM_PC24: +@@ -426,6 +570,7 @@ arm_rel_to_rela (DSO *dso, GElf_Rel *rel + break; + case R_ARM_COPY: + case R_ARM_GLOB_DAT: ++ case R_ARM_TLS_DTPMOD32: + rela->r_addend = 0; + break; + } +@@ -445,6 +590,8 @@ arm_rela_to_rel (DSO *dso, GElf_Rela *re + abort (); + case R_ARM_RELATIVE: + case R_ARM_ABS32: ++ case R_ARM_TLS_TPOFF32: ++ case R_ARM_TLS_DTPOFF32: + write_le32 (dso, rela->r_offset, rela->r_addend); + break; + case R_ARM_PC24: +@@ -453,6 +600,7 @@ arm_rela_to_rel (DSO *dso, GElf_Rela *re + | ((rela->r_addend >> 2) & 0xffffff)); + break; + case R_ARM_GLOB_DAT: ++ case R_ARM_TLS_DTPMOD32: + write_le32 (dso, rela->r_offset, 0); + break; + } +@@ -488,6 +636,15 @@ arm_need_rel_to_rela (DSO *dso, int firs + /* FALLTHROUGH */ + case R_ARM_PC24: + return 1; ++ case R_ARM_TLS_DTPOFF32: ++ case R_ARM_TLS_TPOFF32: ++ /* In shared libraries {D,}TPOFF32 is changed always into ++ conflicts, for executables we need to preserve ++ original addend. */ ++ if (dso->ehdr.e_type == ET_EXEC) { ++ return 1; ++ } ++ break; + } + } + } +@@ -612,6 +769,12 @@ arm_undo_prelink_rel (DSO *dso, GElf_Rel + return 0; + error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename); + return 1; ++ case R_ARM_TLS_DTPMOD32: ++ write_le32 (dso, rel->r_offset, 0); ++ break; ++ case R_ARM_TLS_DTPOFF32: ++ 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)); +@@ -634,6 +797,10 @@ arm_reloc_class (int reloc_type) + { + 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; + } + } +@@ -646,7 +813,7 @@ PL_ARCH = { + .R_JMP_SLOT = R_ARM_JUMP_SLOT, + .R_COPY = R_ARM_COPY, + .R_RELATIVE = R_ARM_RELATIVE, +- .dynamic_linker = "/lib/ld-linux.so.2", ++ .dynamic_linker = "/lib/ld-linux.so.3", + .adjust_dyn = arm_adjust_dyn, + .adjust_rel = arm_adjust_rel, + .adjust_rela = arm_adjust_rela, diff --git a/packages/prelink/prelink-20061027/prelink.conf b/packages/prelink/prelink-20061027/prelink.conf new file mode 100644 index 0000000000..c5a4f4adc3 --- /dev/null +++ b/packages/prelink/prelink-20061027/prelink.conf @@ -0,0 +1,18 @@ +# This config file contains a list of directories both with binaries +# and libraries prelink should consider by default. +# If a directory name is prefixed with `-l ', the directory hierarchy +# will be walked as long as filesystem boundaries are not crossed. +# If a directory name is prefixed with `-h ', symbolic links in a +# directory hierarchy are followed. +-l /usr/local/sbin +-l /sbin +-l /usr/sbin +-l /usr/local/bin +-l /bin +-l /usr/bin +-l /usr/X11R6/bin +-l /usr/games +-l /usr/local/lib +-l /lib +-l /usr/lib +-l /usr/X11R6/lib diff --git a/packages/prelink/prelink-20061027/prelink.cron.daily b/packages/prelink/prelink-20061027/prelink.cron.daily new file mode 100644 index 0000000000..0b3c07322c --- /dev/null +++ b/packages/prelink/prelink-20061027/prelink.cron.daily @@ -0,0 +1,40 @@ +#!/bin/sh + +. /etc/default/prelink + +renice +19 -p $$ >/dev/null 2>&1 + +if [ "$PRELINKING" != yes ]; then + if [ -f /etc/prelink.cache ]; then + echo /usr/sbin/prelink -uav > /var/log/prelink.log + /usr/sbin/prelink -uav >> /var/log/prelink.log 2>&1 + rm -f /etc/prelink.cache + # Restart init if needed + [ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u + fi + exit 0 +fi + +if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \ + || grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then + # If cache does not exist or is from older prelink versions or + # if we were asked to explicitely, force full prelinking + rm -f /etc/prelink.cache /var/lib/misc/prelink.force + PRELINK_OPTS="$PRELINK_OPTS -f" + date > /var/lib/misc/prelink.full +elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \ + -a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \ + = /var/lib/misc/prelink.full ]; then + # If prelink without -q has been run in the last + # PRELINK_FULL_TIME_INTERVAL days, just use quick mode + PRELINK_OPTS="$PRELINK_OPTS -q" +else + date > /var/lib/misc/prelink.full +fi + +echo /usr/sbin/prelink -av $PRELINK_OPTS > /var/log/prelink.log +/usr/sbin/prelink -av $PRELINK_OPTS >> /var/log/prelink.log 2>&1 +# Restart init if needed +[ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u + +exit 0 diff --git a/packages/prelink/prelink-20061027/prelink.default b/packages/prelink/prelink-20061027/prelink.default new file mode 100644 index 0000000000..901258ed2a --- /dev/null +++ b/packages/prelink/prelink-20061027/prelink.default @@ -0,0 +1,22 @@ +# Set this to no to disable prelinking altogether +# or to yes to enable it. +# (if you change this from yes to no prelink -ua +# will be run next night to undo prelinking) +PRELINKING=unknown + +# Options to pass to prelink +# -m Try to conserve virtual memory by allowing overlapping +# assigned virtual memory slots for libraries which +# never appear together in one binary +# -R Randomize virtual memory slot assignments for libraries. +# This makes it slightly harder for various buffer overflow +# attacks, since library addresses will be different on each +# host using -R. +PRELINK_OPTS=-mR + +# How often should full prelink be run (in days) +# Normally, prelink will be run in quick mode, every +# $PRELINK_FULL_TIME_INTERVAL days it will be run +# in normal mode. Comment this line out if prelink +# should be run in normal mode always. +PRELINK_FULL_TIME_INTERVAL=14 diff --git a/packages/prelink/prelink_20060712.bb b/packages/prelink/prelink_20060712.bb deleted file mode 100644 index fcf990b7a0..0000000000 --- a/packages/prelink/prelink_20060712.bb +++ /dev/null @@ -1,46 +0,0 @@ -SECTION = "devel" -DEPENDS = "elfutils" -DESCRIPTION = " The prelink package contains a utility which modifies ELF shared libraries \ -and executables, so that far fewer relocations need to be resolved at \ -runtime and thus programs come up faster." -LICENSE = "GPL" -PR = "r2" - -SRC_URI = "${DEBIAN_MIRROR}/main/p/prelink/prelink_0.0.${PV}.orig.tar.gz \ - file://prelink.conf \ - file://prelink.cron.daily \ - file://prelink.default" - -TARGET_OS_ORIG := "${TARGET_OS}" -OVERRIDES_append = ":${TARGET_OS_ORIG}" -SRC_URI_append_linux-gnueabi = " file://arm_eabi.patch;patch=1" - -S = "${WORKDIR}/prelink-0.0.${PV}" - -EXTRA_OECONF = "--disable-64bit" - -inherit autotools - -do_install_append () { - install -d ${D}${sysconfdir}/cron.daily ${D}${sysconfdir}/default - install -m 0644 ${WORKDIR}/prelink.conf ${D}${sysconfdir}/prelink.conf - install -m 0644 ${WORKDIR}/prelink.cron.daily ${D}${sysconfdir}/cron.daily/prelink - install -m 0644 ${WORKDIR}/prelink.default ${D}${sysconfdir}/default/prelink -} - -pkg_postinst_prelink() { -#!/bin/sh - -if [ "x$D" != "x" ]; then - exit 1 -fi - -prelink -a -} - -pkg_postrm_prelink() { -#!/bin/sh - -prelink -au -} - diff --git a/packages/prelink/prelink_20061027.bb b/packages/prelink/prelink_20061027.bb new file mode 100644 index 0000000000..e93f1f2515 --- /dev/null +++ b/packages/prelink/prelink_20061027.bb @@ -0,0 +1,46 @@ +SECTION = "devel" +DEPENDS = "elfutils" +DESCRIPTION = " The prelink package contains a utility which modifies ELF shared libraries \ +and executables, so that far fewer relocations need to be resolved at \ +runtime and thus programs come up faster." +LICENSE = "GPL" +PR = "r5" + +SRC_URI = "${DEBIAN_MIRROR}/main/p/prelink/prelink_0.0.${PV}.orig.tar.gz \ + file://prelink.conf \ + file://prelink.cron.daily \ + file://prelink.default" + +TARGET_OS_ORIG := "${TARGET_OS}" +OVERRIDES_append = ":${TARGET_OS_ORIG}" +SRC_URI_append_linux-gnueabi = " file://arm_eabi.patch;patch=1" + +S = "${WORKDIR}/prelink-0.0.${PV}" + +EXTRA_OECONF = "--disable-64bit" + +inherit autotools + +do_install_append () { + install -d ${D}${sysconfdir}/cron.daily ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/prelink.conf ${D}${sysconfdir}/prelink.conf + install -m 0644 ${WORKDIR}/prelink.cron.daily ${D}${sysconfdir}/cron.daily/prelink + install -m 0644 ${WORKDIR}/prelink.default ${D}${sysconfdir}/default/prelink +} + +pkg_postinst_prelink() { +#!/bin/sh + +if [ "x$D" != "x" ]; then + exit 1 +fi + +prelink -a +} + +pkg_postrm_prelink() { +#!/bin/sh + +prelink -au +} + -- cgit v1.2.3