prelink: Add fix to correctly handle R_ARM_TLS_DTPOFF32 symbols

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4622 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie
2008-06-11 19:24:14 +00:00
parent 7f0ef9ed2d
commit 5d40cb0d53
2 changed files with 70 additions and 2 deletions

View File

@@ -0,0 +1,67 @@
Index: prelink-0.0.20061027/src/arch-arm.c
===================================================================
--- prelink-0.0.20061027.orig/src/arch-arm.c 2008-06-04 19:41:07.000000000 +0100
+++ prelink-0.0.20061027/src/arch-arm.c 2008-06-04 19:41:59.000000000 +0100
@@ -145,13 +145,12 @@
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. */
+ /* DTPMOD32 is impossible to predict unless prelink sets the rules.
+ DTPOFF32/TPOFF32 are converted REL->RELA. */
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",
+ error (0, 0, "%s: R_ARM_TLS_DTPOFF32 relocs should not be present in prelinked REL section",
dso->filename);
- break;
+ return 1;
case R_ARM_TLS_DTPMOD32:
if (dso->ehdr.e_type == ET_EXEC)
{
@@ -161,9 +160,11 @@
}
break;
case R_ARM_TLS_TPOFF32:
- if (dso->ehdr.e_type == ET_EXEC)
+ 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);
+ return 1;
+ }
break;
case R_ARM_COPY:
if (dso->ehdr.e_type == ET_EXEC)
@@ -216,8 +217,7 @@
(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);
+ write_le32 (dso, rela->r_offset, value + rela->r_addend);
break;
/* DTPMOD32 and TPOFF32 are impossible to predict unless prelink
sets the rules. */
@@ -521,7 +521,7 @@
&& (conflict->reloc_class != RTYPE_CLASS_TLS
|| conflict->lookup.tls == NULL))
{
- error (0, 0, "%s: R_386_TLS not resolving to STT_TLS symbol",
+ error (0, 0, "%s: R_ARM_TLS not resolving to STT_TLS symbol",
dso->filename);
return 1;
}
@@ -637,8 +637,11 @@
case R_ARM_PC24:
return 1;
case R_ARM_TLS_DTPOFF32:
+ /* We can prelink these fields, and the addend is relative
+ to the symbol value. A RELA entry is needed. */
+ return 1;
case R_ARM_TLS_TPOFF32:
- /* In shared libraries {D,}TPOFF32 is changed always into
+ /* In shared libraries TPOFF32 is changed always into
conflicts, for executables we need to preserve
original addend. */
if (dso->ehdr.e_type == ET_EXEC) {

View File

@@ -4,7 +4,7 @@ DESCRIPTION = " The prelink package contains a utility which modifies ELF shared
and executables, so that far fewer relocations need to be resolved at \
runtime and thus programs come up faster."
LICENSE = "GPL"
PR = "r7"
PR = "r8"
SRC_URI = "${DEBIAN_MIRROR}/main/p/prelink/prelink_0.0.${PV}.orig.tar.gz \
file://prelink.conf \
@@ -13,7 +13,8 @@ SRC_URI = "${DEBIAN_MIRROR}/main/p/prelink/prelink_0.0.${PV}.orig.tar.gz \
TARGET_OS_ORIG := "${TARGET_OS}"
OVERRIDES_append = ":${TARGET_OS_ORIG}"
SRC_URI_append_linux-gnueabi = " file://arm_eabi.patch;patch=1"
SRC_URI_append_linux-gnueabi = " file://arm_eabi.patch;patch=1 \
file://armfix.patch;patch=1 "
S = "${WORKDIR}/prelink-0.0.${PV}"